コード例 #1
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/EMKT
 public TestDocument(DocumentDto d)
 {
     document = d;
     document.DocN = document.DocN.Replace("-", "");
     if (document.IssuedDate == DateTime.MinValue)
         document.IssuedDate = null;
 }
コード例 #2
0
ファイル: OldSetStatus.cs プロジェクト: nbIxMaN/MQTESTS
 //Задаём статус "Согласовано в направляющей МО"
 //с использованием минимального метода UpdateFromSourcedMo
 //document = либо DocumentData.SingleOMS, либо DocumentData.OldOMS
 public Referral SetStatus_AgreedInSourcedMO(string idMq, DocumentDto document)
 {
     Referral referral = (new SetData()).MinUpdateFromSourcedMo(idMq);
     referral.Patient = new Patient
     {
         Documents = new DocumentDto[]
         {
             new DocumentDto
             {
                 ProviderName = document.ProviderName,
                 DocumentType = document.DocumentType
             }
         }
     };
     referral.Source = new ReferralSource
     {
         Doctors = new Doctor[]
         {
             new Doctor { Role = new Coding { Code = "2", System = Dictionary.DOCTOR_ROLE, Version = "1" } }
         }
     };
     referral.EventsInfo = new EventsInfo
     {
         Source = new EventSource
         {
             ReferralReviewDate = ReferralData.eventsInfo.Source.ReferralReviewDate,
             IsReferralReviewed = true,
             // ReferralCreatedate обязательный при указании Source
             ReferralCreateDate = ReferralData.eventsInfo.Source.ReferralCreateDate
         }
     };
     return referral;
 }
コード例 #3
0
        public void When_Document_Is_requested_Then_Should_Call_Correct_Methods()
        {
            // Given
            var metadata = new DocumentDto()
            {
                Extension = "txt",
                Filename = "Test"
            };

            Stream stream = new MemoryStream();

            var file = new GetStreamedDocumentByIdResponse()
            {
                MetaData = metadata,
                Content = stream
            };

            _streamingDocLibraryService
                .Setup(x => x.GetStreamedDocumentById(It.IsAny<GetStreamedDocumentByIdRequest>()))
                .Returns(file);

            // When
            _target.DownloadDocument(_encryptedDocId1);

            // Then
            _streamingDocLibraryService.VerifyAll();
            _documentService.Verify(x => x.ValidateDocumentForCompany(It.IsAny<long>(), It.IsAny<long>()));
        }
コード例 #4
0
ファイル: OldSetStatus.cs プロジェクト: nbIxMaN/MQTESTS
        //document = либо DocumentData.SingleOMS, либо DocumentData.OldOMS
        public Referral SetStatus_HealthCareStart(string idMq, DocumentDto document)
        {
            Referral referral = (new SetData()).MinUpdateFromTargetMO(idMq);
            referral.Patient = new Patient
            {
                Documents = new DocumentDto[]
                {
                    new DocumentDto
                    {
                        ProviderName = document.ProviderName,
                        DocumentType = document.DocumentType
                    }
                }
            };
            referral.EventsInfo = new EventsInfo
            {
                Target = new EventTarget
                {
                    CaseOpenDate = ReferralData.eventsInfo.Target.CaseOpenDate,
                    CaseAidForm = ReferralData.eventsInfo.Target.CaseAidForm,
                    CaseAidPlace = ReferralData.eventsInfo.Target.CaseAidPlace,
                    CaseAidType = ReferralData.eventsInfo.Target.CaseAidType
                }
            };

            return referral;
        }
コード例 #5
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/MQTESTS
 public TestDocument(DocumentDto d)
 {
     document = d;
     documentType = new TestCoding(document.DocumentType);
     provider = new TestCoding(document.Provider);
     regionCode = new TestCoding(document.RegionCode);
 }
