public ActionResult EndExpertise(Guid stageId) { var repo = new ExpertiseStageRepository(); repo.EndExpertise(stageId); return(Json("OK", JsonRequestBehavior.AllowGet)); }
public ActionResult SendToApplicant(Guid stageId) { var repo = new ExpertiseStageRepository(); var stage = repo.GetStage(stageId); var repository = new DrugDeclarationRepository(); var declaraion = repository.GetById(stage.DeclarationId.ToString()); if (declaraion == null) { return(Json(new { isSuccess = false, })); } declaraion.DesignDate = DateTime.Now; declaraion.StatusId = CodeConstManager.STATUS_EXP_SEND_INSTRUCTION_ID; new DrugDeclarationRepository().Update(declaraion); var history = new EXP_DrugDeclarationHistory() { DateCreate = DateTime.Now, DrugDeclarationId = declaraion.Id, StatusId = declaraion.StatusId, UserId = UserHelper.GetCurrentEmployee().Id, Note = "Инструкция для согласования" }; new DrugDeclarationRepository().SaveHisotry(history, UserHelper.GetCurrentEmployee().Id); var status = new ReadOnlyDictionaryRepository().GetDicStatusById(CodeConstManager.STATUS_EXP_SEND_INSTRUCTION_ID); return(Json(new { isSuccess = true, statusName = status.NameRu })); }
public ActionResult RefuseInExpertise(Guid stageId) { var repo = new ExpertiseStageRepository(); repo.StartRefuseInExpertise(stageId, true); return(Json("OK", JsonRequestBehavior.AllowGet)); }
public ActionResult SetStageResult(Guid stageId, int resultId) { var repository = new ExpertiseStageRepository(); repository.SetStageResult(stageId, resultId); return(Json("OK", JsonRequestBehavior.AllowGet)); }
public ActionResult SendExpertiseDocumentToAgreement(Guid docId, string documentType, Guid?executorId = null, string taskType = null) { taskType = string.IsNullOrEmpty(taskType) ? null : taskType; var db = new ncelsEntities(); var repository = new DrugDeclarationRepository(); var stageRepo = new ExpertiseStageRepository(); var activityManager = new ActivityManager(); switch (documentType) { case Dictionary.ExpAgreedDocType.EXP_DrugFinalDocument: var declarationInfo = db.EXP_ExpertiseStageDosage.FirstOrDefault(e => e.Id == docId); var finalDocExecutorsIds = stageRepo.GetExecutorsByDicStageId(declarationInfo.EXP_ExpertiseStage.StageId, declarationInfo.EXP_ExpertiseStage.EXP_DrugDeclaration.TypeId) .Select(e => e.Id).ToArray(); activityManager.SendToExecution(Dictionary.ExpActivityType.FinalDocAgreement, docId, Dictionary.ExpAgreedDocType.EXP_DrugFinalDocument, taskType ?? Dictionary.ExpTaskType.Agreement, declarationInfo.EXP_DrugDosage.RegNumber, declarationInfo.EXP_DrugDosage.EXP_DrugDeclaration.CreatedDate, finalDocExecutorsIds); var primaryDocStatus = repository.GetPrimaryFinalDocumentStatus(docId); return(Json(primaryDocStatus.Name, JsonRequestBehavior.AllowGet)); case Dictionary.ExpAgreedDocType.Letter: var primaryRepo = new DrugPrimaryRepository(); bool isSigning = taskType == Dictionary.ExpTaskType.Signing; var letter = primaryRepo.GetCorespondence(docId.ToString()); if (isSigning) { var stageSupervisor = stageRepo.GetStageSupervisor(letter.StageId, letter.EXP_DrugDeclaration.TypeId); activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterSigning, docId, Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Signing, letter.NumberLetter, letter.DateCreate, stageSupervisor.Id); return(Json( DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONSIGNING, CodeConstManager.STATUS_ONSIGNING).Name, JsonRequestBehavior.AllowGet)); } else { var letterExecutorsIds = stageRepo.GetExecutorsByDicStageId(letter.StageId, letter.EXP_DrugDeclaration.TypeId).Select(e => e.Id).ToArray(); activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterAgreement, docId, Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Agreement, letter.NumberLetter, letter.DateCreate, letterExecutorsIds); return(Json( DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT, CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet)); } case Dictionary.ExpAgreedDocType.CertificateOfCompletion: var coc = db.EXP_CertificateOfCompletion.FirstOrDefault(e => e.Id == docId); if (coc != null) { var certExecutorsIds = stageRepo.GetExecutorsByDicStageId(coc.DicStageId.Value, coc.EXP_DrugDeclaration.TypeId).Select(e => e.Id).ToArray(); activityManager.SendToExecution(Dictionary.ExpActivityType.CertificateOfComplitionAgreement, docId, Dictionary.ExpAgreedDocType.CertificateOfCompletion, taskType ?? Dictionary.ExpTaskType.Agreement, string.Empty, coc.CreateDate, certExecutorsIds); } return(Json(DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT, CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet)); } return(null); }
public ActionResult SetExecuter(Guid[] stages, Guid[] executors) { var expRepository = new ExpertiseStageRepository(); expRepository.SendToWork(stages, executors); return(Json("OK", JsonRequestBehavior.AllowGet)); }
public override void ProcessComplited(Guid documentId, EXP_Activities activity) { var letter = _context.EXP_DrugCorespondence.FirstOrDefault(e => e.Id == documentId); var declaration = _context.EXP_DrugDeclaration.FirstOrDefault(e => e.Id == letter.DrugDeclarationId); var positiveStatus = DictionaryHelper.GetDicIdByCode(Dictionary.ExpActivityStatus.DicCode, Dictionary.ExpActivityStatus.Executed); if (activity.StatusId == positiveStatus) { letter.StatusId = DictionaryHelper.GetDicIdByCode(CodeConstManager.STATUS_SIGNED, CodeConstManager.STATUS_SIGNED); if (letter.EXP_DIC_CorespondenceSubject.Code == EXP_DIC_CorespondenceSubject.RefuseByPayment) { var stageRepo = new ExpertiseStageRepository(_context); var stage = stageRepo.GetStage(declaration.Id, CodeConstManager.STAGE_PRIMARY); stageRepo.RefuseExpertise(stage.Id, false); } } else { letter.StatusId = DictionaryHelper.GetDicIdByCode(CodeConstManager.STATUS_REJECTED, CodeConstManager.STATUS_REJECTED); if (letter.EXP_DIC_CorespondenceSubject.Code == EXP_DIC_CorespondenceSubject.RefuseByPayment) { declaration.StatusId = CodeConstManager.STATUS_EXP_SEND_ID; } } }
public ActionResult ReturnToStаge(Guid currentStageId, Guid declarationId, List <int> newStages) { ExpertiseStageRepository stageRepository = new ExpertiseStageRepository(); string result; stageRepository.ToBackStage(declarationId, currentStageId, newStages.ToArray(), out result); return(Json(new { IsSussess = true }, JsonRequestBehavior.AllowGet)); }
public ActionResult SendToNextStage(Guid expStageId, int[] nextStageIds, int?stageResultId = null) { var repository = new ExpertiseStageRepository(); if (repository.HasNotFixedRemarks(expStageId)) { return(Json( new { failed = true, msg = "Невозможно передать на следующий этап так как есть не исправленные замечания" }, JsonRequestBehavior.AllowGet)); } string resultDescription; var expertiseStage = repository.GetById(expStageId); var dec = repository.GetDeclarationByStage(expStageId); if (expertiseStage.EXP_DIC_Stage.Code == CodeConstManager.STAGE_SAFETYREPORT.ToString()) { var rDictionary = new ReadOnlyDictionaryRepository(); EXP_DIC_StageResult stageResult = null; if (stageResultId.HasValue) { stageResult = rDictionary.GetStageResultById(stageResultId.Value); } if (stageResult != null && stageResult.Code == EXP_DIC_StageResult.DoesNotMatchCode) { repository.ToBackStage(dec.Id, expStageId, nextStageIds, out resultDescription); } else { repository.ToNextStage(dec.Id, expStageId, nextStageIds, out resultDescription); } } else { repository.ToNextStage(dec.Id, expStageId, nextStageIds, out resultDescription); } var from = ExpStageNameHelper.GetName(expertiseStage.StageId); var to = ""; foreach (var nextStageId in nextStageIds) { if (!String.IsNullOrEmpty(to)) { to += ", "; } var stageName = ExpStageNameHelper.GetName(nextStageId); to += stageName; } ActionLogger.WriteInt(" Отправка заявления №" + dec.Number + " на другой этап", "from: " + from + "; to:" + to); return(Json("OK", JsonRequestBehavior.AllowGet)); }
protected virtual EXP_ExpertiseStage GetExpertiseStage(Guid?id) { ExpertiseStageRepository repo = new ExpertiseStageRepository(); var stage = repo.GetById(id); if (stage.EXP_DIC_StageStatus.Code == EXP_DIC_StageStatus.InWork) { repo.SetStageViewved(id.Value); } return(stage); }
public ActionResult AnaliticPageView(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var expertiseStage = new ExpertiseStageRepository().GetById(id); if (expertiseStage == null) { return(HttpNotFound()); } var repository = new ReadOnlyDictionaryRepository(); var employee = UserHelper.GetCurrentEmployee(); var model = new DrugAnaliticEntity { EXP_DrugDeclaration = expertiseStage.EXP_DrugDeclaration, DrugDeclarationId = expertiseStage.DeclarationId.ToString(), Applicant = new EmployeesRepository().GetById(expertiseStage.EXP_DrugDeclaration.OwnerId), Editor = employee, ExpExpertiseStageRemarks = new List <EXP_ExpertiseStageRemark>(), ExpStageId = expertiseStage.Id, CurrentStage = new StageModel() { CurrentStage = GetExpertiseStage(expertiseStage.Id), StageResults = repository.GetStageResultsByStage(expertiseStage.StageId) } }; var employeName = ""; if (UserHelper.GetCurrentEmployee() != null) { employeName = UserHelper.GetCurrentEmployee().DisplayName; } ViewBag.CurrentEmployeeName = employeName; var markList = new DrugDeclarationRepository().GetPrimaryMarkList(expertiseStage.DeclarationId, CodeConstManager.STAGE_ANALITIC); var remarkTypes = repository.GetRemarkTypes().ToArray(); ViewData["RemarkTypes" + model.DrugDeclarationId] = new SelectList(remarkTypes, "Id", "NameRu", null); foreach (var expDrugPrimaryRemark in markList) { model.ExpExpertiseStageRemarks.Add(expDrugPrimaryRemark); } foreach (var expDrugPrimaryRemark in model.ExpExpertiseStageRemarks) { ViewData["RemarkTypes" + model.DrugDeclarationId + "_" + expDrugPrimaryRemark.Id] = new SelectList(remarkTypes, "Id", "NameRu", expDrugPrimaryRemark.RemarkTypeId); } model.ExpDrugCorespondences = new DrugDeclarationRepository().GetDrugCorespondences(expertiseStage.DeclarationId); return(PartialView(model)); }
public ActionResult SendToNextStage(Guid expStageId, int dicStageId, int stageResultId) { var repo = new ExpertiseStageRepository(); var stage = repo.GetStage(expStageId); ViewBag.ExpStageId = expStageId; ViewBag.DicStageId = dicStageId; ViewBag.StageResultId = stageResultId; ViewBag.RegType = stage.EXP_DrugDeclaration.TypeId; return(PartialView(Guid.NewGuid())); }
public virtual ActionResult Index() { var dicStageId = GetStage(); var repo = new ExpertiseStageRepository(); var userId = UserHelper.GetCurrentEmployee().Id; var model = new ExpertiseEntity { Guid = Guid.NewGuid(), DicStageId = GetStage(), NewInQueueCount = repo.GetCountByStage(true, dicStageId, EXP_DIC_StageStatus.New, userId), InWorkCount = repo.GetCountByStage(false, dicStageId, EXP_DIC_StageStatus.InWork, userId), NewInWorkCount = repo.GetCountByStage(true, dicStageId, EXP_DIC_StageStatus.InWork, userId) }; return(PartialView("~/Views/DrugDeclaration/Index.cshtml", model)); }
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)); }
public Object DeclarationStepsNew(string id) { try { var id2 = Guid.Parse(id); ViewBag.DeclarationId = id; var steps = new List <DeclarationStepsModel>(); int priorityInList = 0; using (var db = new ncelsEntities()) { var currentEmployeeGuid = UserHelper.GetCurrentEmployee().Id; var stages = db.EXP_ExpertiseStage.Where(x => x.DeclarationId == id2); var expStageRep = new ExpertiseStageRepository(); foreach (var item in stages.OrderBy(x => x.EXP_DIC_Stage.Code)) { var isEndedStage = item.FactEndDate.HasValue; var dbStatus = item.EXP_DIC_StageStatus; var statusCode = dbStatus.Code; var statucCorrectText = GetCostilStatusByStageCode(statusCode); //kostil dlya nachalnikov var executeLeader = expStageRep.GetExecutorByDicStageId(item.StageId); var currentStageCode = item.EXP_DIC_Stage.Code; var leaderStep = new DeclarationStepsModel(); leaderStep.ExecutorShortName = executeLeader.ShortName; leaderStep.StepName = item.EXP_DIC_Stage.NameRu; leaderStep.IsLeaderStep = true; leaderStep.Status = statucCorrectText; leaderStep.StageCode = currentStageCode; leaderStep.NeedWorkers = (statusCode == "inQueue"); leaderStep.PriorityInList = priorityInList; priorityInList++; leaderStep.DateStart = item.StartDate.HasValue ? item.StartDate.Value.ToShortDateString() : ""; steps.Add(leaderStep); if (currentStageCode != EXP_DIC_Stage.ProcCenter) { var step = new DeclarationStepsModel(); step.Id = item.Id; step.AllowAddWorkers = (currentEmployeeGuid == executeLeader.Id); step.StageId = item.StageId; step.StepName = item.EXP_DIC_Stage.NameRu; step.NeedWorkers = (statusCode == "inQueue"); step.StageCode = currentStageCode; step.PriorityInList = priorityInList; priorityInList++; step.Status = statucCorrectText; step.ExecutorShortName = item.Executors.Select(x => x.ShortName) .Aggregate((i, j) => i + Environment.NewLine + j); if (item.StartDate != null && item.EndDate != null) { var dayDiff = (item.EndDate.Value - item.StartDate.Value).TotalDays; step.DueToAllDays = (int)dayDiff; step.DateStart = item.StartDate.Value.ToShortDateString(); if (isEndedStage) { step.DateEnd = item.FactEndDate.Value.ToShortDateString(); } step.ControlDate = item.EndDate.Value.ToShortDateString(); var daysLeave = (item.EndDate.Value - DateTime.Now.Date).TotalDays; step.DueToEndDays = (int)daysLeave; step.StepIsEnded = isEndedStage; int?totalDaysOverdue = null; if (isEndedStage) { totalDaysOverdue = (int)(item.FactEndDate.Value - item.EndDate.Value).TotalDays; } else { totalDaysOverdue = (int)(DateTime.Now.Date - item.EndDate.Value).TotalDays; } var isOverdue = isEndedStage && totalDaysOverdue > 0; step.StepIsOverdue = isOverdue; step.OverdueDays = totalDaysOverdue; } steps.Add(step); } } } var model = new DeclarationStepsViewModel(); model.Steps = steps.OrderBy(x => x.PriorityInList).ToList(); model.DeclarationId = id2; var views = RenderRazorViewToString(View("DeclarationStepsNew").ViewName, model, ViewData, TempData, ControllerContext); return(views); } catch (Exception ex) { LogHelper.Log.Error("DeclarationSteps ex:" + ex.Message + " \r\nstack:" + ex.StackTrace); throw; } }
// GET: DrugStageHistory public ActionResult HistoryStageView(Guid id) { var list = new ExpertiseStageRepository().GetExpExpertiseStagesByDeclarationId(id); return(PartialView("~/Views/DrugDeclaration/DrugStageHistory/HistoryStageView.cshtml", list.Where(e => e.StageId != 7).ToList())); }