コード例 #1
0
        public ActionResult AddEditSection(SectionListViewModel model)
        {
            FillAllDropdowns();

            string strSuccessMsg = string.Empty;
            string strErrorMsg = string.Empty;

            if (model != null && model.Section != null)
            {
                if (string.IsNullOrEmpty(model.Section.SectionID))
                {
                    strSuccessMsg = SectionRes.MsgAddSuccess;
                    strErrorMsg = SectionRes.MsgAddError;
                }
                else
                {
                    strSuccessMsg = SectionRes.MsgEditSuccess;
                    strErrorMsg = SectionRes.MsgEditError;
                }

                int i = _SectionService.AddEdit(model.Section);

                if (i <= 0)
                {
                    TempData["err"] = strErrorMsg;
                }
                else
                {
                    TempData["msg"] = strSuccessMsg;
                }
            }

            return RedirectToAction("ManageSection", "Section");
        }
コード例 #2
0
        public ActionResult AddEditSection(string pSectionID)
        {
            FillAllDropdowns();

            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            SectionListViewModel model = new SectionListViewModel();
            model.Section = new Section();

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(pSectionID))
                {
                    model.Section.SectionID = pSectionID;
                    model.Section = _SectionService.Get(model.Section);
                }
            }

            return PartialView("_AddEditSection", model);
        }
コード例 #3
0
        public ActionResult ManageSection(SectionListViewModel model)
        {
            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (model.Section == null)
            {
                model.Section = new Section();
            }

            if (!string.IsNullOrEmpty(model.Section.sort))
            {
                model.Section.SortExp = model.Section.sort + " " + model.Section.sortdir;
            }

            if (model.Section.PageSize == 0)
            {
                int PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]);
                model.Section.PageSize = PageSize;
            }

            if (model.Section.PageIndex == 0)
            {
                model.Section.PageIndex = 1;
            }
            model.SectionList = new List<Section>();
            model.Section.TotalCount = 0;

            model.SectionList = _SectionService.GetAll(model.Section).ToList();
            Lookup entity = new Lookup();

            if (model.SectionList != null && model.SectionList.Count > 0)
            {
                int TotalCount = model.SectionList[0].TotalCount;
                model.Section.TotalCount = TotalCount;
            }

            return View(model);
        }
コード例 #4
0
        public ActionResult DeleteSection(string pSectionID)
        {
            if (!string.IsNullOrEmpty(pSectionID))
            {
                SectionListViewModel model = new SectionListViewModel();
                model.Section = new Section();
                model.Section.SectionID = pSectionID;
                int i = _SectionService.Delete(model.Section);

                if (i <= 0)
                    TempData["err"] = SectionRes.MsgDeleteError;
                else
                    TempData["msg"] = SectionRes.MsgDeleteSuccess;
            }

            return RedirectToAction("ManageSection", "Section");
        }