Пример #1
0
        public ActionResult DetailPartial(int Id = 0)
        {
            AlertGroupModel alertGroupModel;

            alertGroupService = new AlertGroupService();

            if (Id == 0)
            {
                alertGroupModel           = alertGroupService.GetNewModel();
                alertGroupModel._FormMode = FormModeEnum.New;
            }
            else
            {
                alertGroupModel = alertGroupService.GetById(Id);
                if (alertGroupModel != null)
                {
                    alertGroupModel._FormMode = FormModeEnum.Edit;
                }
                else
                {
                    throw new Exception("[VALIDATION]-Data not exists");
                }
            }

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }
Пример #2
0
        public ActionResult Add([ModelBinder(typeof(DevExpressEditorsBinder))]  AlertGroupModel alertGroupModel)
        {
            alertGroupModel._UserId = (int)Session["userId"];


            alertGroupService = new AlertGroupService();


            if (ModelState.IsValid)
            {
                alertGroupService.Add(alertGroupModel);
                alertGroupModel = alertGroupService.GetNewModel();
            }
            else
            {
                string message = GetErrorModel();

                throw new Exception(string.Format("[VALIDATION] {0}", message));
            }


            alertGroupModel._FormMode = Models.FormModeEnum.New;

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }
Пример #3
0
        public ActionResult Delete(int Id = 0)
        {
            alertGroupService = new AlertGroupService();

            if (Id != 0)
            {
                alertGroupService = new AlertGroupService();
                alertGroupService.DeleteById((int)Session["userId"], Id);
            }

            AlertGroupModel alertGroupModel = new AlertGroupModel();

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }
        public ActionResult NavLast()
        {
            AlertGroupModel alertGroupModel;

            alertGroupService = new AlertGroupService();

            alertGroupModel = alertGroupService.NavLast();
            if (alertGroupModel != null)
            {
                alertGroupModel._FormMode = FormModeEnum.Edit;
            }

            if (alertGroupModel == null)
            {
                //alertGroupModel = alertGroupService.GetNewModel();
                throw new Exception("[VALIDATION]-Data not exists");
            }

            return(PartialView(VIEW_FORM_PARTIAL, alertGroupModel));
        }