public List <Project.Entity.Calender> LoadAllAppointmentsInDateRange(string start, string end) { objResponse Response = new objResponse(); //var fromDate = ConvertFromUnixTimestamp(start); // var toDate = ConvertFromUnixTimestamp(end); List <Project.Entity.Calender> result = new List <Project.Entity.Calender>(); try { SqlParameter[] sqlParameter = new SqlParameter[2]; sqlParameter[0] = new SqlParameter("@fromDate", SqlDbType.DateTime, 100); sqlParameter[0].Value = Convert.ToDateTime(start); sqlParameter[1] = new SqlParameter("@toDate", SqlDbType.DateTime, 100); sqlParameter[1].Value = Convert.ToDateTime(end); //sqlParameter[2] = new SqlParameter("@LogedUser", SqlDbType.BigInt, 10); //sqlParameter[2].Value = LogedUser; DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetTasksByDateRange", sqlParameter, DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = "Success"; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { Project.Entity.Calender rec = new Project.Entity.Calender(); rec.ID = Convert.ToInt32(dr["Task_ID_Auto_PK"]); rec.EventOwner = Convert.ToInt32(dr["CreatedByName"]); rec.StartDateString = Convert.ToDateTime(dr["StartDate"]).ToString("s"); //item.DateTimeScheduled.ToString("s"); // "s" is a preset format that outputs as: "2009-02-27T12:12:22" rec.EndDateString = Convert.ToDateTime(dr["EndDate"]).ToString("s"); //item.DateTimeScheduled.AddMinutes(item.AppointmentLength).ToString("s"); // field AppointmentLength is in minutes rec.Title = dr["Title"].ToString(); //item.Title + " - " + item.AppointmentLength.ToString() + " mins"; // rec.StatusString = Enums.GetName<AppointmentStatus>((AppointmentStatus)item.StatusENUM); // rec.StatusColor = Enums.GetEnumDescription<AppointmentStatus>(rec.StatusString); //string ColorCode = rec.StatusColor.Substring(0, rec.StatusColor.IndexOf(":")); // rec.ClassName = rec.StatusColor.Substring(rec.StatusColor.IndexOf(":") + 1, rec.StatusColor.Length - ColorCode.Length - 1); // rec.StatusColor = ColorCode; result.Add(rec); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("LoadAllAppointmentsInDateRange calmanager", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(result); }
public List <Project.Entity.Calender> LoadAppointmentSummaryInDateRange(string start, string end) { objResponse Response = new objResponse(); // var fromDate = ConvertFromUnixTimestamp(start); // var toDate = ConvertFromUnixTimestamp(end); List <Project.Entity.Calender> result = new List <Project.Entity.Calender>(); try { SqlParameter[] sqlParameter = new SqlParameter[2]; sqlParameter[0] = new SqlParameter("@start", SqlDbType.DateTime, 100); sqlParameter[0].Value = Convert.ToDateTime(start); sqlParameter[1] = new SqlParameter("@end", SqlDbType.DateTime, 100); sqlParameter[1].Value = Convert.ToDateTime(end); //sqlParameter[2] = new SqlParameter("@LogedUser", SqlDbType.BigInt, 10); //sqlParameter[2].Value = LogedUser; DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetEvent", sqlParameter, DB_CONSTANTS.ConnectionString_ERP_CRUZATA); if (Response.ResponseData.Tables[0].Rows.Count > 0) { Response.ErrorCode = 0; Response.ErrorMessage = "Success"; foreach (DataRow dr in Response.ResponseData.Tables[0].Rows) { Project.Entity.Calender rec = new Project.Entity.Calender(); rec.ID = Convert.ToInt32(dr["Event_ID_Auto_PK"]); rec.EventColor = Convert.ToString(dr["Colour"]); rec.StartDateString = Convert.ToDateTime(dr["StartDate"]).ToString("yyyy/MM/dd hh:mm tt"); rec.EndDateString = Convert.ToDateTime(dr["EndDate"]).ToString("yyyy/MM/dd hh:mm tt"); rec.Title = dr["Title"].ToString(); result.Add(rec); } } else { Response.ErrorCode = 2001; Response.ErrorMessage = "There is an Error. Please Try After some time."; } } catch (Exception ex) { Response.ErrorCode = 3001; Response.ErrorMessage = ex.Message.ToString(); BAL.Common.LogManager.LogError("LoadAppointmentSummaryInDateRange calmanager", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace)); } return(result); }