//Method to DeActive Doctor Account, with string
        public string DeActivate_DAL(DoctorBO doctorBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }
                    ObjHmsDataContext.SubmitChanges();

                    Doctor doctor = ObjHmsDataContext.Doctors.SingleOrDefault(dctr => (dctr.Email_ID == doctorBO.emailID ||
                                                                                       dctr.Doctor_ID == doctorBO.pid));

                    doctor.IsActive = false;

                    ObjHmsDataContext.SubmitChanges();

                    return("Account DeActivated successfully");
                }
            }
            catch
            {
                return("Unable to DeActivate Account please try again later ");
            }
        }
        public IEnumerable <AccountBO> AccountUpdateDetails_DAL(AccountBO accountBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Account account = objHmsDataContext.Accounts.SingleOrDefault(accountDetails => (accountDetails.Bill_ID == accountBO.bill_ID));

                    Account updatedAccount = ConvertBOToAccount(account, accountBO);

                    objHmsDataContext.SubmitChanges();

                    return(GetAllAccounts_DAL());
                }
            }
            catch (Exception e)
            {
                IEnumerable <AccountBO> accounts = null;
                return(accounts);
            }
        }
        public IEnumerable <TreatmentRoomBO> UpdateTreatmentRoomRecord(TreatmentRoom_Record treatmentRoomRec)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    var treatmentRmRec = objHmsDataContext.TreatmentRoom_Records.Where(trmntRooms => (trmntRooms.Room_ID == treatmentRoomRec.Room_ID && trmntRooms.Appointment_ID == treatmentRoomRec.Appointment_ID)).FirstOrDefault();

                    treatmentRmRec.IsBooked = treatmentRoomRec.IsBooked;
                    objHmsDataContext.SubmitChanges();

                    return(GetAllTreatmentRooms());
                }
            }
            catch (Exception e)
            {
                IEnumerable <TreatmentRoomBO> room = null;
                return(room);
            }
        }
        public IEnumerable <ReportBO> ReqNewReport(AppointmentBO appBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment appt = objHmsDataContext.Appointments.SingleOrDefault(rprt => (rprt.Appointment_ID == appBO.appointment_ID));
                    appt.RequestedReport      = true;
                    appt.RequestedReportNotes = appBO.reqReportNotes;
                    objHmsDataContext.SubmitChanges();



                    return(GetAllPatientsReports_DAL());
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        //Method to update Report, with string return type and report business object as parameter
        public IEnumerable <ReportBO> UpdatePatientReport_DAL(ReportBO reportBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Report_ID == reportBO.report_ID));

                    Report updatedReport = ConvertBOToReport(report, reportBO);

                    objHmsDataContext.SubmitChanges();

                    return(GetPatientReports_DAL(reportBO.patient_ID));
                }
            }
            catch
            {
                return(null);
            }
        }
        public AppointmentBO BookAppointment(AppointmentBO appointmentBO)
        {
            try
            {
                if (checkAppointemnt(appointmentBO))
                {
                    using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                    {
                        if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                        {
                            objHmsDataContext.Connection.Open();
                        }

                        Appointment app            = new Appointment();
                        Appointment newAppointment = ConvertBOToAppt(app, appointmentBO);
                        objHmsDataContext.Appointments.InsertOnSubmit(newAppointment);
                        objHmsDataContext.SubmitChanges();
                    }
                }
                else
                {
                    AppointmentBO app_BO = null;
                    return(app_BO);
                }
                AppointmentBO appBO = GetAppointment(appointmentBO);
                return(appBO);
            }
            catch (Exception e)
            {
                AppointmentBO app_BO = new AppointmentBO();
                return(app_BO);
            }
        }
        //Method to update Appointment, with return type string
        public AppointmentBO UpdateApmnt(AppointmentBO appointmentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment apmnt = objHmsDataContext.Appointments.SingleOrDefault(appmt => (appmt.Appointment_ID == appointmentBO.appointment_ID ||
                                                                                                 (appmt.Patient_ID == appointmentBO.paitent_ID && appmt.Appointment_Date == appointmentBO.appointment_Date)));

                    Appointment updateApmnt = ConvertBOToAppt(apmnt, appointmentBO);

                    objHmsDataContext.SubmitChanges();
                }
                return(GetAppointment(appointmentBO));
            }
            catch (Exception e)
            {
                throw new Exception("unable to update appointment now");
                //return "Unable to update appointment please try again later";
            }
        }
