Пример #1
0
 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;
 }
Пример #2
0
 private void FindMismatch(TestDocument b)
 {
     if (this.document.DocN != b.document.DocN)
         Global.errors3.Add("Несовпадение DocN TestDocument");
     if (this.document.DocS != b.document.DocS)
         Global.errors3.Add("Несовпадение DocS TestDocument");
     if (this.document.ExpiredDate != b.document.ExpiredDate)
         Global.errors3.Add("Несовпадение ExpiredDate TestDocument");
     if (this.document.IssuedDate != b.document.IssuedDate)
         Global.errors3.Add("Несовпадение IssuedDate TestDocument");
     if (this.document.ProviderName != b.document.ProviderName)
         Global.errors3.Add("Несовпадение ProviderName TestDocument");
     if (Global.GetLength(this.documentType) != Global.GetLength(b.documentType))
         Global.errors3.Add("Несовпадение длинны documentType TestDocument");
     if (Global.GetLength(this.provider) != Global.GetLength(b.provider))
         Global.errors3.Add("Несовпадение длинны provider TestDocument");
     if (Global.GetLength(this.regionCode) != Global.GetLength(b.regionCode))
         Global.errors3.Add("Несовпадение длинны regionCode TestDocument");
 }