Example #1
0
 private void FindMismatch(TestJob b)
 {
     if (b.job != null)
     {
         if (this.job.CompanyName != b.job.CompanyName)
         {
             Global.errors3.Add("Несовпадение имен компаний");
         }
         if (this.job.DateEnd != b.job.DateEnd)
         {
             Global.errors3.Add("Несовпадение дат конца работы");
         }
         if (this.job.DateStart != b.job.DateStart)
         {
             Global.errors3.Add("Несовпадение дат начала работы");
         }
         if (this.job.OgrnCode != b.job.OgrnCode)
         {
             Global.errors3.Add("Несовпадение кодов ОГРН");
         }
         if (this.job.Position != b.job.Position)
         {
             Global.errors3.Add("Несовпадение позиций");
         }
         if (this.job.Sphere != b.job.Sphere)
         {
             Global.errors3.Add("Несовпадение сфер");
         }
     }
 }
Example #2
0
        public override bool Equals(Object obj)
        {
            TestJob p = obj as TestJob;

            if ((object)p == null)
            {
                return(false);
            }
            if (this.job == p.job)
            {
                return(true);
            }
            if ((this.job == null) || (p.job == null))
            {
                return(false);
            }
            if ((this.job.CompanyName == p.job.CompanyName) &&
                (this.job.DateEnd == p.job.DateEnd) &&
                (this.job.DateStart == p.job.DateStart) &&
                (this.job.OgrnCode == p.job.OgrnCode) &&
                (this.job.Position == p.job.Position) &&
                (this.job.Sphere == p.job.Sphere))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestJob");
                return(false);
            }
        }
Example #3
0
 static public TestJob BuildTestJobFromDataBase(string idPerson)
 {
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         string     findPatient = "SELECT TOP(1) * FROM Job WHERE IdJob = (SELECT MAX(IdJob) FROM Job WHERE IdPerson = '" + idPerson + "')";
         SqlCommand person      = new SqlCommand(findPatient, connection);
         using (SqlDataReader jobReader = person.ExecuteReader())
         {
             while (jobReader.Read())
             {
                 JobDto job = new JobDto();
                 job.CompanyName = Convert.ToString(jobReader["CompanyName"]);
                 if (jobReader["DateStart"].ToString() != "")
                 {
                     job.DateStart = Convert.ToDateTime(jobReader["DateStart"]);
                 }
                 else
                 {
                     job.DateStart = null;
                 }
                 if (jobReader["DateEnd"].ToString() != "")
                 {
                     job.DateEnd = Convert.ToDateTime(jobReader["DateEnd"]);
                 }
                 else
                 {
                     job.DateEnd = null;
                 }
                 if (jobReader["Sphere"].ToString() != "")
                 {
                     job.Sphere = Convert.ToString(jobReader["Sphere"]);
                 }
                 else
                 {
                     job.Sphere = null;
                 }
                 if (jobReader["OgrnCode"].ToString() != "")
                 {
                     job.OgrnCode = Convert.ToString(jobReader["OgrnCode"]);
                 }
                 else
                 {
                     job.OgrnCode = null;
                 }
                 if (jobReader["Position"].ToString() != "")
                 {
                     job.Position = Convert.ToString(jobReader["Position"]);
                 }
                 else
                 {
                     job.Position = null;
                 }
                 TestJob j = new TestJob(job);
                 return(j);
             }
         }
     }
     return(null);
 }
