Exemple #1
0
        public void Execute(ProtectionDocDocument protectionDocDocument)
        {
            var repo = Uow.GetRepository <ProtectionDocDocument>();

            repo.Create(protectionDocDocument);
            Uow.SaveChanges();
        }
Exemple #2
0
        private void CreateProtectionDocRegister(int protectionDocId)
        {
            var protectionDoc = Executor.GetQuery <GetProtectionDocByIdQuery>().Process(q => q.Execute(protectionDocId));
            var bulletinId    = protectionDoc.Bulletins.FirstOrDefault(b => b.IsPublish)?.Bulletin?.Id ?? 0;
            var typeId        = protectionDoc.TypeId;
            /// удаленно (старый док)
            var register = Executor.GetQuery <GetProtectionDocRegisterByBulletinIdAndProtectionDocTypeIdQuery>()
                           .Process(q => q.Execute(bulletinId, typeId));
            //if (register == null)
            //{
            //    var registerCode = DicDocumentTypeCodes.Reestr_006_014_3;
            //    var userInputDto = new UserInputDto
            //    {
            //        Code = registerCode,
            //        Fields = new List<KeyValuePair<string, string>>(),
            //        OwnerId = protectionDocId,
            //        OwnerType = Owner.Type.ProtectionDoc
            //    };
            //    var documentId = Executor.GetHandler<CreateDocumentHandler>().Process(h =>
            //        h.Execute(protectionDocId, Owner.Type.ProtectionDoc, registerCode, DocumentType.Outgoing, userInputDto, bulletinId, typeId));
            //    Executor.GetHandler<GenerateProtectionDocRegisterNumberHandler>().Process<object>(h => h.Execute(documentId));
            //}
            //else
            //{
            var protectionDocDocument = new ProtectionDocDocument
            {
                DocumentId      = register.Id,
                ProtectionDocId = protectionDocId
            };

            Executor.GetCommand <CreateProtectionDocDocumentCommand>()
            .Process(c => c.Execute(protectionDocDocument));
            //}
        }