Example #1
0
        static public TestPerson BuildPersonFromDataBaseData(string personId)
        {
            string mis = GetIDMIS(personId);

            if (personId != null)
            {
                using (SqlConnection connection = Global.GetSqlConnection())
                {
                    string     findPatient = "SELECT TOP(1) * FROM Person WHERE IdPerson = '" + personId + "'";
                    SqlCommand person      = new SqlCommand(findPatient, connection);
                    using (SqlDataReader personFromDataBase = person.ExecuteReader())
                    {
                        PersonWithIdentity p = new PersonWithIdentity();
                        while (personFromDataBase.Read())
                        {
                            if (personFromDataBase["BirthDate"].ToString() != "")
                            {
                                p.Birthdate = Convert.ToDateTime(personFromDataBase["BirthDate"]);
                            }
                            p.Sex = Convert.ToByte(personFromDataBase["IdSex"]);
                        }
                        p.IdPersonMis = mis;
                        TestPerson pers = new TestPerson(p);
                        pers.name      = TestHumanName.BuildHumanNameFromDataBaseData(personId);
                        pers.documents = TestIdentityDocument.BuildDocumentsFromDataBaseData(personId);
                        return(pers);
                    }
                }
            }
            return(null);
        }
Example #2
0
        public override bool Equals(Object obj)
        {
            TestIdentityDocument p = obj as TestIdentityDocument;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.document == p.document)
            {
                return(true);
            }
            if ((this.document == null) || (p.document == null))
            {
                return(false);
            }
            if ((this.document.DocN == p.document.DocN) &&
                (this.document.DocS == p.document.DocS) &&
                (this.document.ExpiredDate == p.document.ExpiredDate) &&
                (this.document.IdDocumentType == p.document.IdDocumentType) &&
                (this.document.IdProvider == p.document.IdProvider) &&
                (this.document.IssuedDate == p.document.IssuedDate) &&
                (this.document.ProviderName == p.document.ProviderName) &&
                (this.document.RegionCode == p.document.RegionCode))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestIdentityDocument");
                return(false);
            }
        }
Example #3
0
 private void FindMismatch(TestIdentityDocument 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.IdDocumentType != b.document.IdDocumentType)
     {
         Global.errors3.Add("Несовпадение IdDocumentType TestDocument");
     }
     if (this.document.IdProvider != b.document.IdProvider)
     {
         Global.errors3.Add("Несовпадение IdProvider 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 (this.document.RegionCode != b.document.RegionCode)
     {
         Global.errors3.Add("Несовпадение RegionCode TestDocument");
     }
 }
Example #4
0
        static public List <TestIdentityDocument> BuildDocumentsFromDataBaseData(string idPerson)
        {
            List <TestIdentityDocument> documents = new List <TestIdentityDocument>();

            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())
                    {
                        // bool a = documentReader.Read();
                        while (documentReader.Read())
                        {
                            IdentityDocument doc = new IdentityDocument();
                            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.ToInt32(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"]);
                            }
                            TestIdentityDocument document = new TestIdentityDocument(doc);
                            documents.Add(document);
                        }
                    }
                }
            }
            if (documents.Count != 0)
            {
                return(documents);
            }
            else
            {
                return(null);
            }
        }
Example #5
0
 public static List<TestIdentityDocument> BuildDocumentsFromDataBaseData(string idPerson)
 {
     List<TestIdentityDocument> documents = new List<TestIdentityDocument>();
     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())
             {
                 // bool a = documentReader.Read();
                 while (documentReader.Read())
                 {
                     IdentityDocument doc = new IdentityDocument();
                     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.ToInt32(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"]);
                     TestIdentityDocument document = new TestIdentityDocument(doc);
                     documents.Add(document);
                 }
             }
         }
     }
     if (documents.Count != 0)
         return documents;
     else
         return null;
 }
Example #6
0
 private void FindMismatch(TestIdentityDocument 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.IdDocumentType != b.document.IdDocumentType)
         Global.errors3.Add("Несовпадение IdDocumentType TestDocument");
     if (this.document.IdProvider != b.document.IdProvider)
         Global.errors3.Add("Несовпадение IdProvider 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 (this.document.RegionCode != b.document.RegionCode)
         Global.errors3.Add("Несовпадение RegionCode TestDocument");
 }