private void FillCalDataWithOutHoliday_Calendar(decimal groupId, int year) { string StrCalDataList = string.Empty; List <CalDataView> CalDataViewList = new List <CalDataView>(); Dictionary <int, int> firstDayOfMonthDic = this.GetFirstDayOfMinth_Calendar(year); try { IList <CalendarCellInfo> CalendarCellInfoList = null; CalendarCellInfoList = this.CalendarBusiness.GetAll(groupId, year); foreach (CalendarCellInfo calendarCellInfoItem in CalendarCellInfoList) { string strCalDataPart = string.Empty; strCalDataPart = "#SID=" + calendarCellInfoItem.ShiftID.ToString(); StrCalDataList += "M=" + calendarCellInfoItem.Month.ToString() + "#D=" + calendarCellInfoItem.Day.ToString() + strCalDataPart + "%"; Dictionary <string, int> PointerDic = this.GetColPointer_Calendar(calendarCellInfoItem.Day, firstDayOfMonthDic[calendarCellInfoItem.Month]); CalDataView calDataView = new CalDataView(); calDataView.M = calendarCellInfoItem.Month.ToString(); calDataView.CPointer = PointerDic["Cp"].ToString(); calDataView.RPointer = PointerDic["Rp"].ToString(); calDataView.Title = calendarCellInfoItem.Title; calDataView.SColor = calendarCellInfoItem.Color; CalDataViewList.Add(calDataView); } this.hfCalData_Calendar.Value = StrCalDataList; JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); this.hfCalDataView_Calendar.Value = jsSerializer.Serialize(CalDataViewList); } catch (Exception ex) { throw ex; } }
private void FillCalData_Calendar(PageCaller PG, CalViewState CVS, decimal groupID, int year) { string[] retMessage = new string[3]; string StrCalDataList = string.Empty; List <CalDataView> CalDataViewList = new List <CalDataView>(); Dictionary <int, int> firstDayOfMonthDic = this.GetFirstDayOfMinth_Calendar(year); try { IList <CalendarCellInfo> CalendarCellInfoList = null; switch (PG) { case PageCaller.WorkGroups: switch (CVS) { case CalViewState.Normal: CalendarCellInfoList = this.CalendarBusiness.GetAll(groupID, year); break; case CalViewState.PeriodRepeat: if (Session["PeriodRepeatList_Calendar"] != null) { CalendarCellInfoList = (IList <CalendarCellInfo>)Session["PeriodRepeatList_Calendar"]; Session["PeriodRepeatList_Calendar"] = null; } break; } break; case PageCaller.Holidays: CalendarCellInfoList = this.YearlyHolidaysBusiness.GetCalendarList(year, groupID); break; } foreach (CalendarCellInfo calendarCellInfoItem in CalendarCellInfoList) { string strCalDataPart = string.Empty; switch (PG) { case PageCaller.WorkGroups: strCalDataPart = "#SID=" + calendarCellInfoItem.ShiftID.ToString(); break; case PageCaller.Holidays: strCalDataPart = "#SID=1"; break; } StrCalDataList += "M=" + calendarCellInfoItem.Month.ToString() + "#D=" + calendarCellInfoItem.Day.ToString() + strCalDataPart + "%"; Dictionary <string, int> PointerDic = this.GetColPointer_Calendar(calendarCellInfoItem.Day, firstDayOfMonthDic[calendarCellInfoItem.Month]); CalDataView calDataView = new CalDataView(); calDataView.M = calendarCellInfoItem.Month.ToString(); calDataView.CPointer = PointerDic["Cp"].ToString(); calDataView.RPointer = PointerDic["Rp"].ToString(); calDataView.Title = calendarCellInfoItem.Title; calDataView.SColor = calendarCellInfoItem.Color; CalDataViewList.Add(calDataView); } this.hfCalData_Calendar.Value = StrCalDataList; JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); this.hfCalDataView_Calendar.Value = jsSerializer.Serialize(CalDataViewList); } catch (UIValidationExceptions ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage); this.ErrorHiddenField_CalData_Calendar.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (UIBaseException ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage); this.ErrorHiddenField_CalData_Calendar.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } catch (Exception ex) { retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage); this.ErrorHiddenField_CalData_Calendar.Value = this.exceptionHandler.CreateErrorMessage(retMessage); } }