Ejemplo n.º 8
0
        //funtion to register new Administrator, with return type administrator Business object
        public AdministratorBO InsertAdministrator_DAL(AdministratorBO adminBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }

                    Administrator admin = new Administrator();

                    Administrator admin_new = ConvertBOToAdmin(admin, adminBO);
                    admin_new.IsActive = true;
                    ObjHmsDataContext.Administrators.InsertOnSubmit(admin_new);

                    ObjHmsDataContext.SubmitChanges();

                    AdministratorBO admin_Detials = GetAdminDetails_DAL(adminBO);

                    return(admin_Detials);
                }
            }
            catch (Exception e)
            {
                AdministratorBO admin_BO = new AdministratorBO();

                return(admin_BO);
            }
        }
        //Method to update Payment Record,with string return type
        public string UpdatePayment(PaymentBO paymentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Payment payment = objHmsDataContext.Payments.SingleOrDefault(pymts => (pymts.Payment_ID == paymentBO.payment_ID));

                    Payment updatedPayment = ConvertBOToPayment(payment, paymentBO);

                    objHmsDataContext.SubmitChanges();

                    return("Succesfully changes submitted");
                }
            }
            catch (Exception e)
            {
                return("Unable to submit changes please try again later");
            }
        }
        //Method to record new payment,with return type payment Business object
        public PaymentBO CreateNewPayment(PaymentBO paymentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Payment payment = new Payment();

                    Payment updatedPayment = ConvertBOToPayment(payment, paymentBO);

                    objHmsDataContext.Payments.InsertOnSubmit(updatedPayment);

                    objHmsDataContext.SubmitChanges();

                    Payment newPayment = objHmsDataContext.Payments.SingleOrDefault(new_payment => (new_payment.Patient_ID == paymentBO.patient_ID || new_payment.Date_Time == paymentBO.date));

                    PaymentBO payment_BO = ConvertPaymentToBO(newPayment);

                    return(payment_BO);
                }
            }
            catch (Exception e)
            {
                PaymentBO payment_BO = new PaymentBO();

                return(payment_BO);
            }
        }
        public void InsertPatientPayments(PaymentBO paymentBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    objHmsDataContext.Payments.InsertOnSubmit(new Payment
                    {
                        Patient_ID    = paymentBO.patient_ID,
                        Total_Amount  = Convert.ToDecimal(paymentBO.total_Amount),
                        Hospital_Fee  = Convert.ToDecimal(paymentBO.hospital_Fee),
                        Medicines_Fee = Convert.ToDecimal(paymentBO.medicines_Fee),
                        Room_Fee      = paymentBO.room_Fee != 0 ? Convert.ToDecimal(paymentBO.room_Fee) : 0,
                        Paid_Amount   = Convert.ToDecimal(paymentBO.paid_Amount),
                        Date_Time     = DateTime.Now,
                        Bill_ID       = paymentBO.bill_ID
                    });
                    objHmsDataContext.SubmitChanges();
                    //return GetPatientPayments(paymentBO.patient_ID);
                }
            }
            catch (Exception e)
            {
                // IEnumerable<PaymentBO> payment_BO = null;

                //return payment_BO;
            }
        }
        public void InsertPaymentAfterBillGeneration(AccountBO accBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    objHmsDataContext.Payments.InsertOnSubmit(new Payment {
                        Patient_ID    = accBO.patient_ID,
                        Hospital_Fee  = Convert.ToDecimal(accBO.hospital_Fee),
                        Medicines_Fee = Convert.ToDecimal(accBO.medicines_Fee),
                        Room_Fee      = accBO.room_Fee != 0 ? Convert.ToDecimal(accBO.room_Fee) :0,
                        Total_Amount  = Convert.ToDecimal(accBO.hospital_Fee) + Convert.ToDecimal(accBO.medicines_Fee),
                        Paid_Amount   = 0,
                        Date_Time     = DateTime.Now,
                        Bill_ID       = accBO.bill_ID
                    });
                    objHmsDataContext.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
        public IEnumerable <AccountBO> DeleteAccountDetail_DAL(AccountBO accountBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Account account = objHmsDataContext.Accounts.Where(acnt => (acnt.Bill_ID == accountBO.bill_ID)).SingleOrDefault();

                    objHmsDataContext.Accounts.DeleteOnSubmit(account);
                    objHmsDataContext.SubmitChanges();

                    return(GetAllAccounts_DAL());
                }
            }
            catch (Exception e)
            {
                IEnumerable <AccountBO> result = null;
                return(result);
            }
        }
        //Method to delete records in Account table, with return type of Account Business object
        public string DeleteAccount_DAL(AccountBO accountBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Account account = objHmsDataContext.Accounts.SingleOrDefault(acnt => ((acnt.Patient_ID == accountBO.patient_ID && acnt.Payment_ID == accountBO.payment_ID) ||
                                                                                          acnt.Bill_ID == accountBO.bill_ID));

                    objHmsDataContext.Accounts.DeleteOnSubmit(account);
                    objHmsDataContext.SubmitChanges();

                    return("Successfully Account record deleted");
                }
            }
            catch (Exception e)
            {
                return("Unable to delete now please try again later");
            }
        }
        //Method to update AccountDetails, with return type string
        public string UpdateAccountDetails_DAL(AccountBO accountBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    Account account = null;
                    if (accountBO.payment_ID != 0)
                    {
                        account = objHmsDataContext.Accounts.Where(accountDetails => (accountDetails.Patient_ID == accountBO.patient_ID && accountDetails.Payment_ID == accountBO.payment_ID)
                                                                   ).First();
                    }
                    else
                    {
                        account = objHmsDataContext.Accounts.Where(accountDetails =>
                                                                   (accountDetails.Patient_ID == accountBO.patient_ID && accountDetails.Bill_ID == accountBO.bill_ID)).First();
                    }

                    Account updatedAccount = ConvertBOToAccount(account, accountBO);

                    objHmsDataContext.SubmitChanges();

                    return("Account updated successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to update account details please try again later ");
            }
        }
        //Method to deactivate patient account, with string return type
        public string DeactivatePatient_DAL(PatientBO patientBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Patient patient = objHmsDataContext.Patients.SingleOrDefault(id => id.Patient_ID == patientBO.pid);

                    patient.IsActive = false;

                    objHmsDataContext.SubmitChanges();

                    return("Account Deactivated Successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to deactive please try again");
            }
        }
        //Method to Activate Patient Account
        public string ActivatePatient_DAL(PatientBO patientBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Patient patient1 = objHmsDataContext.Patients.SingleOrDefault(id => id.Patient_ID == patientBO.pid);

                    patient1.IsActive = true;

                    objHmsDataContext.SubmitChanges();

                    Patient patient2 = objHmsDataContext.Patients.SingleOrDefault(id => id.Patient_ID == patientBO.pid);

                    return(" Account Activated");
                }
            }
            catch (Exception e)
            {
                return("Unable To Activate Account Try again later");
            }
        }
