public ActionResult SignForm(string preambleId, string xmlAuditForm) { var success = true; var repository = new DrugDeclarationRepository(); var model = repository.GetById(preambleId); new SignDocumentRepository().SaveSignDocument(UserHelper.GetCurrentEmployee().Id, xmlAuditForm, model); if (model.StatusId == CodeConstManager.STATUS_DRAFT_ID) { model.FirstSendDate = DateTime.Now; } model.StatusId = CodeConstManager.STATUS_SEND_ID; model.SendDate = DateTime.Now; model.IsSigned = true; var history = new EXP_DrugDeclarationHistory() { DateCreate = DateTime.Now, DrugDeclarationId = 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 indexWrapping = 1; foreach (var expDrugDosage in model.EXP_DrugDosage) { if (string.IsNullOrEmpty(expDrugDosage.RegNumber)) { expDrugDosage.RegNumber = model.Number + "." + indexWrapping; indexWrapping++; } } repository.SaveOrUpdate(model, UserHelper.GetCurrentEmployee().Id); repository.SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); // Set Status Sended return(Json(new { success }, JsonRequestBehavior.AllowGet)); }
public virtual ActionResult SendNotSign(string modelId) { var repository = new DrugDeclarationRepository(); var model = repository.GetById(modelId); if (model.StatusId == CodeConstManager.STATUS_DRAFT_ID) { model.FirstSendDate = DateTime.Now; } model.StatusId = CodeConstManager.STATUS_SEND_ID; model.SendDate = DateTime.Now; model.IsSigned = false; var history = new EXP_DrugDeclarationHistory() { DateCreate = DateTime.Now, DrugDeclarationId = model.Id, StatusId = CodeConstManager.STATUS_SEND_ID, UserId = UserHelper.GetCurrentEmployee().Id, Note = "Отчет предоставлен без подписи. Дата отправки:" + DateTime.Now }; if (string.IsNullOrEmpty(model.Number)) { model.Number = repository.GetAppNumber(); } var indexWrapping = 1; foreach (var expDrugDosage in model.EXP_DrugDosage) { if (string.IsNullOrEmpty(expDrugDosage.RegNumber)) { expDrugDosage.RegNumber = model.Number + "." + indexWrapping; indexWrapping++; } } repository.SaveOrUpdate(model, UserHelper.GetCurrentEmployee().Id); repository.SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); return(Json(new { isSuccess = true })); }
public ActionResult DocumentReviewConfirm(Guid?id) { var repository = new DrugDeclarationRepository(); if (id == null) { return(Json("Ok!", JsonRequestBehavior.AllowGet)); } var expertise = GetExpertiseStage(id); var model = expertise.EXP_DrugDeclaration; if (model == null) { return(Json("Ok!", JsonRequestBehavior.AllowGet)); } model.StatusId = CodeConstManager.STATUS_EXP_SEND_ID; if (string.IsNullOrEmpty(model.Number)) { model.Number = repository.GetAppNumber(); } repository.Update(model); var history = new EXP_DrugDeclarationHistory() { DateCreate = DateTime.Now, DrugDeclarationId = model.Id, StatusId = model.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, }; new DrugDeclarationRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); var stageRepository = new ExpertiseStageRepository(); string resultDescription; if (!stageRepository.HasStage(model.Id, CodeConstManager.STAGE_PRIMARY)) { stageRepository.ToNextStage(model.Id, null, new[] { CodeConstManager.STAGE_PRIMARY }, out resultDescription); } return(Json("Ok!", JsonRequestBehavior.AllowGet)); }