Example #4
0
 public TestPatient(string guid, string idlpu, PatientDto p)
 {
     patient = p;
     if ((guid != null) && (idlpu != null) && (p.IdPatientMIS != null))
     {
         patient.IdGlobal = GetPatientId(guid, idlpu, p.IdPatientMIS);
     }
     GUID  = guid.ToLower();
     IDLPU = idlpu;
     if ((p.Documents != null) && (p.Documents.Length != 0))
     {
         List <TestDocument> doc = new List <TestDocument>();
         foreach (DocumentDto d in p.Documents)
         {
             doc.Add(new TestDocument(d));
         }
         documents = doc;
     }
     if ((p.Addresses != null) && (p.Addresses.Length != 0))
     {
         List <TestAddress> add = new List <TestAddress>();
         foreach (AddressDto a in p.Addresses)
         {
             add.Add(new TestAddress(a));
         }
         addreses = add;
     }
     if ((p.Contacts != null) && (p.Contacts.Length != 0))
     {
         List <TestContact> cont = new List <TestContact>();
         foreach (ContactDto c in p.Contacts)
         {
             cont.Add(new TestContact(c));
         }
         contacts = cont;
     }
     if (p.Job != null)
     {
         job = new TestJob(p.Job);
     }
     if (p.Privilege != null)
     {
         privilege = new TestPrivilege(p.Privilege);
     }
     if (p.BirthPlace != null)
     {
         birthplace = new TestBirthplace(p.BirthPlace);
     }
 }
Example #5
0
 public TestPatient(string guid, string idlpu, PatientDto p)
 {
     patient = p;
     if ((guid != null) && (idlpu != null) && (p.IdPatientMIS != null))
         patient.IdGlobal = GetPatientId(guid, idlpu, p.IdPatientMIS);
     GUID = guid.ToLower();
     IDLPU = idlpu;
     if ((p.Documents != null) && (p.Documents.Length != 0))
     {
         List<TestDocument> doc = new List<TestDocument>();
         foreach (DocumentDto d in p.Documents)
         {
             doc.Add(new TestDocument(d));
         }
         documents = doc;
     }
     if ((p.Addresses != null) && (p.Addresses.Length != 0))
     {
         List<TestAddress> add = new List<TestAddress>();
         foreach (AddressDto a in p.Addresses)
         {
             add.Add(new TestAddress(a));
         }
         addreses = add;
     }
     if ((p.Contacts != null) && (p.Contacts.Length != 0))
     {
         List<TestContact> cont = new List<TestContact>();
         foreach(ContactDto c in p.Contacts)
         {
             cont.Add(new TestContact(c));
         }
         contacts = cont;
     }
     if (p.Job != null)
         job = new TestJob(p.Job);
     if (p.Privilege != null)
         privilege = new TestPrivilege(p.Privilege);
     if (p.BirthPlace != null)
         birthplace = new TestBirthplace(p.BirthPlace);
 }
Example #6
0
 public static TestJob BuildTestJobFromDataBase(string idPerson)
 {
     using (SqlConnection connection = Global.GetSqlConnection())
     {
         string findPatient = "SELECT TOP(1) * FROM Job WHERE IdJob = (SELECT MAX(IdJob) FROM Job WHERE IdPerson = '" + idPerson + "')";
         SqlCommand person = new SqlCommand(findPatient, connection);
         using (SqlDataReader jobReader = person.ExecuteReader())
         {
             while (jobReader.Read())
             {
                 JobDto job = new JobDto();
                 job.CompanyName = Convert.ToString(jobReader["CompanyName"]);
                 if (jobReader["DateStart"].ToString() != "")
                     job.DateStart = Convert.ToDateTime(jobReader["DateStart"]);
                 else
                     job.DateStart = null;
                 if (jobReader["DateEnd"].ToString() != "")
                     job.DateEnd = Convert.ToDateTime(jobReader["DateEnd"]);
                 else
                     job.DateEnd = null;
                 if (jobReader["Sphere"].ToString() != "")
                     job.Sphere = Convert.ToString(jobReader["Sphere"]);
                 else
                     job.Sphere = null;
                 if (jobReader["OgrnCode"].ToString() != "")
                     job.OgrnCode = Convert.ToString(jobReader["OgrnCode"]);
                 else
                     job.OgrnCode = null;
                 if (jobReader["Position"].ToString() != "")
                     job.Position = Convert.ToString(jobReader["Position"]);
                 else
                     job.Position = null;
                 TestJob j = new TestJob(job);
                 return j;
             }
         }
     }
     return null;
 }
