예제 #1
0
        protected bool ValidateModel(BackgroundCheckModel model)
        {
            ValidateFileLength(model.PersonalDataProcessingScanFile, "PersonalDataProcessingScanFile", 0.5);
            ValidateFileLength(model.InfoValidityScanFile, "InfoValidityScanFile", 0.5);
            ValidateFileLength(model.EmploymentFile, "EmploymentFile", 4);
            ValidateFileLength(model.EmploymentFile, "IsValidate", 2);

            if (!model.IsBGDraft)
            {
                if (!model.IsVolga)
                {
                    BackgroundCheckModel mt = EmploymentBl.GetBackgroundCheckModel(model.UserId);
                    if (model.EmploymentFile == null && string.IsNullOrEmpty(mt.EmploymentFileName))
                    {
                        ModelState.AddModelError("IsValidate", "Не выбран файл скана анкеты для загрузки!");
                        ModelState.AddModelError("EmploymentFile", "Не выбран файл скана анкеты для загрузки!");
                    }
                }
                //if (model.PersonalDataProcessingScanFile == null && string.IsNullOrEmpty(mt.PersonalDataProcessingScanAttachmentFilename))
                //{
                //    ModelState.AddModelError("PersonalDataProcessingScanFile", "Не выбран файл скана для загрузки!");
                //}

                //if (model.InfoValidityScanFile == null && string.IsNullOrEmpty(mt.InfoValidityScanAttachmentFilename))
                //{
                //    ModelState.AddModelError("InfoValidityScanFile", "Не выбран файл скана для загрузки!");
                //}

                //if (model.PersonalDataProcessingScanFile != null)
                //{
                //    //model.PersonalDataProcessingScanFile.ContentLength
                //}

                if (!model.IsValidate)
                {
                    ModelState.AddModelError("IsValidate", "Подтвердите правильность предоставленных данных! Подтвердив правильность предоставленных данных, Вы не сможете больше вносить изменения в данную часть анкеты!");
                }
            }
            return ModelState.IsValid;
        }
예제 #2
0
        public ActionResult BackGroundCheckAddComments(BackgroundCheckModel model)
        {
            string error = String.Empty;
            string SPPath = AuthenticationService.CurrentUser.Id.ToString();
            if (!string.IsNullOrEmpty(model.Comment))
            {
                if (!EmploymentBl.SaveComments(model.UserId, (int)EmploymentCommentTypeEnum.BackgroundCheck, model.Comment, out error))
                {
                    model = EmploymentBl.GetBackgroundCheckModel(model);
                    if (Session["BackgroundCheckM" + SPPath] != null)
                        Session.Remove("BackgroundCheckM" + SPPath);
                    if (Session["BackgroundCheckM" + SPPath] == null)
                        Session.Add("BackgroundCheckM" + SPPath, model);

                    ModelState.AddModelError("IsValidate", error);

                    if (Session["BackgroundCheckMS" + SPPath] != null)
                        Session.Remove("BackgroundCheckMS" + SPPath);
                    if (Session["BackgroundCheckMS" + SPPath] == null)
                    {
                        ModelStateDictionary mst = ModelState;
                        Session.Add("BackgroundCheckMS" + SPPath, mst);
                    }
                }
            }
            if ((AuthenticationService.CurrentUser.UserRole & UserRole.PersonnelManager) > 0 || (AuthenticationService.CurrentUser.UserRole & UserRole.Security) > 0)
                return Redirect("PersonnelInfo?id=" + model.UserId + "&IsCandidateInfoAvailable=true&IsBackgroundCheckAvailable=true&IsManagersAvailable=true&IsPersonalManagersAvailable=true&TabIndex=8");
            else
                return model.IsFinal && !EmploymentBl.IsUnlimitedEditAvailable() ? View("BackgroundCheckReadOnly", model) : View(model);
        }