コード例 #6
0
ファイル: FuncForGet.cs プロジェクト: knastya/Pix
 public DocumentDto Set_DocumentForSearch(DocumentDto document)
 {
     DocumentDto doc = new DocumentDto()
          {
              IdDocumentType = document.IdDocumentType,
              DocN = document.DocN,
              DocS = document.DocS,
          };
     return doc;
 }
コード例 #7
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/MQTESTS
 public TestDocument(DocumentDto d)
 {
     document = d;
     if (document.DocumentType != null)
         documentType = new TestCoding(document.DocumentType);
     if (document.Provider != null)
         provider = new TestCoding(document.Provider);
     if (document.RegionCode != null)
         regionCode = new TestCoding(document.RegionCode);
 }
コード例 #8
0
ファイル: FuncForGet.cs プロジェクト: knastya/Pix
        private List<string> CompareDocument(DocumentDto docIdealPatient, DocumentDto[] docPatientForCompare)
        {
            var errorList = new List<string>();
            bool docMatch = false;
            foreach (DocumentDto doc in docPatientForCompare)
            {
                //  Если найдена такая пара => нужный документ
                if (docIdealPatient.IdDocumentType == doc.IdDocumentType && docIdealPatient.DocN == doc.DocN)
                {
                    docMatch = true;
                    if (docIdealPatient.DocS != null && docIdealPatient.DocS != doc.DocS)
                        errorList.Add("DocS не совпадает");
                }
            }
            if (!docMatch)
                errorList.Add("Документ не найден");

            return errorList;
        }
コード例 #9
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/MQTESTS
 public static List<TestDocument> BuildDocumentsFromDataBaseData(string idPerson)
 {
     List<TestDocument> documents = new List<TestDocument>();
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findDocument = "SELECT * FROM public.documents WHERE id_person = '" + idPerson + "'";
         NpgsqlCommand person = new NpgsqlCommand(findDocument, connection);
         using (NpgsqlDataReader documentReader = person.ExecuteReader())
         {
             while (documentReader.Read())
             {
                 //Что делать с DateSpecified?
                 DocumentDto doc = new DocumentDto();
                 if (documentReader["docn"] != DBNull.Value)
                     doc.DocN = Convert.ToString(documentReader["docn"]);
                 if (documentReader["docs"] != DBNull.Value)
                     doc.DocS = Convert.ToString(documentReader["docs"]);
                 if (documentReader["expired_date"]!= DBNull.Value)
                     doc.ExpiredDate = Convert.ToDateTime(documentReader["expired_date"]);
                 if (documentReader["issued_date"] != DBNull.Value)
                     doc.IssuedDate = Convert.ToDateTime(documentReader["issued_date"]);
                 if (documentReader["provider_name"] != DBNull.Value)
                     doc.ProviderName = Convert.ToString(documentReader["provider_name"]);
                 TestDocument document = new TestDocument(doc);
                 if (documentReader["id_document_type"] != DBNull.Value)
                     document.documentType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(documentReader["id_document_type"]));
                 if (documentReader["id_provider"] != DBNull.Value)
                     document.provider = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(documentReader["id_provider"]));
                 if (documentReader["id_region_code"] != DBNull.Value)
                     document.regionCode = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(documentReader["id_region_code"]));
                 documents.Add(document);
             }
         }
     }
     return (documents.Count != 0) ? documents : null;
 }
コード例 #10
0
        public void When_Document_Is_Requested_Then_FileBytes_Is_Populated()
        {
            // Given
            var metadata = new DocumentDto()
            {
                Extension = "txt",
                Filename = "Test"
            };
            Stream stream = new MemoryStream();
            var file = new GetStreamedDocumentByIdResponse()
            {
                MetaData = metadata,
                Content = stream
            };
            _streamingDocLibraryService
                .Setup(x => x.GetStreamedDocumentById(It.IsAny<GetStreamedDocumentByIdRequest>()))
                .Returns(file);

            // When
            var result = _target.DownloadDocument(_encryptedDocId1);

            // Then
            Assert.That(result.FileStream, Is.Not.Null);
        }