Ejemplo n.º 18
0
        //Method to update LabIncharge details SecurityQuestion, with string return type
        public string UpdateLabInchargeDetails_DAL(LabInchargeBO inchargeBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }


                    LabIncharge labIncharge = objHmsDataContext.LabIncharges.SingleOrDefault(pat => (pat.LabIncharge_ID == inchargeBO.pid || pat.Email_ID == inchargeBO.emailID));

                    LabIncharge updaterLabIncharge = ConvertBOToLabIncharge(labIncharge, inchargeBO);

                    objHmsDataContext.SubmitChanges();

                    return("Successfullly Updated");
                }
            }
            catch (Exception e)
            {
                return("Unable to update Please try once again");
            }
        }
Ejemplo n.º 19
0
        //Method to update Admin details, with return type string
        public string UpdateAdminDetails_DAL(AdministratorBO adminBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }

                    Administrator adminDetails = ObjHmsDataContext.Administrators.SingleOrDefault(admin => (admin.Email_ID == adminBO.emailID ||
                                                                                                            admin.Admin_ID == adminBO.pid));

                    Administrator adminUpdated = ConvertBOToAdmin(adminDetails, adminBO);

                    ObjHmsDataContext.SubmitChanges();


                    return("Successfully Updated");
                }
            }
            catch
            {
                return("Unable to update please try again later");
            }
        }
