public override bool Equals(Object obj) { TestHumanName p = obj as TestHumanName; if ((object)p == null) { return(false); } if (this.humanName == p.humanName) { return(true); } if ((this.humanName == null) || (p.humanName == null)) { return(false); } if ((this.humanName.FamilyName == p.humanName.FamilyName) && (this.humanName.GivenName == p.humanName.GivenName) && (this.humanName.MiddleName == p.humanName.MiddleName)) { return(true); } else { this.FindMismatch(p); Global.errors3.Add("несовпадение TestHumanName"); return(false); } }
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); }
private void FindMismatch(TestHumanName n) { if (this.humanName.FamilyName != n.humanName.FamilyName) { Global.errors3.Add("Несовпадение FamilyName HumanName"); } if (this.humanName.GivenName != n.humanName.GivenName) { Global.errors3.Add("Несовпадение GivenName HumanName"); } if (this.humanName.MiddleName != n.humanName.MiddleName) { Global.errors3.Add("Несовпадение MiddleName HumanName"); } }
public TestPerson(PersonWithIdentity p) { person = p; if (person.Sex == 0) person.Sex = 3; name = new TestHumanName(p.HumanName); if ((p.Documents != null) && (Global.GetLength(p.Documents) != 0)) { List<TestIdentityDocument> doc = new List<TestIdentityDocument>(); foreach (IdentityDocument d in p.Documents) { doc.Add(new TestIdentityDocument(d)); } documents = doc; } }
public TestPerson(PersonWithIdentity p) { person = p; if (person.Sex == 0) { person.Sex = 3; } name = new TestHumanName(p.HumanName); if ((p.Documents != null) && (Global.GetLength(p.Documents) != 0)) { List <TestIdentityDocument> doc = new List <TestIdentityDocument>(); foreach (IdentityDocument d in p.Documents) { doc.Add(new TestIdentityDocument(d)); } documents = doc; } }
private void FindMismatch(TestHumanName n) { if (this.humanName.FamilyName != n.humanName.FamilyName) Global.errors3.Add("Несовпадение FamilyName HumanName"); if (this.humanName.GivenName != n.humanName.GivenName) Global.errors3.Add("Несовпадение GivenName HumanName"); if (this.humanName.MiddleName != n.humanName.MiddleName) Global.errors3.Add("Несовпадение MiddleName HumanName"); }