public void saveEmployee(EmployeeEntity obj)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblEmployee emp = new EDMX.tblEmployee
             {
                 Id          = obj.EmployeeId,
                 LastName    = obj.LastName,
                 FirstName   = obj.FirstName,
                 MiddleName  = obj.MiddleName,
                 Active      = obj.Active,
                 DateCreated = obj.DateCreated,
                 DateUpdated = obj.DateUpdated
             };
             db.tblEmployees.Add(emp);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Save Employee");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #2
0
 public void savePatient(PatientEntity obj)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblPatient pat = new EDMX.tblPatient
             {
                 Id          = obj.PatientId,
                 LastName    = obj.LastName,
                 FirstName   = obj.FirstName,
                 MiddleName  = obj.MiddleName,
                 FacilityID  = obj.FacilityId,
                 Active      = obj.Active,
                 DateCreated = obj.DateCreated,
                 DateUpdated = obj.DateUpdated
             };
             db.tblPatients.Add(pat);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Save Patient");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #3
0
        //remove
        //Save
        //Update

        public void getPatientMedication(int patID)
        {
            using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
            {
                var patMed = db.tblPatientMedicationLists.Where(x => x.PatientID == patID).Select(y => new
                {
                    patientId      = y.PatientID,
                    facilityName   = y.tblPatient.tblFacility.Name,
                    patientName    = y.tblPatient.LastName + ", " + y.tblPatient.FirstName,
                    medicationName = y.MedicationName,
                    dosage         = y.Dosage,
                    direction      = y.Direction,
                    orderedBy      = y.OrderedBy,
                    startDate      = y.StartDate,
                    endDate        = y.EndDate,
                    durationType   = y.DurationType,
                    note           = y.Note,
                    id             = y.Id
                }).ToList();



                dgvPatientMedication.DataSource = patMed;
            }
        }
