static public List <TestContact> BuildContactsFromDataBaseData(string idPerson) { List <TestContact> contacts = new List <TestContact>(); using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT * FROM public.Contact WHERE id_person = '" + idPerson + "'"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader contactReader = person.ExecuteReader()) { while (contactReader.Read()) { ContactDto cont = new ContactDto(); if (contactReader["contact_value"] != DBNull.Value) { cont.ContactValue = Convert.ToString(contactReader["contact_value"]); } TestContact contact = new TestContact(cont); if (contactReader["id_contact_type"] != DBNull.Value) { contact.contactType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(contactReader["id_contact_type"])); } contacts.Add(contact); } } } return((contacts.Count != 0) ? contacts : null); }
public override bool Equals(Object obj) { TestContact p = obj as TestContact; if ((object)p == null) { return(false); } if (this.contact == p.contact) { return(true); } if ((this.contact == null) || (p.contact == null)) { return(false); } if ((this.contact.ContactValue == p.contact.ContactValue) && (Global.IsEqual(this.contactType, p.contactType))) { return(true); } else { this.FindMismatch(p); Global.errors3.Add("несовпадение TestContact"); return(false); } }
static public List <TestDoctor> BuildDoctorFromDataBaseData(string idReferral) { List <TestDoctor> docs = new List <TestDoctor>(); using (NpgsqlConnection c = Global.GetSqlConnection()) { string findDoctorsIds = "SELECT * FROM public.referral_doctor WHERE id_referral = '" + idReferral + "'"; NpgsqlCommand fd = new NpgsqlCommand(findDoctorsIds, c); using (NpgsqlDataReader idr = fd.ExecuteReader()) { if (idr["id_doctor"] != DBNull.Value) { string idDoctor = idr["id_doctor"].ToString(); using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findDoctor = "SELECT * FROM public.doctor WHERE id_doctor = '" + idDoctor + "' ORDER BY id_doctor DESC LIMIT 1"; NpgsqlCommand doc = new NpgsqlCommand(findDoctor, connection); using (NpgsqlDataReader doctorFromDataBase = doc.ExecuteReader()) { Doctor p = new Doctor(); while (doctorFromDataBase.Read()) { TestDoctor doctor = new TestDoctor(p); if (doctorFromDataBase["id_doctor_role"] != DBNull.Value) { doctor.role = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_doctor_role"])); } if (doctorFromDataBase["id_doctor_speciality"] != DBNull.Value) { doctor.speciality = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_doctor_speciality"])); } if (doctorFromDataBase["id_lpu"] != DBNull.Value) { doctor.lpu = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_lpu"])); } if (doctorFromDataBase["id_position"] != DBNull.Value) { doctor.position = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(doctorFromDataBase["id_position"])); } if (doctorFromDataBase["id_person"] != DBNull.Value) { doctor.person = TestPerson.BuildPersonFromDataBaseData(Convert.ToString(doctorFromDataBase["id_person"]), Convert.ToString(doctorFromDataBase["id_doctor_mis"])); } if (doctorFromDataBase["id_person"] != DBNull.Value) { doctor.cnts = TestContact.BuildContactsFromDataBaseData(Convert.ToString(doctorFromDataBase["id_person"])); } docs.Add(doctor); } } } } } } return((docs.Count != 0) ? docs : null); }
private void FindMismatch(TestContact b) { if (this.contact.ContactValue != b.contact.ContactValue) { Global.errors3.Add("Несовпадение ContactValue TestContact"); } if (Global.GetLength(this.contactType) != Global.GetLength(b.contactType)) { Global.errors3.Add("Несовпадение длинны ContactType TestContact"); } }
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<TestContact> BuildContactsFromDataBaseData(string idPerson) { List<TestContact> contacts = new List<TestContact>(); using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT * FROM public.Contact WHERE id_person = '" + idPerson + "'"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader contactReader = person.ExecuteReader()) { while (contactReader.Read()) { ContactDto cont = new ContactDto(); if (contactReader["contact_value"] != DBNull.Value) cont.ContactValue = Convert.ToString(contactReader["contact_value"]); TestContact contact = new TestContact(cont); if (contactReader["id_contact_type"] != DBNull.Value) contact.contactType = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(contactReader["id_contact_type"])); contacts.Add(contact); } } } return (contacts.Count != 0) ? contacts : null; }
private void FindMismatch(TestContact b) { if (this.contact.ContactValue != b.contact.ContactValue) Global.errors3.Add("Несовпадение ContactValue TestContact"); if (Global.GetLength(this.contactType) != Global.GetLength(b.contactType)) Global.errors3.Add("Несовпадение длинны ContactType TestContact"); }