예제 #1
0
        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));
        }
예제 #2
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));
        }