예제 #3
0
        public ActionResult BackgroundCheckReadOnly(BackgroundCheckModel model)
        {
            string error = String.Empty;
            string SPPath = AuthenticationService.CurrentUser.Id.ToString();
            //BackgroundCheckModel model = null;
            //if (model.IsCancelApproveAvailale && AuthenticationService.CurrentUser.UserRole == UserRole.ConsultantOutsourcing)//для консультантов
            //    EmploymentBl.ApproveBackgroundCheck(model, out error);
            //else
            //    EmploymentBl.ApproveBackgroundCheck(model, out error);

            EmploymentBl.ApproveBackgroundCheck(model, out error);

            model = EmploymentBl.GetBackgroundCheckModel(model.UserId);

            ModelState.AddModelError("IsValidate", string.IsNullOrEmpty(error) ? "Кандидат утвержден!" : error);

            if (Session["BackgroundCheckM" + SPPath] != null)
                Session.Remove("BackgroundCheckM" + SPPath);
            if (Session["BackgroundCheckM" + SPPath] == null)
                Session.Add("BackgroundCheckM" + SPPath, model);

            if (Session["BackgroundCheckMS" + SPPath] != null)
                Session.Remove("BackgroundCheckMS" + SPPath);
            if (Session["BackgroundCheckMS" + SPPath] == null)
            {
                ModelStateDictionary mst = ModelState;
                Session.Add("BackgroundCheckMS" + SPPath, mst);
            }

            //return PartialView("BackgroundCheckReadOnly", model);
            return Redirect("PersonnelInfo?id=" + model.UserId + "&IsCandidateInfoAvailable=true&IsBackgroundCheckAvailable=true&IsManagersAvailable=true&IsPersonalManagersAvailable=true&TabIndex=8");
        }
예제 #4
0
        public ActionResult BackgroundCheck(BackgroundCheckModel model, IEnumerable<HttpPostedFileBase> files)
        {
            string error = String.Empty;
            string SPPath = AuthenticationService.CurrentUser.Id.ToString();

            if (model.DeleteAttachmentId == 0)
            {
                if (model.RowID == 0)
                {
                    if (ValidateModel(model))
                    {
                        model.IsDraft = model.IsBGDraft;
                        EmploymentBl.ProcessSaving<BackgroundCheckModel, BackgroundCheck>(model, out error);
                        model = EmploymentBl.GetBackgroundCheckModel(model.UserId);
                        ModelState.AddModelError("IsValidate", string.IsNullOrEmpty(error) ? "Данные сохранены!" : error);
                        //ViewBag.Error = error;
                    }
                    else
                    {   //так как при использования вкладок, страницу приходится перезагружать с потерей данных, то передаем модель с библиотекой ошибок через переменную сессии
                        model = EmploymentBl.GetBackgroundCheckModel(model);
                        if (Session["BackgroundCheckM" + SPPath] != null)
                            Session.Remove("BackgroundCheckM" + SPPath);
                        if (Session["BackgroundCheckM" + SPPath] == null)
                            Session.Add("BackgroundCheckM" + SPPath, model);
                    }

                    if (Session["BackgroundCheckMS" + SPPath] != null)
                        Session.Remove("BackgroundCheckMS" + SPPath);
                    if (Session["BackgroundCheckMS" + SPPath] == null)
                    {
                        ModelStateDictionary mst = ModelState;
                        Session.Add("BackgroundCheckMS" + SPPath, mst);
                    }
                }
                else
                {
                    EmploymentBl.DeleteBackgroundRow(model);
                    model = EmploymentBl.GetBackgroundCheckModel(model.UserId);
                }
            }
            else
            {
                if (AuthenticationService.CurrentUser.UserRole == UserRole.PersonnelManager && !EmploymentBl.IsUnlimitedEditAvailable())
                {
                    ModelState.AddModelError("IsValidate", "У вас нет прав для редактирования данных!");
                    model = EmploymentBl.GetBackgroundCheckModel(model.UserId);
                }
                else
                {
                    DeleteAttacmentModel modelDel = new DeleteAttacmentModel { Id = model.DeleteAttachmentId };
                    EmploymentBl.DeleteAttachment(modelDel);
                    model = EmploymentBl.GetBackgroundCheckModel(model.UserId);
                    ModelState.AddModelError("IsValidate", "Файл удален!");
                }

                if (Session["BackgroundCheckMS" + SPPath] != null)
                    Session.Remove("BackgroundCheckMS" + SPPath);
                if (Session["BackgroundCheckMS" + SPPath] == null)
                {
                    ModelStateDictionary mst = ModelState;
                    Session.Add("BackgroundCheckMS" + SPPath, mst);
                }
            }

            if ((AuthenticationService.CurrentUser.UserRole & UserRole.PersonnelManager) > 0 || (AuthenticationService.CurrentUser.UserRole & UserRole.Security) > 0)
                return Redirect("PersonnelInfo?id=" + model.UserId + "&IsCandidateInfoAvailable=true&IsBackgroundCheckAvailable=true&IsManagersAvailable=true&IsPersonalManagersAvailable=true&TabIndex=8");
            else
                return model.IsFinal && !EmploymentBl.IsUnlimitedEditAvailable() ? View("BackgroundCheckReadOnly", model) : View(model);
        }