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); } }
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); }
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"); } }
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); }
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; }
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"); }