예제 #1
0
        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));
        }
예제 #2
0
        public ActionResult DocumentReviewConfirm(Guid?id)
        {
            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;
            new DrugDeclarationRepository().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));
        }