public HolidayCalendarEntity GetHolidayByID(int ID) { HolidayCalendarEntity response = new HolidayCalendarEntity(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from h in db.HolidayCalendars join a in db.Accounts on h.AccountID equals a.Acc_AccountID //join cp in db.ClientProjects on h.CL_ProjectID equals cp.CL_ProjectID where h.HolidayCalendarID == ID select new HolidayCalendarEntity { HolidayCalendarID = h.HolidayCalendarID, HolidayName = h.HolidayName, HolidayDate = h.HolidayDate, HolidayCalendarProjectId = h.CL_ProjectID, //ProjectName = cp.ClientProjTitle, //Year = h.Year, FinancialYearId = h.Year, //HolidayWeek = h.HolidayDate.DayOfWeek.ToString(), //AccountID = h.AccountID, // AccountName = a.Acc_AccountName, isOptionalHoliday = h.isOptionalHoliday, //isActive = h.isActive, CreatedBy = h.CreatedBy, CreatedDate = h.CreatedDate, ModifiedBy = h.ModifiedBy, ModifiedDate = h.ModifiedDate, isDeleted = h.isDeleted, }).FirstOrDefault(); response.IsSuccessful = true; return(response); } catch (Exception ex) { response.IsSuccessful = false; response.Message = "Error Occured in GetTaskDetailDetailByID(ID)"; response.Detail = ex.Message.ToString(); return(response); } } }
private object EntityList_Creating() { HolidayCalendarEntity cal = ((HolidayCalendarEntity)DataContext); if (cal == null || cal.Holidays == null || cal.Holidays.Count == 0) { return new HolidayEmbedded { Date = DateTime.Today } } ; else { return new HolidayEmbedded { Date = cal.Holidays.Max(a => a.Date) } }; } }
public JsonResult GetCalenderDetailByID(int ID) { HolidayCalendarEntity holiday = _holidayComp.GetHolidayByID(ID); return(Json(holiday, JsonRequestBehavior.AllowGet)); }