/// <summary> /// Initializes the grid. /// </summary> /// <param name="columns">The columns.</param> /// <param name="grid">The grid.</param> protected virtual void InitializeGrid(IEnumerable <Models.GridColumn> columns, Grid grid) { if (grid.Levels == null || grid.Levels.Count == 0) { return; } grid.GroupingNotificationText = string.Empty; var level = grid.Levels[0]; var gridColumns = columns as Models.GridColumn[] ?? columns.ToArray(); this.GridColumns = new List <Models.GridColumn>(gridColumns); foreach (var gridColumn in gridColumns) { var col = new GridColumn(); level.Columns.Add(col); col.Visible = !gridColumn.Hidden; col.AllowGrouping = InheritBool.False; col.DataField = gridColumn.FieldName; col.HeadingText = gridColumn.Header; } }
/// <summary> /// Initializes the grid. /// </summary> /// <param name="columns">The columns.</param> /// <param name="grid">The grid.</param> protected virtual void InitializeGrid(IEnumerable<Models.GridColumn> columns, Grid grid) { if (grid.Levels == null || grid.Levels.Count == 0) { return; } grid.GroupingNotificationText = string.Empty; var level = grid.Levels[0]; var gridColumns = columns as Models.GridColumn[] ?? columns.ToArray(); this.GridColumns = new List<Models.GridColumn>(gridColumns); foreach (var gridColumn in gridColumns) { var col = new GridColumn(); level.Columns.Add(col); col.Visible = !gridColumn.Hidden; col.AllowGrouping = InheritBool.False; col.DataField = gridColumn.FieldName; col.HeadingText = gridColumn.Header; } }
private void InitializeMonthlyCalendar(int year, int month) { DateTime DateDay; DateTime MonthStart = new DateTime(); DateTime MonthEnd = new DateTime(); int MonthDayCount = 0; int day = 0; string DayWithDateDay = string.Empty; string DayWeek = string.Empty; System.Globalization.PersianCalendar pc = new System.Globalization.PersianCalendar(); GregorianCalendar gCal = new GregorianCalendar(); ComponentArt.Web.UI.GridColumn DateColumn = null; IList <GTS.Clock.Model.Concepts.Calendar> calendarlist = null; switch (BLanguage.CurrentSystemLanguage) { case LanguagesName.Parsi: MonthDayCount = pc.GetDaysInMonth(year, month); MonthStart = pc.ToDateTime(year, month, 1, 0, 0, 0, 0); MonthEnd = pc.ToDateTime(year, month, MonthDayCount, 0, 0, 0, 0); calendarlist = this.CalendarTypeBusiness.GetMonthlyHoliday(MonthStart, MonthEnd); for (int i = 1; i <= MonthDayCount; i++) { DateDay = pc.ToDateTime(year, month, i, 0, 0, 0, 0); DayOfWeek Day = pc.GetDayOfWeek(DateDay); string DateDayPersian = Utility.ToPersianDate(DateDay); day = GetDayOfWeek(Day); DayWeek = this.GetAxises_Calendar(day); DayWithDateDay = DayWeek + " " + DateDayPersian; DateColumn = new ComponentArt.Web.UI.GridColumn(); DateColumn.HeadingText = DayWithDateDay; DateColumn.DefaultSortDirection = GridSortDirection.Ascending; DateColumn.Align = ComponentArt.Web.UI.TextAlign.Center; DateColumn.Width = 75; DateColumn.DataField = "Day" + i; GTS.Clock.Model.Concepts.Calendar calendar = calendarlist.Where(x => x.Date == DateDay).FirstOrDefault(); if (calendar != null) { DateColumn.HeadingTextCssClass = "HeadingTextRed"; } else { DateColumn.HeadingTextCssClass = "HeadingText"; } this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.Levels[0].Columns.Add(DateColumn); } DateColumn = new ComponentArt.Web.UI.GridColumn(); DateColumn.AllowSorting = InheritBool.False; DateColumn.DataCellClientTemplateId = "EditTemplate"; DateColumn.EditControlType = GridColumnEditControlType.EditCommand; DateColumn.Width = 50; DateColumn.Align = ComponentArt.Web.UI.TextAlign.Center; this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.Levels[0].Columns.Add(DateColumn); break; case LanguagesName.English: MonthDayCount = gCal.GetDaysInMonth(year, month); MonthStart = gCal.ToDateTime(year, month, 1, 0, 0, 0, 0); MonthEnd = gCal.ToDateTime(year, month, MonthDayCount, 0, 0, 0, 0); calendarlist = this.CalendarTypeBusiness.GetMonthlyHoliday(MonthStart, MonthEnd); for (int i = 1; i <= MonthDayCount; i++) { DateDay = gCal.ToDateTime(year, month, i, 0, 0, 0, 0); DayOfWeek Day = gCal.GetDayOfWeek(DateDay); day = GetDayOfWeek(Day); DayWeek = this.GetAxises_Calendar(day); DayWithDateDay = DayWeek + " " + DateDay; DateColumn = new ComponentArt.Web.UI.GridColumn(); DateColumn.HeadingText = DayWithDateDay; DateColumn.DefaultSortDirection = GridSortDirection.Ascending; DateColumn.Align = ComponentArt.Web.UI.TextAlign.Center; DateColumn.Width = 75; DateColumn.DataField = "Day" + i; GTS.Clock.Model.Concepts.Calendar calendar = calendarlist.Where(x => x.Date == DateDay).FirstOrDefault(); if (calendar != null) { DateColumn.HeadingTextCssClass = "HeadingTextRed"; } else { DateColumn.HeadingTextCssClass = "HeadingText"; } this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.Levels[0].Columns.Add(DateColumn); } DateColumn = new ComponentArt.Web.UI.GridColumn(); DateColumn.AllowSorting = InheritBool.False; DateColumn.DataCellClientTemplateId = "EditTemplate"; DateColumn.EditControlType = GridColumnEditControlType.EditCommand; DateColumn.Width = 50; DateColumn.Align = ComponentArt.Web.UI.TextAlign.Center; this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.Levels[0].Columns.Add(DateColumn); break; } }