Ejemplo n.º 20
0
        //Method to insert labincharge details into labincharge table, with return type lab incharge
        public LabInchargeBO InsertInchargeDetails_DAL(LabInchargeBO inchargeBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    {
                        LabIncharge labIncharge = new LabIncharge();
                        inchargeBO.isActive = true;
                        LabIncharge obj_incharge = ConvertBOToLabIncharge(labIncharge, inchargeBO);

                        objHmsDataContext.LabIncharges.InsertOnSubmit(obj_incharge);

                        objHmsDataContext.SubmitChanges();

                        LabInchargeBO labInchargeBO = GetLabInchargeDetials_DAL(inchargeBO);

                        return(labInchargeBO);
                    }
                }
            }
            catch (Exception e)
            {
                LabInchargeBO labInc_BO = new LabInchargeBO();

                return(labInc_BO);
            }
        }
        //Method to delete Appointment, with return type string
        public string DeleteAppointment(AppointmentBO apmntBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Appointment apmnt = objHmsDataContext.Appointments.SingleOrDefault(appmnt => (appmnt.Appointment_ID == apmntBO.appointment_ID &&
                                                                                                  appmnt.Patient_ID == apmntBO.paitent_ID));
                    Appointment converted_Apmnt = ConvertBOToAppt(apmnt, apmntBO);

                    objHmsDataContext.Appointments.DeleteOnSubmit(converted_Apmnt);

                    objHmsDataContext.SubmitChanges();

                    return("Appointment Deleted successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to Delete Appointment Please try again later");
            }
        }
Ejemplo n.º 22
0
        public IEnumerable <LabInchargeBO> UpdateLabIncharge_DAL(LabInchargeBO inchargeBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }


                    LabIncharge labIncharge = objHmsDataContext.LabIncharges.SingleOrDefault(pat => (pat.LabIncharge_ID == inchargeBO.pid || pat.Email_ID == inchargeBO.emailID));

                    LabIncharge updaterLabIncharge = ConvertBOToLabIncharge(labIncharge, inchargeBO);

                    objHmsDataContext.SubmitChanges();

                    return(GetAllLabInchargeDetials_DAL());
                }
            }
            catch (Exception e)
            {
                return(GetAllLabInchargeDetials_DAL());
            }
        }
        //Method to Insert a new report, with report business object as return type and report Business as parameter
        public ReportBO InsertNewReport(ReportBO reportBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    //reportBO.labResult = "Blood test, No signs of Virus";

                    Report report = new Report();

                    Report newReport = ConvertBOToReport(report, reportBO);


                    objHmsDataContext.Reports.InsertOnSubmit(newReport);
                    var a = objHmsDataContext.Appointments.Where(app => app.Appointment_ID == reportBO.appointment_ID).FirstOrDefault();
                    a.RequestedReport = false;
                    //objHmsDataContext.Appointments
                    objHmsDataContext.SubmitChanges();

                    return(GetRecentInsertedReport(reportBO));
                }
            }
            catch (Exception e)
            {
                ReportBO rprtBO = new ReportBO();
                return(rprtBO);
            }
        }
Ejemplo n.º 24
0
        //Method to deactivate LabIncharge account, with string return type
        public string DeactivateLabIncharge_DAL(LabInchargeBO inchargeBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    LabIncharge LabIncharge = objHmsDataContext.LabIncharges.SingleOrDefault(id => (id.LabIncharge_ID == inchargeBO.pid || id.Email_ID == inchargeBO.emailID));

                    LabIncharge.IsActive = false;

                    objHmsDataContext.SubmitChanges();

                    return("Account Deactivated Successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to deactive please try again");
            }
        }
        //Method to delete Report, with string return type and report business object as parameter
        public string DeleteRepoprt(ReportBO reportBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Report report = objHmsDataContext.Reports.SingleOrDefault(rprt => (rprt.Report_ID == reportBO.report_ID));

                    objHmsDataContext.Reports.DeleteOnSubmit(report);

                    objHmsDataContext.SubmitChanges();

                    return("Report Deleted successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to delete report Please try again Later");
            }
        }
