Exemple #1
0
        public bool Update(Guid Id, int quantity, DateTime letterDate, string letterNumber)
        {
            var copy = AppContext.OBK_ZBKCopy.FirstOrDefault(o => o.Id == Id);

            if (copy == null)
            {
                return(false);
            }

            copy.CopyQuantity = quantity;
            copy.SendDate     = DateTime.Now;
            copy.EmployeeId   = UserHelper.GetCurrentEmployee().Id;
            copy.StatusId     = CodeConstManager.STATUS_OBK_SEND_ID;
            copy.LetterDate   = letterDate;
            copy.LetterNumber = letterNumber;

            OBK_ZBKCopyStage stage = AppContext.OBK_ZBKCopyStage.FirstOrDefault(o => o.OBK_ZBKCopyId == Id);

            if (stage == null)
            {
                var ref_stage   = AppContext.OBK_Ref_Stage.FirstOrDefault(o => o.Code.Equals(CodeConstManager.STAGE_OBK_COZ.ToString()));
                var stageStatus = AppContext.OBK_Ref_StageStatus.FirstOrDefault(o => o.Code.Equals(OBK_Ref_StageStatus.New));

                stage               = new OBK_ZBKCopyStage();
                stage.Id            = Guid.NewGuid();
                stage.OBK_ZBKCopyId = Id;
                stage.StartDate     = DateTime.Now;
                stage.StageId       = ref_stage.Id;
                stage.StageStatusId = stageStatus.Id;
            }
            else
            {
                var stageStatus = AppContext.OBK_Ref_StageStatus.FirstOrDefault(o => o.Code.Equals(OBK_Ref_StageStatus.InWork));
                stage.StageStatusId = stageStatus.Id;
            }

            var expDocument      = AppContext.OBK_StageExpDocument.FirstOrDefault(o => o.Id == copy.OBK_StageExpDocumentId);
            var text             = "Поступил новый запрос на оформление копий ЗБК по заключению №<" + expDocument.ExpConclusionNumber + ">";
            var declaration      = AppContext.OBK_AssessmentDeclaration.FirstOrDefault(o => o.Id == expDocument.AssessmentDeclarationId);
            var stageCoz         = AppContext.OBK_AssessmentStage.FirstOrDefault(o => o.StageId == CodeConstManager.STAGE_OBK_COZ && o.DeclarationId == declaration.Id);
            var stageExecutorCoz = AppContext.OBK_AssessmentStageExecutors.FirstOrDefault(o => o.AssessmentStageId == stageCoz.Id &&
                                                                                          o.ExecutorType == CodeConstManager.OBK_CONTRACT_STAGE_EXECUTOR_TYPE_ASSIGNING);

            var notification = new NotificationManager().SendNotification(text, ObjectType.OBK_ZBKCopy, copy.Id, stageExecutorCoz.ExecutorId);

            AppContext.OBK_ZBKCopyStage.AddOrUpdate(stage);
            AppContext.SaveChanges();

            return(true);
        }
Exemple #2
0
        public void DublicateStageToOBK(OBK_ZBKCopyStage cozStage)
        {
            var stage       = AppContext.OBK_Ref_Stage.FirstOrDefault(o => CodeConstManager.STAGE_OBK_EXPERTISE_DOC.ToString().Equals(o.Code));
            var stageStatus = AppContext.OBK_Ref_StageStatus.FirstOrDefault(o => EXP_DIC_StageStatus.New.ToString().Equals(o.Code));

            OBK_ZBKCopyStage obk = new OBK_ZBKCopyStage()
            {
                Id               = Guid.NewGuid(),
                StartDate        = DateTime.Now,
                OBK_ZBKCopyId    = cozStage.OBK_ZBKCopyId,
                SendToAccountant = cozStage.SendToAccountant,
                StageId          = stage.Id,
                StageStatusId    = stageStatus.Id
            };

            AppContext.OBK_ZBKCopyStage.Add(obk);
        }
Exemple #3
0
        public string GetStageSign(Guid zbkCopyStageId)
        {
            var stage = AppContext.OBK_ZBKCopyStage.FirstOrDefault(o => o.Id == zbkCopyStageId);

            if (stage == null)
            {
                return(null);
            }

            OBK_ZBKCopyStage zc = new OBK_ZBKCopyStage
            {
                Id            = stage.Id,
                OBK_ZBKCopyId = stage.OBK_ZBKCopyId
            };
            var xmlData = SerializeHelper.SerializeDataContract(zc);

            return(xmlData.Replace("utf-16", "utf-8"));
        }