示例#1
0
        public ActionResult Create(EmployeeGradParam employeeGradParam)
        {
            if (ModelState.IsValid)
            {
                var gradParams = _employeeGradParamService.Get(egps => egps
                                                               .Where(egp => egp.BeginDate == employeeGradParam.BeginDate &&
                                                                      egp.EmployeeGradID == employeeGradParam.EmployeeGradID &&
                                                                      egp.RoleType == employeeGradParam.RoleType
                                                                      ).ToList());
                if (gradParams.Count > 0)
                {
                    ModelState.AddModelError("EmployeeGradID", "Для связки 'Дата начала действия-Грейд-Тип роли' уже существует запись, измените один или несколько параметров.");
                }
                else if (employeeGradParam.EmployeeYearPayrollRatio < 1)
                {
                    ModelState.AddModelError("EmployeeYearPayrollRatio", "% выплат от годовой зп не может быть меньше 1");
                }
            }

            if (ModelState.IsValid)
            {
                _employeeGradParamService.Add(employeeGradParam);

                return(RedirectToAction("Index"));
            }
            ViewBag.EmployeeGrad = new SelectList(_employeeGradService.Get(x => x.ToList()).OrderBy(x => x.ShortName), "ID", "FullName");
            return(View(employeeGradParam));
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeGradParam gradParam = _employeeGradParamService.GetById(id);
            int gradParamID             = gradParam.ID;

            if (gradParam != null)
            {
                _employeeGradParamService.Delete(gradParam.ID);
            }
            // string returnUrl = Url.Action("Index");
            return(RedirectToAction("Index"));
            // return new RedirectResult(returnUrl);
        }
示例#3
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(StatusCode(StatusCodes.Status400BadRequest));
            }
            EmployeeGradParam gradParam = _employeeGradParamService.GetById(id.Value);

            if (gradParam == null)
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }
            ;
            return(View(gradParam));
        }
示例#4
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(StatusCode(StatusCodes.Status400BadRequest));
            }
            EmployeeGradParam gradParam = _employeeGradParamService.GetById(id.Value);

            if (gradParam == null)
            {
                return(StatusCode(StatusCodes.Status404NotFound));
            }
            ;
            ViewBag.EmployeeGrad = new SelectList(_employeeGradService.Get(x => x.ToList()).OrderBy(x => x.ShortName), "ID", "FullName", gradParam.EmployeeGradID);
            return(View(gradParam));
        }