コード例 #11
0
        private static DocumentDto DocumentToDto(Document document)
        {
            if (document == null)
                return null;
            var documentDto = new DocumentDto
            {
                Name = document.Name,
                Id = document.Id
            };

            var fieldsCollection = new Collection<DynamicFieldDto>();
            foreach (var field in document.Fields)
            {
                var dFieldDto = new DynamicFieldDto
                {
                    Configuration = new DynamicFieldTemplateDto()
                    {
                        Code = field.Configuration.Code,
                        Id = field.Configuration.Id,
                        IsEnabled = field.Configuration.IsEnabled,
                        Label = field.Configuration.Label,
                        Length = field.Configuration.Length,
                        Type = field.Configuration.Type,
                        Weight = field.Configuration.Weight,
                    },
                    Id = field.Id
                };
                dFieldDto.SetValue(field.GetValue());

                fieldsCollection.Add(dFieldDto);
            }

            documentDto.Fields = fieldsCollection;
            return documentDto;
        }
コード例 #12
0
 public Task <DocumentDto> DocumentManagementGet(DocumentDto requestDto)
 {
     throw new System.NotImplementedException();
 }
コード例 #13
0
        public bool TryGetDocument(string projectId, string branchName, string fileUri, out DocumentDto documentDto)
        {
            var cacheKey = GetDocumentCacheKey(projectId, branchName, fileUri);

            return(_memoryCache.TryGetValue(cacheKey, out documentDto));
        }
        public async Task UpdateDocumentAsync(string projectId, string branchName, string fileUri, DocumentDto document)
        {
            await _commonValidator.ProjectHaveToExists(projectId);

            await _commonValidator.BranchHaveToExists(projectId, branchName);

            await _commonValidator.DocumentHaveToExists(projectId, branchName, fileUri);

            await _fileSystemService.WriteBinaryAsync(projectId, branchName, fileUri, document.Content);
        }
コード例 #15
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/EMKT
        static public List <TestDocument> BuildDocumentsFromDataBaseData(string idPerson)
        {
            List <TestDocument> documents = new List <TestDocument>();

            using (SqlConnection connection = Global.GetSqlConnection())
            {
                foreach (int i in Enum.GetValues(typeof(docs)))
                {
                    string     findPatient = "SELECT TOP(1) * FROM Document WHERE IdDocument = (SELECT MAX(IdDocument) FROM Document WHERE IdPerson = '" + idPerson + "' AND IdDocumentType = '" + i + "')";
                    SqlCommand person      = new SqlCommand(findPatient, connection);
                    using (SqlDataReader documentReader = person.ExecuteReader())
                    {
                        while (documentReader.Read())
                        {
                            DocumentDto doc = new DocumentDto();
                            if (documentReader["DocN"].ToString() != "")
                            {
                                doc.DocN = Convert.ToString(documentReader["DocN"]);
                            }
                            if (documentReader["ProviderName"].ToString() != "")
                            {
                                doc.ProviderName = Convert.ToString(documentReader["ProviderName"]);
                            }
                            if (documentReader["IdDocumentType"].ToString() != "")
                            {
                                doc.IdDocumentType = Convert.ToByte(documentReader["IdDocumentType"]);
                            }
                            if (documentReader["DocS"].ToString() != "")
                            {
                                doc.DocS = Convert.ToString(documentReader["DocS"]);
                            }
                            if (documentReader["IdProvider"].ToString() != "")
                            {
                                doc.IdProvider = Convert.ToString(documentReader["IdProvider"]);
                            }
                            if (documentReader["IssuedDate"].ToString() != "")
                            {
                                doc.IssuedDate = Convert.ToDateTime(documentReader["IssuedDate"]);
                            }
                            if (documentReader["ExpiredDate"].ToString() != "")
                            {
                                doc.ExpiredDate = Convert.ToDateTime(documentReader["ExpiredDate"]);
                            }
                            if (documentReader["RegionCode"].ToString() != "")
                            {
                                doc.RegionCode = Convert.ToString(documentReader["RegionCode"]);
                            }
                            TestDocument document = new TestDocument(doc);
                            documents.Add(document);
                        }
                    }
                }
            }
            if (documents.Count != 0)
            {
                return(documents);
            }
            else
            {
                return(null);
            }
        }
