Ejemplo n.º 1
0
        static public List <TestJob> BuildJobFromDataBaseData(string idPerson)
        {
            List <TestJob> jobs = new List <TestJob>();

            using (NpgsqlConnection connection = Global.GetSqlConnection())
            {
                string        findJob = "SELECT * FROM public.job WHERE id_person = '" + idPerson + "'";
                NpgsqlCommand person  = new NpgsqlCommand(findJob, connection);
                using (NpgsqlDataReader jobReader = person.ExecuteReader())
                {
                    while (jobReader.Read())
                    {
                        Job job = new Job();
                        if (jobReader["company_name"] != DBNull.Value)
                        {
                            job.CompanyName = Convert.ToString(jobReader["company_name"]);
                        }
                        if (jobReader["position"] != DBNull.Value)
                        {
                            job.Position = Convert.ToString(jobReader["position"]);
                        }
                        TestJob tJob = new TestJob(job);
                        jobs.Add(tJob);
                    }
                }
            }
            return((jobs.Count != 0) ? jobs : null);
        }
Ejemplo n.º 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.Position == p.job.Position))
            {
                return(true);
            }
            else
            {
                this.FindMismatch(p);
                Global.errors3.Add("несовпадение TestJob");
                return(false);
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 private void FindMismatch(TestJob b)
 {
     if (b.job != null)
     {
         if (this.job.CompanyName != b.job.CompanyName)
         {
             Global.errors3.Add("Несовпадение имен компаний");
         }
         if (this.job.Position != b.job.Position)
         {
             Global.errors3.Add("Несовпадение позиций");
         }
     }
 }
Ejemplo n.º 5
0
 public static List<TestJob> BuildJobFromDataBaseData(string idPerson)
 {
     List<TestJob> jobs = new List<TestJob>();
     using (NpgsqlConnection connection = Global.GetSqlConnection())
     {
         string findJob = "SELECT * FROM public.job WHERE id_person = '" + idPerson + "'";
         NpgsqlCommand person = new NpgsqlCommand(findJob, connection);
         using (NpgsqlDataReader jobReader = person.ExecuteReader())
         {
             while (jobReader.Read())
             {
                 Job job = new Job();
                 if (jobReader["company_name"]!= DBNull.Value)
                     job.CompanyName = Convert.ToString(jobReader["company_name"]);
                 if (jobReader["position"] != DBNull.Value)
                     job.Position = Convert.ToString(jobReader["position"]);
                 TestJob tJob = new TestJob(job);
                 jobs.Add(tJob);
             }
         }
     }
     return (jobs.Count != 0) ? jobs : null;
 }
Ejemplo n.º 6
0
 private void FindMismatch(TestJob b)
 {
     if (b.job != null)
     {
         if (this.job.CompanyName != b.job.CompanyName)
             Global.errors3.Add("Несовпадение имен компаний");
         if (this.job.Position != b.job.Position)
             Global.errors3.Add("Несовпадение позиций");
     }
 }