Example #7
0
 public void ChangePatientField(PatientDto b)
 {
     if ((b.FamilyName != null) && (this.patient.FamilyName != b.FamilyName))
         this.patient.FamilyName = b.FamilyName;
     if  ((b.MiddleName != null) && (this.patient.MiddleName != b.MiddleName))
         this.patient.MiddleName = b.MiddleName;
     if ((b.GivenName != null) && (this.patient.GivenName != b.GivenName))
         this.patient.GivenName = b.GivenName;
     if ((b.BirthDate != DateTime.MinValue) && (this.patient.BirthDate != b.BirthDate))
         this.patient.BirthDate = b.BirthDate;
     if ((b.Sex != 0) && (this.patient.Sex != b.Sex))
         this.patient.Sex = b.Sex;
     this.patient.IsVip = b.IsVip;
     if ((b.SocialStatus != null) && (this.patient.SocialStatus != b.SocialStatus))
         this.patient.SocialStatus = b.SocialStatus;
     if ((b.IdLivingAreaType != null) && (this.patient.IdLivingAreaType != b.IdLivingAreaType))
         this.patient.IdLivingAreaType = b.IdLivingAreaType;
     if ((b.IdBloodType != null) && (this.patient.IdBloodType != b.IdBloodType))
         this.patient.IdBloodType = b.IdBloodType;
     if ((b.DeathTime != null) && (this.patient.DeathTime != b.DeathTime))
         this.patient.DeathTime = b.DeathTime;
     if (b.Documents != null)
     {
         foreach (DocumentDto d in b.Documents)
         {
             if (this.documents != null)
             {
                 bool mark = false;
                 foreach (TestDocument td in this.documents)
                 {
                     if (d.IdDocumentType == td.document.IdDocumentType)
                     {
                         td.document = d;
                         mark = true;
                     }
                 }
                 if (!mark)
                     this.documents.Add(new TestDocument(d));
             }
             else
             {
                 this.documents = new List<TestDocument>();
                 documents.Add(new TestDocument(d));
             }
         }
     }
     if (b.Addresses != null)
     {
         foreach (AddressDto a in b.Addresses)
         {
             if (this.addreses != null)
             {
                 bool mark = false;
                 foreach (TestAddress ta in this.addreses)
                 {
                     if (a.IdAddressType == ta.address.IdAddressType)
                     {
                         ta.address = a;
                         mark = true;
                     }
                 }
                 if (!mark)
                     this.addreses.Add(new TestAddress(a));
             }
             else
             {
                 this.addreses = new List<TestAddress>();
                 addreses.Add(new TestAddress(a));
             }
         }
     }
     if (b.Contacts != null)
         foreach (ContactDto c in b.Contacts)
         {
             TestContact tc = new TestContact(c);
             if (this.contacts != null)
             {
                 bool mark = false;
                 foreach (TestContact c1 in this.contacts)
                     if (tc == c1)
                         mark = true;
                 if (!mark)
                     this.contacts.Add(tc);
             }
             else
                 this.contacts.Add(tc);
         }
     if (b.Job != null)
         this.job = new TestJob(b.Job);
     if (b.Privilege != null)
         this.privilege = new TestPrivilege(b.Privilege);
     if (b.BirthPlace != null)
         this.birthplace = new TestBirthplace(b.BirthPlace);
 }
Example #8
0
 private void FindMismatch(TestJob b)
 {
     if (b.job != null)
     {
         if (this.job.CompanyName != b.job.CompanyName)
             Global.errors3.Add("Несовпадение имен компаний");
         if (this.job.DateEnd != b.job.DateEnd)
             Global.errors3.Add("Несовпадение дат конца работы");
         if (this.job.DateStart != b.job.DateStart)
             Global.errors3.Add("Несовпадение дат начала работы");
         if (this.job.OgrnCode != b.job.OgrnCode)
             Global.errors3.Add("Несовпадение кодов ОГРН");
         if (this.job.Position != b.job.Position)
             Global.errors3.Add("Несовпадение позиций");
         if (this.job.Sphere != b.job.Sphere)
             Global.errors3.Add("Несовпадение сфер");
     }
 }