コード例 #16
0
        public async Task <object> PostDocumentData([FromBody] DocumentDto documentDto, string guid)
        {
            var isGuidValid = await guidService.ValidateString(guid);

            if (!isGuidValid)
            {
                var res = Json(new
                {
                    error  = "Guid is not exist",
                    result = default(string)
                })
                          .Value;
                return(NotFound(res));
            }

            var guidStamp = await guidService.GetGuidStamp(guid);

            var waves = guidStamp.WavesData;

            var owner = await userDataRepository.ReadAsync(waves.MyNickname);

            var partner = await userDataRepository.ReadAsync(waves.PartnerNickname);

            var ownerData = new DocumentData
            {
                Identifier = owner.Identifier,
                DocumentId = documentDto.DocumentId,
            };

            var partnerData = new DocumentData
            {
                Identifier = partner.Identifier,
                DocumentId = documentDto.DocumentId,
            };

            await documentDataRepository.CreateAsync(ownerData);

            await documentDataRepository.CreateAsync(partnerData);

            var urlGuid = await guidService.GenerateString(partner.Identifier, partner.NickName);

            var inlineMenu = new InlineMenu
            {
                Text     = "Подпишите транзакцию",
                Keyboard =
                    new InlineKeyboardMarkup(new[]
                {
                    new[]
                    {
                        new InlineKeyboardButton
                        {
                            Text         = "Подписать",
                            CallbackData = CallBack.RootPage.ToString(),
                            Url          = $"{configuration.BlockChainAddress}/sign/?create={urlGuid}"
                        }
                    }
                })
            };


            await botService.Client.SendTextMessageAsync(partner.Identifier, inlineMenu.Text, ParseMode.Markdown,
                                                         replyMarkup : inlineMenu.Keyboard);

            await BotClient.SendTextMessageAsync(partner.Identifier,
                                                 $"Документ отправлен {partner.NickName} на подпись");

            return(Json(new
            {
                error = default(string),
                result = "success"
            }));
        }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public DocumentDefinition(DocumentDto dto, IContentTypeComposition composition)
 {
     DocumentDto       = dto;
     ContentVersionDto = dto.ContentVersionDto;
     Composition       = composition;
 }
