public static GridSetupViewModel FetchGroupAttendanceGridSetup()
        {
            GridSetupViewModel model = new GridSetupViewModel();
            model.colNames = new List<string>();
            model.colNames.Add("Group Name");
            for (int monthCount = -5; monthCount <= 0; monthCount++)
            {
                model.colNames.Add(DateTime.Now.AddMonths(monthCount).ToString("MMM"));
            }

            model.colModel = new List<GridColModel>();
            model.colModel.Add(new GridColModel());
            model.colModel[0].index = "Name";
            model.colModel[0].name = "Name";
            model.colModel[0].align = "left";
            model.colModel[0].search = true;
            model.colModel[0].width = 150;

            for (int col = 1; col <= 6; col++)
            {
                model.colModel.Add(new GridColModel());
                model.colModel[col].index = DateTime.Now.AddMonths(col - 6).ToString("MMM");
                model.colModel[col].name = DateTime.Now.AddMonths(col - 6).ToString("MMM");
                model.colModel[col].align = "center";
                model.colModel[col].search = false;
                model.colModel[col].width = 60;
            }

            return model;
        }
Exemplo n.º 2
0
        public JsonResult FetchGroupAttendanceGridSetup()
        {
            GridSetupViewModel gridSetup = new GridSetupViewModel();
            if (Session[SessionVariable.LoggedOnPerson] != null)
            {
                Person currentPerson = (Person)Session[SessionVariable.LoggedOnPerson];
                if (currentPerson.HasPermission(Permissions.ViewGroupAttendance))
                {
                    gridSetup = GroupDataAccessor.FetchGroupAttendanceGridSetup();
                }
            }

            return Json(gridSetup, JsonRequestBehavior.DenyGet);
        }