here is the code:
Resource_Time_Spent resTimeSpent = new Resource_Time_Spent();
Resource_TimeSpan resTimeSpan = new Resource_TimeSpan();
resTimeSpan.ReplyId = ticketReply.ID;
resTimeSpan.StaffId = ddl.SelectedValue;
resTimeSpan.TicketId = ticketid;
string[] span = tbtxttimespent.Text.Split(':');
string HH = string.Empty;
string MM = string.Empty;
if (span[0].Length <= 1) {
HH = "0" + span[0];
}
else { HH = span[0]; }
if (span[1].Length <= 1) {
MM = "0" + span[1];
}
else { MM = span[1]; }
resTimeSpan.TimeSpent = HH + ":" + MM + ":" + "00";
resTimeSpan.TimeSpent = this.getTimeSpent(span[0], span[1]).ToString();//sumanth removed commnts
if (!string.IsNullOrEmpty(tbtxtfromdate.Text)) {
resTimeSpan.FromDt = Convert.ToDateTime(tbtxtfromdate.Text);
}
if (!string.IsNullOrEmpty(tbtxttodate.Text)) {
resTimeSpan.ToDt = Convert.ToDateTime(tbtxttodate.Text);
}
resTimeSpan.FromTimeSpent = this.getTimeSpent(tbtxtfromdateHours.Text, tbtxtfromdateMinutes.Text).ToString();
resTimeSpan.ToTimeSpent = this.getTimeSpent(tbtxttodateHours.Text, tbtxttodateMinutes.Text).ToString();
if (chkbox.Checked) {
resTimeSpan.isBusinessHr = true;
}
resTimeSpent.Submit(resTimeSpan);
}
exception: if return time is morethan 24 hours it is giving range exception