コード例 #18
0
        public void DocumentDtoEqualsReturnsCorrectValues()
        {
            DocumentDto d1 = new DocumentDto
            {
                Id               = 1,
                AitId            = 987456,
                Title            = "Document 1",
                ShortDescription = "This is a test document.",

                ProductVersionId  = 1,
                DocumentAuthorIds = new List <int> {
                    1, 2
                },
                DocumentCatalogIds = new List <int> {
                    1, 2
                },
                DocumentTypeId = 1,

                HtmlLink  = "document1/html/index.htm",
                PdfLink   = "document1/pdf/document1.pdf",
                WordLink  = "document1/word/document1.doc",
                OtherLink = null,

                IsFitForClients     = true,
                IsPublished         = true,
                LatestTopicsUpdated = "This is the first version of the document."
            };

            DocumentDto d2 = new DocumentDto
            {
                Id               = 1,
                AitId            = 987456,
                Title            = "Document 1",
                ShortDescription = "This is a test document.",

                ProductVersionId  = 1,
                DocumentAuthorIds = new List <int> {
                    1, 2
                },
                DocumentCatalogIds = new List <int> {
                    1, 2
                },
                DocumentTypeId = 1,

                HtmlLink  = "document1/html/index.htm",
                PdfLink   = "document1/pdf/document1.pdf",
                WordLink  = "document1/word/document1.doc",
                OtherLink = null,

                IsFitForClients     = true,
                IsPublished         = true,
                LatestTopicsUpdated = "This is the first version of the document."
            };

            DocumentDto d3 = new DocumentDto
            {
                Id               = 2,
                AitId            = 987457,
                Title            = "Document 2",
                ShortDescription = "This is a second test document.",

                ProductVersionId  = 2,
                DocumentAuthorIds = new List <int> {
                    2
                },
                DocumentCatalogIds = new List <int> {
                    1
                },
                DocumentTypeId = 2,

                HtmlLink  = "document2/html/index.htm",
                PdfLink   = "document2/pdf/document2.pdf",
                WordLink  = "document2/word/document2.doc",
                OtherLink = null,

                IsFitForClients     = false,
                IsPublished         = false,
                LatestTopicsUpdated = "This is the first version of the document."
            };
            DocumentDto d4 = new DocumentDto
            {
                Id = 1
            };

            Assert.True(d1.Equals(d2));
            Assert.True(d1.Equals(d2, true));
            Assert.False(d1.Equals(d3));
            Assert.False(d1.Equals(d3, true));
            Assert.True(d1.Equals(d4));
            Assert.False(d1.Equals(d4, true));
        }
コード例 #19
0
 public Task <DocumentResponseDto> DocumentManagementDelete(DocumentDto requestDto)
 {
     throw new System.NotImplementedException();
 }
コード例 #20
0
        public async Task <IActionResult> Post([FromBody] DocumentDto document)
        {
            var etag = await _azureRepo.SaveDocToAzure(document);

            return(Ok(etag));
        }
コード例 #21
0
        public async System.Threading.Tasks.Task <UploadResultOutput> SaveAsync()
        {
            UploadResultOutput output = new UploadResultOutput();

            output.Files = new List <DocumentDto>();

            HttpContext         hcx = this._httpContext.HttpContext;
            IFormFileCollection ffc = hcx.Request.Form.Files;

            var method     = this._httpContext.HttpContext.Request.Method;
            var filesCount = ffc.Count;
            var success    = false;

            for (int i = 0; i < filesCount; i++)
            {
                DocumentDto doc  = new DocumentDto();
                var         file = ffc[i];

                doc.FileId      = IdFactory.NewId();
                doc.OrginalName = file.FileName;
                doc.FileName    = System.IO.Path.GetFileNameWithoutExtension(file.FileName);
                doc.Extension   = System.IO.Path.GetExtension(file.FileName).Trim('.');
                doc.ContentType = file.ContentType;
                doc.Size        = file.Length;

                // Save file to local storage.
                // TODO: Add code to save file.

                // Software design:
                // 00100: Get default storage root path
                // 00200: Create folder for save file
                // 00300: Save file
                // 00400: Update database for saving file detail information

                // 00100: Get default storage root path
                string defaultRootFolder = GetTendentDefaultFileFolderPath(); // The file will be saved in this folder.

                string fileName =
                    doc.FileId + separator +        // File ID
                    doc.Extension + separator +     // File Extension Name
                    doc.OrginalName;                // File Name

                string filePath = defaultRootFolder.TrimEnd('/') + "/" + fileName;

                doc.FilePath = filePath;

                try
                {
                    // Create folder
                    if (false == Directory.Exists(defaultRootFolder))
                    {
                        Directory.CreateDirectory(defaultRootFolder);
                    }

                    // 00300 Save to hard disk
                    using (var stream = new FileStream(filePath, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);
                    }

                    // 00400 Save to database

                    // If save file success, set result as success = true.
                    doc.Success = true;
                    doc.Message = "Upload success";
                    doc.Error   = null;
                }
                catch (Exception exc)
                {
                    doc.Success = false;
                    doc.Message = "Upload failed";
                    doc.Error   = exc.ToString();
                }

                output.Files.Add(doc);
            }

            output.FileCount = filesCount;
            output.Success   = success;

            return(output);
        }