Example #9
0
 public void ChangePatientField(PatientDto b)
 {
     if ((b.FamilyName != null) && (this.patient.FamilyName != b.FamilyName))
     {
         this.patient.FamilyName = b.FamilyName;
     }
     if ((b.MiddleName != null) && (this.patient.MiddleName != b.MiddleName))
     {
         this.patient.MiddleName = b.MiddleName;
     }
     if ((b.GivenName != null) && (this.patient.GivenName != b.GivenName))
     {
         this.patient.GivenName = b.GivenName;
     }
     if ((b.BirthDate != DateTime.MinValue) && (this.patient.BirthDate != b.BirthDate))
     {
         this.patient.BirthDate = b.BirthDate;
     }
     if ((b.Sex != 0) && (this.patient.Sex != b.Sex))
     {
         this.patient.Sex = b.Sex;
     }
     this.patient.IsVip = b.IsVip;
     if ((b.SocialStatus != null) && (this.patient.SocialStatus != b.SocialStatus))
     {
         this.patient.SocialStatus = b.SocialStatus;
     }
     if ((b.IdLivingAreaType != null) && (this.patient.IdLivingAreaType != b.IdLivingAreaType))
     {
         this.patient.IdLivingAreaType = b.IdLivingAreaType;
     }
     if ((b.IdBloodType != null) && (this.patient.IdBloodType != b.IdBloodType))
     {
         this.patient.IdBloodType = b.IdBloodType;
     }
     if ((b.DeathTime != null) && (this.patient.DeathTime != b.DeathTime))
     {
         this.patient.DeathTime = b.DeathTime;
     }
     if (b.Documents != null)
     {
         foreach (DocumentDto d in b.Documents)
         {
             if (this.documents != null)
             {
                 bool mark = false;
                 foreach (TestDocument td in this.documents)
                 {
                     if (d.IdDocumentType == td.document.IdDocumentType)
                     {
                         td.document = d;
                         mark        = true;
                     }
                 }
                 if (!mark)
                 {
                     this.documents.Add(new TestDocument(d));
                 }
             }
             else
             {
                 this.documents = new List <TestDocument>();
                 documents.Add(new TestDocument(d));
             }
         }
     }
     if (b.Addresses != null)
     {
         foreach (AddressDto a in b.Addresses)
         {
             if (this.addreses != null)
             {
                 bool mark = false;
                 foreach (TestAddress ta in this.addreses)
                 {
                     if (a.IdAddressType == ta.address.IdAddressType)
                     {
                         ta.address = a;
                         mark       = true;
                     }
                 }
                 if (!mark)
                 {
                     this.addreses.Add(new TestAddress(a));
                 }
             }
             else
             {
                 this.addreses = new List <TestAddress>();
                 addreses.Add(new TestAddress(a));
             }
         }
     }
     if (b.Contacts != null)
     {
         foreach (ContactDto c in b.Contacts)
         {
             TestContact tc = new TestContact(c);
             if (this.contacts != null)
             {
                 bool mark = false;
                 foreach (TestContact c1 in this.contacts)
                 {
                     if (tc == c1)
                     {
                         mark = true;
                     }
                 }
                 if (!mark)
                 {
                     this.contacts.Add(tc);
                 }
             }
             else
             {
                 this.contacts.Add(tc);
             }
         }
     }
     if (b.Job != null)
     {
         this.job = new TestJob(b.Job);
     }
     if (b.Privilege != null)
     {
         this.privilege = new TestPrivilege(b.Privilege);
     }
     if (b.BirthPlace != null)
     {
         this.birthplace = new TestBirthplace(b.BirthPlace);
     }
 }
