public ActionResult RejectConfirm(Guid?id, string note) { if (id != null) { var assessmentStage = GetAssessmentStage(id); assessmentStage.StageStatusId = new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InReWork).Id; new SafetyAssessmentRepository().SaveStage(assessmentStage); var model = assessmentStage.OBK_AssessmentDeclaration; if (model != null) { model.DesignNote = note; model.DesignDate = DateTime.Now; model.StatusId = CodeConstManager.STATUS_OBK_REJECT_ID; new SafetyAssessmentRepository().Update(model); var history = new OBK_AssessmentDeclarationHistory() { DateCreate = DateTime.Now, AssessmentDeclarationId = model.Id, StatusId = model.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, Note = model.DesignNote }; new SafetyAssessmentRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); new NotificationManager().SendNotificationFromCompany( string.Format("По Вашей заявке №{0} поступили замечания", model.Number), ObjectType.ObkDeclaration, model.Id.ToString(), model.EmployeeId); } new SafetyAssessmentRepository().AddHistory(assessmentStage.DeclarationId, OBK_Ref_StageStatus.InReWork, model.EmployeeId); } return(Json("Ok!", JsonRequestBehavior.AllowGet)); }
public ActionResult RejectConfirm(Guid?id, string note) { if (id != null) { var assessmentStage = GetAssessmentStage(id); assessmentStage.StageStatusId = new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InReWork).Id; new SafetyAssessmentRepository().SaveStage(assessmentStage); var model = assessmentStage.OBK_AssessmentDeclaration; if (model != null) { model.DesignNote = note; model.DesignDate = DateTime.Now; model.StatusId = CodeConstManager.STATUS_OBK_REJECT_ID; new SafetyAssessmentRepository().Update(model); var history = new OBK_AssessmentDeclarationHistory() { DateCreate = DateTime.Now, AssessmentDeclarationId = model.Id, StatusId = model.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, Note = model.DesignNote }; new SafetyAssessmentRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); } } return(Json("Ok!", JsonRequestBehavior.AllowGet)); }
/// <summary> /// подписание /// </summary> /// <param name="preambleId"></param> /// <param name="xmlAuditForm"></param> /// <returns></returns> public ActionResult SignForm(string preambleId, string xmlAuditForm) { var success = true; var repository = new SafetyAssessmentRepository(); var model = repository.GetById(preambleId); new SignDocumentRepository().SaveSignDocument(UserHelper.GetCurrentEmployee().Id, xmlAuditForm, model); if (model.StatusId == CodeConstManager.STATUS_DRAFT_ID) { model.FirstSendDate = DateTime.Now; } var modelStage = new AssessmentStageRepository().GetByDeclarationId(model.Id.ToString(), CodeConstManager.STAGE_OBK_COZ); if (modelStage != null && modelStage.StageStatusId == new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InReWork).Id) { modelStage.StageStatusId = new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InWork).Id; new SafetyAssessmentRepository().SaveStage(modelStage); } model.StatusId = CodeConstManager.STATUS_SEND_ID; model.SendDate = DateTime.Now; model.IsSigned = false; var history = new OBK_AssessmentDeclarationHistory() { DateCreate = DateTime.Now, AssessmentDeclarationId = model.Id, XmlSign = xmlAuditForm, StatusId = CodeConstManager.STATUS_SEND_ID, UserId = UserHelper.GetCurrentEmployee().Id, Note = "Отчет предоставлен. Дата отправки:" + DateTime.Now }; if (string.IsNullOrEmpty(model.Number)) { model.Number = repository.GetAppNumber(); var act = db.OBK_ActReception.FirstOrDefault(o => o.OBK_AssessmentDeclarationId == model.Id); if (act != null) { act.Number = model.Number; db.SaveChanges(); } } repository.SaveOrUpdate(model, UserHelper.GetCurrentEmployee().Id); repository.SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); // new SafetyAssessmentRepository().AddHistory(model.Id, OBK_Ref_StageStatus.New, UserHelper.GetCurrentEmployee().Id); return(Json(new { success }, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult SendNotSign(string modelId) { var repository = new SafetyAssessmentRepository(); var model = repository.GetById(modelId); if (model.StatusId == CodeConstManager.STATUS_DRAFT_ID) { model.FirstSendDate = DateTime.Now; } var modelStage = new AssessmentStageRepository().GetByDeclarationId(modelId, CodeConstManager.STAGE_OBK_COZ); if (modelStage != null && modelStage.StageStatusId == new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InReWork).Id) { var ex = db.OBK_AssessmentStageExecutors.Where(r => r.AssessmentStageId == modelStage.Id && r.ExecutorType == 2).FirstOrDefault(); modelStage.StageStatusId = new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.InWork).Id; new SafetyAssessmentRepository().SaveStage(modelStage); new SafetyAssessmentRepository().AddHistory(model.Id, OBK_Ref_StageStatus.InWork, ex.ExecutorId); } model.StatusId = CodeConstManager.STATUS_SEND_ID; model.SendDate = DateTime.Now; model.IsSigned = false; var history = new OBK_AssessmentDeclarationHistory() { DateCreate = DateTime.Now, AssessmentDeclarationId = model.Id, StatusId = CodeConstManager.STATUS_SEND_ID, UserId = UserHelper.GetCurrentEmployee().Id, Note = "Отчет предоставлен без подписи. Дата отправки:" + DateTime.Now }; if (string.IsNullOrEmpty(model.Number)) { model.Number = repository.GetAppNumber(); var act = db.OBK_ActReception.FirstOrDefault(o => o.OBK_AssessmentDeclarationId == model.Id); if (act != null) { act.Number = model.Number; db.SaveChanges(); } } repository.SaveOrUpdate(model, UserHelper.GetCurrentEmployee().Id); repository.SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); return(Json(new { isSuccess = true })); }
public ActionResult DocumentReviewConfirm(Guid?id) { if (id == null) { return(Json("Ok!", JsonRequestBehavior.AllowGet)); } var expertise = GetAssessmentStage(id); expertise.StageStatusId = new SafetyAssessmentRepository().GetStageStatusByCode(OBK_Ref_StageStatus.OnExpDocument).Id; expertise.FactEndDate = DateTime.Now; new SafetyAssessmentRepository().SaveStage(expertise); var model = expertise.OBK_AssessmentDeclaration; if (model == null) { return(Json("Ok!", JsonRequestBehavior.AllowGet)); } model.StatusId = CodeConstManager.STATUS_OBK_EXP_SEND_ID; new SafetyAssessmentRepository().Update(model); var history = new OBK_AssessmentDeclarationHistory() { DateCreate = DateTime.Now, AssessmentDeclarationId = model.Id, StatusId = model.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, }; new SafetyAssessmentRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); var stageRepository = new AssessmentStageRepository(); string resultDescription; if (!stageRepository.HasStage(model.Id, CodeConstManager.STAGE_OBK_EXPERTISE_DOC)) { stageRepository.ToNextStage(model, null, new int[] { CodeConstManager.STAGE_OBK_EXPERTISE_DOC }, out resultDescription); } return(Json("Ok!", JsonRequestBehavior.AllowGet)); }
/// <summary> /// сохранение отказа /// </summary> /// <param name="stageId"></param> /// <param name="withSave"></param> public void StartRefuseInSafety(Guid stageId, bool withSave) { var stage = AppContext.OBK_AssessmentStage.FirstOrDefault(e => e.Id == stageId); stage.OBK_AssessmentDeclaration.StatusId = CodeConstManager.STATUS_OBK_COZ_REFUSED_ID; stage.FactEndDate = DateTime.Now; stage.StageStatusId = GetStageStatusByCode(OBK_Ref_StageStatus.Completed).Id; var history = new OBK_AssessmentDeclarationHistory { DateCreate = DateTime.Now, AssessmentDeclarationId = stage.DeclarationId, StatusId = stage.OBK_AssessmentDeclaration.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, Note = stage.OBK_AssessmentDeclaration.DesignNote }; new SafetyAssessmentRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); if (withSave) { AppContext.SaveChanges(); } }
/// <summary> /// сохранение истории при отправке в ЦОЗ /// </summary> /// <param name="history"></param> /// <param name="getCurrentUserId"></param> public void SaveHisotry(OBK_AssessmentDeclarationHistory history, Guid?getCurrentUserId) { AppContext.OBK_AssessmentDeclarationHistory.Add(history); AppContext.SaveChanges(); }