コード例 #22
0
 public static Document ToEmptyDocumentWithId(this DocumentDto documentDto)
 {
     return(new Document(documentDto.Id));
 }
コード例 #23
0
ファイル: DocumentsController.cs プロジェクト: v1996-96/kms
        public async Task <IActionResult> Update([FromRoute] int?id, [FromRoute] string slug, [FromBody] DocumentDto updatedDocument)
        {
            if (updatedDocument == null)
            {
                return(BadRequest());
            }

            var document = await GetDocument(id, slug);

            if (document == null)
            {
                return(NotFound());
            }

            if (document.Title != updatedDocument.Title)
            {
                int    attemptsCount    = 0;
                int    maxAttemptsCount = 100;
                string newSlug;
                bool   isSlugUnique = false;

                do
                {
                    newSlug      = updatedDocument.Title.GenerateSlug();
                    isSlugUnique = (await _db.Documents.SingleOrDefaultAsync(d => d.Slug == newSlug)) == null;
                } while (!isSlugUnique && attemptsCount < maxAttemptsCount);

                if (!isSlugUnique)
                {
                    return(BadRequest(new { message = "Cannot generate unique slug" }));
                }

                document.Title = updatedDocument.Title;
                document.Slug  = newSlug;
            }

            document.Subtitle         = updatedDocument.Subtitle;
            document.IsDraft          = updatedDocument.IsDraft;
            document.ParentDocumentId = updatedDocument.ParentDocumentId;

            await _db.SaveChangesAsync();

            await this.SaveActivity(document.DocumentId, @"Document modified: " + document.Title, new {
                document_id = document.DocumentId,
                type        = "update"
            });

            return(Ok(await PrepareDocument(document)));
        }
コード例 #24
0
 public async Task <DocumentResponseDto> UpdateDocument(DocumentDto documentDto) =>
 await _facadeDocumentService.DocumentManagementUpdate(documentDto).ConfigureAwait(false);
コード例 #25
0
 public CreateDocument(DocumentDto document) :
     base("api/v1/document/", HttpMethod.Post, new { document })
 {
 }
コード例 #26
0
 public async Task <DocumentDto> GetDocument(DocumentDto areaDto) =>
 await _facadeDocumentService.DocumentManagementGet(areaDto).ConfigureAwait(false);
コード例 #27
0
 public UploadDocumentCommand(DocumentDto documentDto)
 {
     DocumentDto = documentDto;
 }
コード例 #28
0
        public void DocumentDtoProperlyMappedToDocument()
        {
            DocumentDto documentDto = new DocumentDto
            {
                Id               = 1,
                AitId            = 987456,
                Title            = "Document 1",
                ShortDescription = "This is a test document.",

                ProductVersionId  = 1,
                DocumentAuthorIds = new List <int> {
                    1, 2
                },
                DocumentCatalogIds = new List <int> {
                    1, 2
                },
                DocumentTypeId = 1,

                HtmlLink  = "document1/html/index.htm",
                PdfLink   = "document1/pdf/document1.pdf",
                WordLink  = "document1/word/document1.doc",
                OtherLink = null,

                IsFitForClients     = true,
                IsPublished         = true,
                LatestTopicsUpdated = "This is the first version of the document."
            };

            Document document = new Document
            {
                Id               = 1,
                AitId            = 987456,
                Title            = "Document 1",
                ShortDescription = "This is a test document.",

                ProductVersionId = 1,
                DocumentAuthors  = new List <DocumentAuthor>
                {
                    new DocumentAuthor {
                        AuthorId = 1
                    },
                    new DocumentAuthor {
                        AuthorId = 2
                    }
                },
                DocumentCatalogs = new List <DocumentCatalog>
                {
                    new DocumentCatalog {
                        CatalogId = 1
                    },
                    new DocumentCatalog {
                        CatalogId = 2
                    }
                },
                DocumentTypeId = 1,

                HtmlLink  = "document1/html/index.htm",
                PdfLink   = "document1/pdf/document1.pdf",
                WordLink  = "document1/word/document1.doc",
                OtherLink = null,

                IsFitForClients = true,
                Updates         = new List <DocumentUpdate>
                {
                    new DocumentUpdate
                    {
                        IsPublished         = true,
                        LatestTopicsUpdated = "This is the first version of the document."
                    }
                }
            };

            Document document2 = _mapper.Map <Document>(documentDto);

            Assert.NotNull(document2);

            Assert.True(document.Equals(document2));
            Assert.True(document.Equals(document2, true));
        }