Beispiel #4
0
        public List <PatientEntity> searchPatientByLastName(string LastName)
        {
            List <PatientEntity> List = new List <PatientEntity>();

            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    List = db.tblPatients.Where(x => x.LastName.Contains(LastName)).Select(x => new PatientEntity
                    {
                        PatientId    = x.Id,
                        FacilityId   = x.FacilityID,
                        FacilityName = x.tblFacility.Name,
                        LastName     = x.LastName,
                        FirstName    = x.FirstName,
                        MiddleName   = x.MiddleName,
                        Active       = x.Active,
                        DateCreated  = x.DateCreated,
                        DateUpdated  = x.DateUpdated
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Search Patient By Last Name");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(List);
        }
Beispiel #5
0
        public void updatePatientMedication(int medId)
        {
            using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
            {
                EDMX.tblPatientMedicationList patMed = db.tblPatientMedicationLists.Where(x => x.Id == medId).FirstOrDefault();
                patMed.MedicationName = txtMedicationName.Text;
                patMed.Dosage         = txtDosage.Text;
                patMed.Direction      = txtDirection.Text;
                patMed.OrderedBy      = txtOrderedBy.Text;
                patMed.StartDate      = lblStartDate.Text;
                patMed.EndDate        = lblEndDate.Text;

                if (rdNumOfDays.Checked == true)
                {
                    patMed.DurationType = "N";
                }
                else if (rdDaily.Checked == true)
                {
                    patMed.DurationType = "D";
                }
                else if (rdStop.Checked == true)
                {
                    patMed.DurationType = "S";
                }

                patMed.Note = txtNotes.Text;
                db.SaveChanges();
            }
        }
Beispiel #6
0
 public void getAllFacility()
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             var fac = db.tblFacilities.Where(x => x.Active == "Y").Select(y => new {
                 Id   = y.Id,
                 Name = y.Name
             });
             int ctr = 0;
             foreach (var res in fac)
             {
                 _FacilityIDHolder.Add(res.Id);
                 cboFacility.Items.Add(res.Name);
                 ctr++;
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Get All Facility");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public EmployeeEntity searchEmployeeByID(int empID)
        {
            EmployeeEntity obj = new EmployeeEntity();

            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    EDMX.tblEmployee emp = db.tblEmployees.FirstOrDefault(x => x.Id == empID);
                    if (emp != null)
                    {
                        obj.EmployeeId  = emp.Id;
                        obj.LastName    = emp.LastName;
                        obj.FirstName   = emp.FirstName;
                        obj.MiddleName  = emp.MiddleName;
                        obj.Active      = emp.Active;
                        obj.DateCreated = emp.DateCreated;
                        obj.DateUpdated = emp.DateUpdated;
                    }
                    else
                    {
                        obj = null;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Search Employee By ID");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                obj = null;
            }

            return(obj);
        }
Beispiel #8
0
 public void saveFacility(FacilityEntity obj)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblFacility fac = new EDMX.tblFacility
             {
                 Id          = obj.FacilityId,
                 Name        = obj.Name,
                 Address     = obj.Address,
                 Active      = obj.Active,
                 DateCreated = obj.DateCreated,
                 DateUpdated = obj.DateUpdated
             };
             db.tblFacilities.Add(fac);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Save Facility");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #9
0
        public void getAllFacility()
        {
            try
            {
                List <FacilityEntity> List = new List <FacilityEntity>();
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    List = db.tblFacilities.Select(x => new FacilityEntity
                    {
                        FacilityId  = x.Id,
                        Name        = x.Name,
                        Address     = x.Address,
                        Active      = x.Active,
                        DateCreated = x.DateCreated,
                        DateUpdated = x.DateUpdated
                    }).ToList();
                }

                dgvFacility.DataSource = List;
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get All Facility");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #10
0
        public void getAllPatient()
        {
            try
            {
                List <PatientEntity> List = new List <PatientEntity>();
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    List = db.tblPatients.Select(x => new PatientEntity
                    {
                        PatientId    = x.Id,
                        FacilityId   = x.FacilityID,
                        FacilityName = x.tblFacility.Name,
                        LastName     = x.LastName,
                        FirstName    = x.FirstName,
                        MiddleName   = x.MiddleName,
                        Active       = x.Active,
                        DateCreated  = x.DateCreated,
                        DateUpdated  = x.DateUpdated
                    }).ToList();
                }

                dgvPatient.DataSource = List;
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get All Patient");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #11
0
        public void savePatientMedication()
        {
            string durationType = "";

            if (rdNumOfDays.Checked == true)
            {
                durationType = "N";
            }
            else if (rdDaily.Checked == true)
            {
                durationType = "D";
            }
            else if (rdStop.Checked == true)
            {
                durationType = "S";
            }
            using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
            {
                EDMX.tblPatientMedicationList patMed = new EDMX.tblPatientMedicationList
                {
                    PatientID      = Convert.ToInt32(lblPatientId.Text),
                    MedicationName = txtMedicationName.Text,
                    Dosage         = txtDosage.Text,
                    Direction      = txtDirection.Text,
                    OrderedBy      = txtOrderedBy.Text,
                    StartDate      = lblStartDate.Text,
                    EndDate        = lblEndDate.Text,
                    DurationType   = durationType,
                    Note           = txtNotes.Text
                };
                db.tblPatientMedicationLists.Add(patMed);
                db.SaveChanges();
            }
        }
Beispiel #12
0
        public bool checkConflict(string Date, int EmployeeID)
        {
            bool res = false;

            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    int emp = db.tblSchedules.Where(x => x.Date == Date && x.EmployeeID == EmployeeID).Count();

                    if (emp == 0)
                    {
                        res = false;
                    }
                    else
                    {
                        res = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Check Conflict");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                res = true;
            }
            return(res);
        }
Beispiel #13
0
 public void deletePatientMedication(int medId)
 {
     using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
     {
         var patMed = db.tblPatientMedicationLists.Where(x => x.Id == medId).FirstOrDefault();
         db.tblPatientMedicationLists.Remove(patMed);
         db.SaveChanges();
         MessageBox.Show("Successfully removed medication", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public void searchEmployeeByLastName(string LastName)
        {
            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var emp = db.tblEmployees.Where(x => x.LastName.Contains(LastName) && x.Active == "Y").Select(y => new {
                        EmployeeID   = y.Id,
                        EmployeeName = y.LastName + ", " + y.FirstName + " " + y.MiddleName
                    }).ToList();

                    dgvEmployee.DataSource = emp;
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Search Employee By Last Name");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #15
0
        public void getMedicationList(int id, string patientName, string facilityName)
        {
            using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
            {
                var res = db.tblPatientMedicationLists.Where(y => y.PatientID == id).Select(x => new {
                    Id             = x.Id,
                    PatientId      = x.PatientID,
                    MedicationName = x.MedicationName.ToUpper(),
                    Dosage         = x.Dosage.ToUpper(),
                    Direction      = x.Direction.ToUpper(),
                    OrderedBy      = x.OrderedBy.ToUpper(),
                    StartDate      = x.StartDate.ToUpper(),
                    EndDate        = x.EndDate.ToUpper(),
                    DurationType   = x.DurationType.ToUpper(),
                    Note           = x.Note.ToUpper(),
                    PatientName    = patientName.ToUpper(),
                    FacilityName   = facilityName.ToUpper()
                }).ToList();

                if (res.Count == 0)
                {
                    res = db.tblPatients.Where(y => y.Id == id).Select(x => new {
                        Id             = x.Id,
                        PatientId      = 0,
                        MedicationName = "",
                        Dosage         = "",
                        Direction      = "",
                        OrderedBy      = "",
                        StartDate      = "",
                        EndDate        = "",
                        DurationType   = "",
                        Note           = "",
                        PatientName    = patientName.ToUpper(),
                        FacilityName   = facilityName.ToUpper()
                    }).ToList();
                }

                ViewPatientMedicationListBindingSource.DataSource = res;
                this.reportViewer1.RefreshReport();
            }
        }
Beispiel #16
0
        public string getConflict(string Date, int FacilityID, int EmployeeID)
        {
            string conflict = "";

            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var emp = db.tblSchedules.FirstOrDefault(x => x.Date == Date && x.EmployeeID == EmployeeID);
                    conflict = "Cant add this employee because of conflict in schedule" + "\n" +
                               emp.tblEmployee.LastName + ", " + emp.tblEmployee.FirstName + " " + emp.tblEmployee.MiddleName +
                               " already have schedule on " + emp.Date + " in " + emp.tblFacility.Name;
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get Conflict");
                conflict = "Error Detected Please Contact Developer";
            }
            return(conflict);
        }
Beispiel #17
0
 public void updateFacility(FacilityEntity obj)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblFacility emp = db.tblFacilities.Where(x => x.Id == obj.FacilityId).FirstOrDefault();
             emp.Name        = obj.Name;
             emp.Address     = obj.Address;
             emp.Active      = obj.Active;
             emp.DateCreated = obj.DateCreated;
             emp.DateUpdated = obj.DateUpdated;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Update Facility");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public void getAllFacility()
        {
            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var res = db.tblFacilities.Where(x => x.Active == "Y").ToList();

                    foreach (var a in res)
                    {
                        _facilityID.Add(a.Id);
                        cboFacility.Items.Add(a.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get All Facility");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #19
0
        public void searchPatientByID(int patID)
        {
            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var pat = db.tblPatients.Where(x => x.Id == patID && x.Active == "Y").Select(y => new {
                        PatientID    = y.Id,
                        FacilityName = y.tblFacility.Name,
                        PatientName  = y.LastName + ", " + y.FirstName + " " + y.MiddleName
                    }).ToList();

                    dgvPatient.DataSource = pat;
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Search Employee By ID");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public void getStaffSchedule(int employeeID, string withPast)
        {
            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var res = db.tblSchedules.Where(z => z.EmployeeID == employeeID).Select(x => new ViewScheduleByFacilityAndStaff
                    {
                        Date         = x.Date,
                        EmployeeName = x.tblEmployee.LastName.ToUpper() + ", " + x.tblEmployee.FirstName.ToUpper() + " " + x.tblEmployee.MiddleName.ToUpper(),
                        Facility     = x.tblFacility.Name.ToUpper(),
                        Address      = x.tblFacility.Address.ToUpper()
                    }).ToList();

                    List <ViewScheduleByFacilityAndStaff> empSched = new List <ViewScheduleByFacilityAndStaff>();

                    if (withPast == "Y")
                    {
                        empSched = res;
                    }
                    else
                    {
                        foreach (var a in res)
                        {
                            if (Convert.ToDateTime(a.Date) >= Convert.ToDateTime(DateTime.Now.ToShortDateString()))
                            {
                                empSched.Add(a);
                            }
                        }
                    }
                    ViewScheduleByFacilityAndStaffBindingSource.DataSource = empSched;
                    this.rptViewByStaff.RefreshReport();
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get Staff Schedule");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #21
0
 public void removeEmployeeFromSchedule(string Date, int FacilityID, int EmployeeID)
 {
     try
     {
         DialogResult result = MessageBox.Show("Are you sure you want to remove this employee from the schedule?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (result == DialogResult.Yes)
         {
             using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
             {
                 var emp = db.tblSchedules.Where(x => x.Date == Date && x.FacilityID == FacilityID && x.EmployeeID == EmployeeID).FirstOrDefault();
                 db.tblSchedules.Remove(emp);
                 db.SaveChanges();
                 MessageBox.Show("Successfuly Removed from the schedule!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Remove from Schedule");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #22
0
 public void getScheduledEmployee(string Date, int FacilityID)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             var scheduledEmp = db.tblSchedules.Where(x => x.Date == Date && x.FacilityID == FacilityID).Select(y => new {
                 Date         = y.Date,
                 FacilityID   = y.FacilityID,
                 FacilityName = y.tblFacility.Name,
                 EmployeeID   = y.EmployeeID,
                 employeeName = y.tblEmployee.LastName + ", " + y.tblEmployee.FirstName + " " + y.tblEmployee.MiddleName
             }).ToList();
             dgvScheduledStaff.DataSource = scheduledEmp;
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Get Scheduled Employee");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #23
0
 public void addEmployeeToSchedule(string Date, int FacilityID, int EmployeeID)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblSchedule sched = new EDMX.tblSchedule
             {
                 Id         = 1,
                 Date       = Date,
                 FacilityID = FacilityID,
                 EmployeeID = EmployeeID
             };
             db.tblSchedules.Add(sched);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Add Employee Schedule");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #24
0
 public void updatePatient(PatientEntity obj)
 {
     try
     {
         using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
         {
             EDMX.tblPatient pat = db.tblPatients.Where(x => x.Id == obj.PatientId).FirstOrDefault();
             pat.LastName    = obj.LastName;
             pat.FirstName   = obj.FirstName;
             pat.MiddleName  = obj.MiddleName;
             pat.FacilityID  = obj.FacilityId;
             pat.Active      = obj.Active;
             pat.DateCreated = obj.DateCreated;
             pat.DateUpdated = obj.DateUpdated;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.Log(ex, this.Name, "Method Update Patient");
         MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public void getScheduleByFacility(string Date, int FacilityID)
        {
            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    var res = db.tblSchedules.Where(z => z.Date == Date && z.FacilityID == FacilityID).Select(x => new ViewScheduleByFacilityAndStaff
                    {
                        Date         = x.Date,
                        EmployeeName = x.tblEmployee.LastName.ToUpper() + ", " + x.tblEmployee.FirstName.ToUpper() + " " + x.tblEmployee.MiddleName.ToUpper(),
                        Facility     = x.tblFacility.Name.ToUpper(),
                        Address      = x.tblFacility.Address.ToUpper()
                    }).ToList();

                    ViewScheduleByFacilityAndStaffBindingSource.DataSource = res;
                    this.rptViewByFacility.RefreshReport();
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Get Schedule By Facility");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #26
0
        public PatientEntity searchPatientByID(int patientID)
        {
            PatientEntity obj = new PatientEntity();

            try
            {
                using (ACHSystem.EDMX.ACHDBContainer db = new ACHSystem.EDMX.ACHDBContainer())
                {
                    EDMX.tblPatient pat = db.tblPatients.FirstOrDefault(x => x.Id == patientID);
                    if (pat != null)
                    {
                        obj.PatientId    = pat.Id;
                        obj.FacilityId   = pat.FacilityID;
                        obj.FacilityName = pat.tblFacility.Name;
                        obj.LastName     = pat.LastName;
                        obj.FirstName    = pat.FirstName;
                        obj.MiddleName   = pat.MiddleName;
                        obj.Active       = pat.Active;
                        obj.DateCreated  = pat.DateCreated;
                        obj.DateUpdated  = pat.DateUpdated;
                    }
                    else
                    {
                        obj = null;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLogging.Log(ex, this.Name, "Method Search Patient By ID");
                MessageBox.Show("Error Detected, Let the Developer know", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                obj = null;
            }

            return(obj);
        }