Ejemplo n.º 26
0
        //Method to Activate LabIncharge Account
        public string ActivateLabIncharge_DAL(LabInchargeBO inchargeBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    LabIncharge LabIncharge1 = objHmsDataContext.LabIncharges.SingleOrDefault(id => (id.LabIncharge_ID == inchargeBO.pid || id.Email_ID == inchargeBO.emailID));

                    LabIncharge1.IsActive = true;

                    objHmsDataContext.SubmitChanges();

                    LabIncharge LabIncharge2 = objHmsDataContext.LabIncharges.SingleOrDefault(id => id.LabIncharge_ID == inchargeBO.pid);

                    return(" Account Activated");
                }
            }
            catch (Exception e)
            {
                return("Unable To Activate Account Try again later");
            }
        }
        //Method to Delete TreatmentRoom record, wtih string as return type and treatment business object as parameter
        public string DeleteTreatmentRoom(TreatmentRoomBO treatmentRoomBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Treatment_Room treatmentRoom = new Treatment_Room();

                    objHmsDataContext.Treatment_Rooms.DeleteOnSubmit(ConvertBOToTreatmentRoom(treatmentRoom, treatmentRoomBO));

                    objHmsDataContext.SubmitChanges();

                    return("TreatmentRoom details deleted Successfully");
                }
            }
            catch (Exception e)
            {
                return("Unable to Delete treatmentRoom details please try again later");
            }
        }
        //Method to update patient details SecurityQuestion, with string return type
        public string UpdatePatientDetails_DAL(PatientBO patientBO)

        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Patient patient = objHmsDataContext.Patients.SingleOrDefault(pat => (pat.Patient_ID == patientBO.pid || pat.Email_ID == patientBO.emailID));

                    Patient updatedpatient = AssignUpdates(patient, patientBO);

                    objHmsDataContext.SubmitChanges();

                    return("Successfullly Updated");
                }
            }
            catch
            {
                return("");
            }
        }
        public TreatmentRoomBO InsertTreatmentRoomRec(TreatmentRoomBO treatmentRoomBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    TreatmentRoom_Record trmntRoom = new TreatmentRoom_Record();

                    objHmsDataContext.TreatmentRoom_Records.InsertOnSubmit(ConvertBOToTreatmentRoomRec(trmntRoom, treatmentRoomBO));
                    objHmsDataContext.SubmitChanges();

                    TreatmentRoom_Record newtrmntRoom = objHmsDataContext.TreatmentRoom_Records.SingleOrDefault(trmntroom => (trmntroom.Room_ID == treatmentRoomBO.room_ID && trmntroom.DateOfJoin == treatmentRoomBO.date));

                    return(ConvertTrmtRmRecToBO(newtrmntRoom));
                }
            }
            catch (Exception e)
            {
                TreatmentRoomBO treatmentRoom_BO = new TreatmentRoomBO();
                return(treatmentRoom_BO);
            }
        }
        //Method to insert patient details into patient table, with return type patient Business object
        public PatientBO InsertPatientDetails_DAL(PatientBO patientBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }
                    {
                        Patient patient     = new Patient();
                        Patient obj_patient = ConvertBOToPatient(patient, patientBO);
                        obj_patient.IsActive = true;
                        objHmsDataContext.Patients.InsertOnSubmit(obj_patient);

                        objHmsDataContext.SubmitChanges();

                        Patient newPatient = objHmsDataContext.Patients.SingleOrDefault(pat => pat.Email_ID == patientBO.emailID);

                        PatientBO new_Patient = ConvertPatientToBO(newPatient);

                        return(new_Patient);
                    }
                }
            }
            catch (Exception e)
            {
                PatientBO patient_BO = new PatientBO();

                return(patient_BO);
            }
        }