예제 #1
0
        public override bool Equals(Object obj)
        {
            TestAddress p = obj as TestAddress;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.address == p.address)
            {
                return(true);
            }
            if ((this.address == null) || (p.address == null))
            {
                return(false);
            }
            if ((this.address.StringAddress == p.address.StringAddress) &&
                (Global.IsEqual(this.addressType, p.addressType)))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestAddress");
                return(false);
            }
        }
예제 #2
0
        static public List <TestAddress> BuildAdressesFromDataBaseData(string idPerson)
        {
            List <TestAddress> addresses = new List <TestAddress>();

            using (NpgsqlConnection connection = Global.GetSqlConnection())
            {
                string        findIdAdresses = "SELECT * FROM public.address WHERE id_person = '" + idPerson + "'";
                NpgsqlCommand IdAddresses    = new NpgsqlCommand(findIdAdresses, connection);
                using (NpgsqlDataReader addressesReader = IdAddresses.ExecuteReader())
                {
                    while (addressesReader.Read())
                    {
                        AddressDto address = new AddressDto();
                        if (addressesReader["address"] != DBNull.Value)
                        {
                            address.StringAddress = Convert.ToString(addressesReader["address"]);
                        }
                        TestAddress a = new TestAddress(address);
                        if (addressesReader["id_address_type"] != DBNull.Value)
                        {
                            a.addressType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(addressesReader["id_address_type"]));
                        }
                        addresses.Add(a);
                    }
                }
            }
            return((addresses.Count != 0) ? addresses : null);
        }
예제 #3
0
 private void FindMismatch(TestAddress b)
 {
     if (this.address.StringAddress != b.address.StringAddress)
     {
         Global.errors3.Add("Несовпадение StringAddress TestAddress");
     }
     if (Global.GetLength(this.addressType) != Global.GetLength(b.addressType))
     {
         Global.errors3.Add("Несовпадение длинны addressType TestAddress");
     }
 }
예제 #4
0
        static public TestPatient BuildPatientFromDataBaseData(string idPerson, string MIS)
        {
            TestPatient patient = new TestPatient();

            patient.addreses   = TestAddress.BuildAdressesFromDataBaseData(idPerson);
            patient.contacts   = TestContact.BuildContactsFromDataBaseData(idPerson);
            patient.documents  = TestDocument.BuildDocumentsFromDataBaseData(idPerson);
            patient.jobs       = TestJob.BuildJobFromDataBaseData(idPerson);
            patient.privileges = TestPrivilege.BuildPrivilegeFromDataBaseData(idPerson);
            patient.person     = TestPerson.BuildPersonFromDataBaseData(idPerson, MIS);
            return(patient);
        }
예제 #5
0
 public static List<TestAddress> BuildAdressesFromDataBaseData(string idPerson)
 {
     List<TestAddress> addresses = new List<TestAddress>();
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findIdAdresses = "SELECT * FROM public.address WHERE id_person = '" + idPerson + "'";
         NpgsqlCommand IdAddresses = new NpgsqlCommand(findIdAdresses, connection);
         using (NpgsqlDataReader addressesReader = IdAddresses.ExecuteReader())
         {
             while (addressesReader.Read())
             {
                 AddressDto address = new AddressDto();
                 if (addressesReader["address"] != DBNull.Value)
                     address.StringAddress = Convert.ToString(addressesReader["address"]);
                 TestAddress a = new TestAddress(address);
                 if (addressesReader["id_address_type"] != DBNull.Value)
                     a.addressType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(addressesReader["id_address_type"]));
                 addresses.Add(a);
             }
         }
     }
     return (addresses.Count != 0) ? addresses : null;
 }
예제 #6
0
 private void FindMismatch(TestAddress b)
 {
     if (this.address.StringAddress != b.address.StringAddress)
         Global.errors3.Add("Несовпадение StringAddress TestAddress");
     if (Global.GetLength(this.addressType) != Global.GetLength(b.addressType))
         Global.errors3.Add("Несовпадение длинны addressType TestAddress");
 }