Example #10
0
 static public TestPatient BuildPatientFromDataBaseData(string guid = null, string idlpu = null, string mis = null, string patientId = null)
 {
     if (patientId == null)
     {
         patientId = GetPatientId(guid, idlpu, mis);
     }
     else
     {
         string[] s = GetGUIDandIDLPUandIDMIS(patientId);
         guid  = s[0];
         idlpu = s[1];
         mis   = s[2];
     }
     if (patientId != null)
     {
         using (SqlConnection connection = Global.GetSqlConnection())
         {
             string     findPatient = "SELECT TOP(1) * FROM Person, PatientAdditionalInfo WHERE Person.IdPerson = '" + patientId + "' AND Person.IdPerson = PatientAdditionalInfo.IdPerson";
             SqlCommand person      = new SqlCommand(findPatient, connection);
             using (SqlDataReader patientFromDataBase = person.ExecuteReader())
             {
                 while (patientFromDataBase.Read())
                 {
                     PatientDto p = new PatientDto();
                     if (patientFromDataBase["FamilyName"].ToString() != "")
                     {
                         p.FamilyName = Convert.ToString(patientFromDataBase["FamilyName"]);
                     }
                     else
                     {
                         p.FamilyName = null;
                     }
                     if (patientFromDataBase["MiddleName"].ToString() != "")
                     {
                         p.MiddleName = Convert.ToString(patientFromDataBase["MiddleName"]);
                     }
                     else
                     {
                         p.MiddleName = null;
                     }
                     if (patientFromDataBase["GivenName"].ToString() != "")
                     {
                         p.GivenName = Convert.ToString(patientFromDataBase["GivenName"]);
                     }
                     else
                     {
                         p.GivenName = null;
                     }
                     p.BirthDate = Convert.ToDateTime(patientFromDataBase["BirthDate"]);
                     p.Sex       = Convert.ToByte(patientFromDataBase["IdSex"]);
                     p.IsVip     = Convert.ToBoolean(patientFromDataBase["IsVip"]);
                     if (patientFromDataBase["IdSocialStatus"].ToString() != "")
                     {
                         p.SocialStatus = Convert.ToString(patientFromDataBase["IdSocialStatus"]);
                     }
                     else
                     {
                         p.SocialStatus = null;
                     }
                     if (patientFromDataBase["IdSocialGroup"].ToString() != "")
                     {
                         p.SocialGroup = Convert.ToByte(patientFromDataBase["IdSocialGroup"]);
                     }
                     else
                     {
                         p.SocialGroup = null;
                     }
                     if (patientFromDataBase["IdLivingAreaType"].ToString() != "")
                     {
                         p.IdLivingAreaType = Convert.ToByte(patientFromDataBase["IdLivingAreaType"]);
                     }
                     else
                     {
                         p.IdLivingAreaType = null;
                     }
                     if (patientFromDataBase["IdBloodType"].ToString() != "")
                     {
                         p.IdBloodType = Convert.ToByte(patientFromDataBase["IdBloodType"]);
                     }
                     else
                     {
                         p.IdBloodType = null;
                     }
                     if (patientFromDataBase["DeathTime"].ToString() != "")
                     {
                         p.DeathTime = Convert.ToDateTime(patientFromDataBase["DeathTime"]);
                     }
                     else
                     {
                         p.DeathTime = null;
                     }
                     p.IdPatientMIS = mis;
                     p.IdGlobal     = patientId;
                     TestPatient patient = new TestPatient(guid, idlpu, p);
                     patient.documents  = TestDocument.BuildDocumentsFromDataBaseData(patientId);
                     patient.addreses   = TestAddress.BuildAdressesFromDataBaseData(patientId);
                     patient.contacts   = TestContact.BuildContactsFromDataBaseData(patientId);
                     patient.job        = TestJob.BuildTestJobFromDataBase(patientId);
                     patient.privilege  = TestPrivilege.BuildTestPrivilegeFromDataBase(patientId);
                     patient.birthplace = TestBirthplace.BuildBirthplaceFromDataBaseData(patientId);
                     return(patient);
                 }
             }
         }
     }
     return(null);
 }