public IEnumerable <LabInchargeBO> GetAllLabInchargeDetials_DAL() { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <LabInchargeBO> LabInchargeInfo = objHmsDataContext.LabIncharges.Select(incharge => new LabInchargeBO { pid = incharge.LabIncharge_ID, firstName = incharge.First_Name, lastName = incharge.Last_Name, pwd = incharge.Password, address = incharge.Address, emailID = incharge.Email_ID, dateOfBirth = incharge.DateOfBirth, gender = incharge.Gender, isActive = incharge.IsActive, phone = incharge.Phone, securityAns = incharge.Security_Answer, securityQn = incharge.Security_Question }).ToArray(); return(LabInchargeInfo); } } catch (Exception e) { return(null); } }
public IEnumerable <TreatmentRoomBO> GetRoomsRecordsByPatID(PatientBO pat) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <TreatmentRoomBO> treatmentRoom; treatmentRoom = objHmsDataContext.TreatmentRoom_Records .Join(objHmsDataContext.Patients, t => t.Patient_ID, p => p.Patient_ID, (t, p) => new TreatmentRoomBO { patient_ID = t.Patient_ID, timings = Convert.ToString(t.Timings), isBooked = t.IsBooked, date = t.DateOfJoin, room_ID = t.Room_ID, appointment_ID = t.Appointment_ID, PatientFirstName = p.First_Name }).Where(t => (t.patient_ID == pat.pid)).ToArray(); return(treatmentRoom); } } catch (Exception e) { IEnumerable <TreatmentRoomBO> trmntRoomBO = null; return(trmntRoomBO); } }
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); } }
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); } }
public ReportBO GetReportsByAppt(int id) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } var re = objHmsDataContext.Reports.Where(rprt => (rprt.Appointment_ID == id)).ToList(); var reportDetails = ConvertReportToBO(re.Last()); reportDetails.patientFirstName = objHmsDataContext.Patients.Where(p => p.Patient_ID == reportDetails.patient_ID) .Select(pat => pat.First_Name).First(); if (reportDetails != null) { reportDetails.reportRequested = objHmsDataContext.Appointments.Where(a => a.Appointment_ID == reportDetails.appointment_ID).Select(r => r.RequestedReportNotes).First(); } return(reportDetails); } } catch (Exception e) { ReportBO report_BO = new ReportBO(); return(report_BO); } }
public IEnumerable <NotificationsBO> GetAllNotifications_DAL(NotificationsBO manageNotifications) { try { HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString); if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } var date7Days = DateTime.Now.AddDays(-7); var Notifications = ObjHmsDataContext.Notifications.Where(n => (n.Admin_ID == manageNotifications.AdminID && n.Created_DateTime >= date7Days)).Select(noti => new NotificationsBO { ID = noti.Id, AdminID = noti.Admin_ID, UserRoleID = noti.UserRole_ID, Notifications = noti.Notification1, Created_DateTime = noti.Created_DateTime, Expiry = noti.Expires_DateTime }).ToArray(); return(Notifications); } catch { 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 IEnumerable <int> GetPaitentsListByDate(AppointmentBO app) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <int> patientsList = objHmsDataContext.Patients.Distinct().Select(p => p.Patient_ID).ToArray(); // IEnumerable<int> patients = objHmsDataContext.Appointments.Where(a =>a.Appointment_Date == app.appointment_Date && a.); //foreach () //{ //} return(patientsList); } } catch (Exception e) { return(null); } }
public IEnumerable <PatientBO> GetPatientDetialsByID(PatientBO patientBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <PatientBO> patientInfo = objHmsDataContext.Patients.Where(pat => (pat.Patient_ID == patientBO.pid)) .Select(p => new PatientBO { firstName = p.First_Name, lastName = p.Last_Name, address = p.Address, phone = p.Phone, emailID = p.Email_ID, pwd = p.Password, gender = p.Gender, dateOfBirth = p.DateOfBirth, patientType = ConvertStingToPatType(p), pid = p.Patient_ID, isActive = p.IsActive }).ToArray(); return(patientInfo); } } catch (Exception e) { return(null); } }
//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"); } }
//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); } }
//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(""); } }
//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"); } }
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); } }
//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); } }
public bool checkAppointemnt(AppointmentBO apmnt) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Appointment appointment = new Appointment(); Appointment appointmentUpdate = ConvertBOToAppt(appointment, apmnt); var checkExistingAppointments = objHmsDataContext.Appointments.Select(checkApmnt => (checkApmnt.Doctor_ID == apmnt.doctor_ID && checkApmnt.Patient_ID == apmnt.paitent_ID && checkApmnt.Appointment_Date == apmnt.appointment_Date && checkApmnt.Timings == apmnt.timings)); if (checkExistingAppointments != null) { return(true); } return(false); } } catch { return(false); } }
//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"); } }
//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); } }
public IEnumerable <NurseBO> GetAllNurses_DAL() { try { IEnumerable <NurseBO> allPatientsBO = null; using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } allPatientsBO = ObjHmsDataContext.Nurses.Select(patnts => new NurseBO { pid = patnts.Nurse_ID, firstName = patnts.First_Name, lastName = patnts.Last_Name, emailID = patnts.Email_ID, gender = patnts.Gender, dateOfBirth = patnts.DateOfBirth, address = patnts.Address, phone = patnts.Phone, isActive = patnts.IsActive, }).ToArray(); return(allPatientsBO); } } catch { IEnumerable <NurseBO> allNursesBO = null; return(allNursesBO); } }
//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"); } }
public AppointmentBO GetAppointmentByID(AppointmentBO appointmentBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } AppointmentBO apmntBO = objHmsDataContext.Appointments.Where(apmnt => (apmnt.Appointment_ID == appointmentBO.appointment_ID)) .Join(objHmsDataContext.Patients, a => a.Patient_ID, p => p.Patient_ID, (a, p) => new AppointmentBO { appointment_ID = a.Appointment_ID, patientName = p.First_Name, paitent_ID = a.Patient_ID, appointment_Date = a.Appointment_Date, timings = a.Timings, doctor_ID = a.Doctor_ID, }).First(); return(apmntBO); } } catch (Exception e) { AppointmentBO app_BO = new AppointmentBO(); return(app_BO); } }
//View by Incharge ID public IEnumerable <ReportBO> ViewAllReports(ReportBO reportBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } IEnumerable <ReportBO> report = objHmsDataContext.Reports.Join(objHmsDataContext.Patients, p => p.Patient_ID, r => r.Patient_ID, (r, p) => new ReportBO { appointment_ID = r.Appointment_ID, patient_ID = r.Patient_ID, labResult = r.Lab_Result, date = r.Report_Date, report_ID = r.Report_ID, reportTime = Convert.ToString(r.Report_Time), patientFirstName = p.First_Name }).ToList(); return(report); } } catch (Exception e) { IEnumerable <ReportBO> report_BO = null; return(report_BO); } }
public IEnumerable <AppointmentBO> GetAppointmentsWithNoBilling() { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } List <int> appts = objHmsDataContext.Appointments.Where(a => a.Cancelled == false).Select(a => a.Appointment_ID).ToList(); List <int> accBO = objHmsDataContext.Accounts.Select(a => a.Appointment_ID).ToList(); appts = appts.Except(accBO).ToList(); List <AppointmentBO> result = new List <AppointmentBO>(); AppointmentBO app = new AppointmentBO(); foreach (var a in appts) { app.appointment_ID = a; var r = GetAppointmentByID(app); result.Add(r); } return(result); } } catch (Exception e) { IEnumerable <AppointmentBO> app_BO = null; return(app_BO); } }
//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 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"; } }
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); } }
//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"); } }
public TreatmentRoomBO CheckAvailabilityTreatmentRoom(TreatmentRoomBO treatmentRoomBO) { try { using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { objHmsDataContext.Connection.Open(); } Treatment_Room trmntRoom = new Treatment_Room(); // objHmsDataContext.Treatment_Rooms.InsertOnSubmit(ConvertBOToTreatmentRoom(trmntRoom, treatmentRoomBO)); //if (objHmsDataContext.Treatment_Rooms.Where(trmntroom => (trmntroom.Room_ID == treatmentRoomBO.room_ID && trmntroom.DateOfJoin == treatmentRoomBO.date && trmntroom.IsBooked == true)).FirstOrDefault()) //{ //} TreatmentRoomBO newtrmntRoom = objHmsDataContext.Treatment_Rooms.Where(trmntroom => (trmntroom.Room_ID == treatmentRoomBO.room_ID && trmntroom.DateOfJoin == treatmentRoomBO.date && trmntroom.IsBooked == true)).Select(t => new TreatmentRoomBO { timings = Convert.ToString(t.Timings) }).First(); return(newtrmntRoom); } } catch (Exception e) { return(null); } }
//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"); } }