コード例 #29
0
ファイル: DocumentAPIShould.cs プロジェクト: RonnyAnc/Papyrus
 private static void ShouldBeADocumentDtoWithNoNullFields(DocumentDto documentDto)
 {
     documentDto.Id.Should().Be(AnyId);
     documentDto.Title.Should().Be(AnyTitle);
     documentDto.Description.Should().Be(AnyDescription);
     documentDto.Content.Should().Be(AnyContent);
     documentDto.Language.Should().Be(AnyLanguage);
 }
コード例 #30
0
 public async Task <DocumentResponseDto> DeleteDocument(DocumentDto areaDto) =>
 await _facadeDocumentService.DocumentManagementDelete(areaDto).ConfigureAwait(false);
コード例 #31
0
ファイル: TestDocument.cs プロジェクト: nbIxMaN/EMKT
 public static List<TestDocument> BuildDocumentsFromDataBaseData(string idPerson)
 {
     List<TestDocument> documents = new List<TestDocument>();
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         foreach (int i in Enum.GetValues(typeof(docs)))
         {
             string findPatient = "SELECT TOP(1) * FROM Document WHERE IdDocument = (SELECT MAX(IdDocument) FROM Document WHERE IdPerson = '" + idPerson + "' AND IdDocumentType = '" + i + "')";
             SqlCommand person = new SqlCommand(findPatient, connection);
             using (SqlDataReader documentReader = person.ExecuteReader())
             {
                 while (documentReader.Read())
                 {
                     DocumentDto doc = new DocumentDto();
                     if (documentReader["DocN"].ToString() != "")
                         doc.DocN = Convert.ToString(documentReader["DocN"]);
                     if (documentReader["ProviderName"].ToString() != "")
                         doc.ProviderName = Convert.ToString(documentReader["ProviderName"]);
                     if (documentReader["IdDocumentType"].ToString() != "")
                         doc.IdDocumentType = Convert.ToByte(documentReader["IdDocumentType"]);
                     if (documentReader["DocS"].ToString() != "")
                         doc.DocS = Convert.ToString(documentReader["DocS"]);
                     if (documentReader["IdProvider"].ToString() != "")
                         doc.IdProvider = Convert.ToString(documentReader["IdProvider"]);
                     if (documentReader["IssuedDate"].ToString() != "")
                         doc.IssuedDate = Convert.ToDateTime(documentReader["IssuedDate"]);
                     if (documentReader["ExpiredDate"].ToString() != "")
                         doc.ExpiredDate = Convert.ToDateTime(documentReader["ExpiredDate"]);
                     if (documentReader["RegionCode"].ToString() != "")
                         doc.RegionCode = Convert.ToString(documentReader["RegionCode"]);
                     TestDocument document = new TestDocument(doc);
                     documents.Add(document);
                 }
             }
         }
     }
     if (documents.Count != 0)
         return documents;
     else
         return null;
 }
コード例 #32
0
ファイル: DocumentAppService.cs プロジェクト: veotani/abptest
 public void PostDocument(DocumentDto documentDto)
 {
     _documentRepository.Insert(_objectMapper.Map <Document>(documentDto));
 }