//Method to get doctor details, with return type doctor business object public DoctorBO GetDoctorDetails_DAL(DoctorBO doctorBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } Doctor doctor_Details = null; //if (doctorBO.emailID != null) { doctor_Details = ObjHmsDataContext.Doctors.Where(id => (id.Email_ID == doctorBO.emailID || id.Doctor_ID == doctorBO.pid)).FirstOrDefault(); } //else { //doctor_Details = ObjHmsDataContext.Doctors. // } DoctorBO doctor_BO = ConvertDoctorToBO(doctor_Details); return(doctor_BO); } } catch (Exception e) { DoctorBO doctor_Empty = new DoctorBO(); return(doctor_Empty); } }
//Method to Activate Doctor Account, with return type string public string Activate_DAL(DoctorBO doctorBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } Doctor doctor = ObjHmsDataContext.Doctors.SingleOrDefault(dctr => (dctr.Email_ID == doctorBO.emailID || dctr.Doctor_ID == doctorBO.pid)); doctor.IsActive = true; ObjHmsDataContext.SubmitChanges(); return("Account Activated Successfully"); } } catch (Exception e) { return("Unable to Activate Account"); } }
//Method to update doctor details,with return type string public string UpdateDoctorDetails_DAL(DoctorBO doctorBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } Doctor doctor = ObjHmsDataContext.Doctors.SingleOrDefault(dctr => dctr.Email_ID == doctorBO.emailID || dctr.Doctor_ID == doctorBO.pid); Doctor doctor_Details = ConvertBOToDoctor(doctor, doctorBO); ObjHmsDataContext.SubmitChanges(); return("Successfully updated"); } } catch { return("Unable to update Doctor Details please try again later"); } }
public IEnumerable <DoctorBO> GetDoctorById(DoctorBO docBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } var val = ObjHmsDataContext.Doctors.Where(d => d.Doctor_ID == docBO.pid) .Select(x => new DoctorBO { firstName = x.First_Name, lastName = x.Last_Name, gender = x.Gender, address = x.Address, isActive = x.IsActive, dateOfBirth = x.DateOfBirth, pid = x.Doctor_ID, emailID = x.Email_ID, pwd = x.Password, phone = x.Phone, drDesignation = (DoctorBO.DrDesignation)ConvertStringToEnumDesign(x.Designation), drDepartment = (DoctorBO.DrDepartment)ConvertStringToEnumDept(x.Department) }).ToList(); return(val); } } catch (Exception ex) { throw new Exception("Unable to Fetch Doctors List"); } }
public IEnumerable <DoctorBO> GetDoctorById(DoctorBO doctorBO) { DoctorBLLFactory getDoctors = new DoctorBLLFactory(); var val = getDoctors.CreateDoctorBLL().GetDoctorsListBLL().CreateDoctorDAL().GetDoctorById(doctorBO); return(val); }
public void Put(int id, [FromBody] DoctorBO doctorBO) { DoctorBLLFactory doctorBLLFactory = new DoctorBLLFactory(); string updateDoctor = doctorBLLFactory.CreateDoctorBLL().UpdateDoctorDetailsBLL().CreateDoctorDAL().UpdateDoctorDetails_DAL(doctorBO); string deactivate = doctorBLLFactory.CreateDoctorBLL().DeActivateDoctorBLL().CreateDoctorDAL().DeActivate_DAL(doctorBO); string activate = doctorBLLFactory.CreateDoctorBLL().ActivateDoctorBLL().CreateDoctorDAL().Activate_DAL(doctorBO); }
public string UserForgotPassword(Person _person) { var result = ""; if (_person.pid == 1) { AdministratorBLLFactory admin = new AdministratorBLLFactory(); AdministratorBO adminBO = new AdministratorBO(); adminBO.emailID = _person.emailID; result = admin.CreateAdministratorBLL().ValidateAdminBLL().CreateAdminstratorDAL().ValidateEmailAdmin_DAL(_person.emailID); } else if (_person.pid == 2) { PatientBLLFactory patient = new PatientBLLFactory(); PatientBO patientBO = new PatientBO(); patientBO.emailID = _person.emailID; result = patient.CreatePatientBLL().ValidatePatientBLL().CreatePatientDAL().ValidateEmailPatient_DAL(patientBO); } else if (_person.pid == 3) { DoctorBLLFactory doctor = new DoctorBLLFactory(); DoctorBO doctorBO = new DoctorBO(); doctorBO.emailID = _person.emailID; result = doctor.CreateDoctorBLL().ValidateDoctorBLL().CreateDoctorDAL().ValidateEmailDoctor_DAL(doctorBO); } else if (_person.pid == 4) { NurseBLLFactory nurse = new NurseBLLFactory(); NurseBO nurseBO = new NurseBO(); nurseBO.emailID = _person.emailID; result = nurse.CreateNurseBLL().ValidateNurse().CreateNurseDAL().ValidateNurse_DAL(nurseBO); } else if (_person.pid == 5) { LabInchargeBLLFactory incharge = new LabInchargeBLLFactory(); LabInchargeBO inchargeBO = new LabInchargeBO(); inchargeBO.emailID = _person.emailID; result = incharge.CreateLabInchargeBLL().ValidateLabInchargeBLL().CreateLabInchargeDAL().ValidateLabIncharge_DAL(inchargeBO); } if ((result) != "false" && result != "" && result != null) { EmailController email = new EmailController(); email.SendForgotPasswordEmail(result, _person.emailID); return("Sent Password to Email"); } else { return("User Do not exist"); } }
public string RegisterNewDoctor(DoctorBO doctorBO) { DoctorBLLFactory insertDoctor = new DoctorBLLFactory(); DoctorBO newDoctor = insertDoctor.CreateDoctorBLL().InsertNewDoctorBLL().CreateDoctorDAL().InsertNewDoctor_DAL(doctorBO); if (newDoctor.pid != 0) { return("Your new User ID " + Convert.ToString(newDoctor.pid) + "- Login Using this UserID"); } return("Email ID is already Used by other User, try using other EmailID"); }
public IEnumerable <DoctorBO> UpdateDoctor_DAL(DoctorBO updateDoctorDetails) { DoctorDAL doctorDAL = new DoctorDAL(); var result = doctorDAL.UpdateDoctorDetails_DAL(updateDoctorDetails); if (result != "") { return(GetAllDoctors_DAL()); } //IEnumerable<PatientBO> emptyPatientsBO = ; return(null); }
public DoctorBO GetDocDetails(int id, string pwd) { DoctorBO doctorBO = new DoctorBO(); doctorBO.pid = id; doctorBO.pwd = pwd; DoctorBLLFactory getDoctorDetails = new DoctorBLLFactory(); doctorBO = getDoctorDetails.CreateDoctorBLL().GetDoctorDetailsBLL().CreateDoctorDAL().GetDoctorDetails_DAL(doctorBO); return(doctorBO); }
public string GetUserName(int id) { string response = "No Name"; if (id > 3000 && id < 4000) { NurseBO nurseBo = new NurseBO(); nurseBo.pid = id; NurseBLLFactory validatenurseBLLFactory = new NurseBLLFactory(); var NurseDetails = validatenurseBLLFactory.CreateNurseBLL().ValidateNurse().CreateNurseDAL().GetAllNurses_DAL().Where(d => d.pid == id).FirstOrDefault(); return(NurseDetails.firstName); } else if (id > 4000 && id < 5000) { LabInchargeBO inchargeBo = new LabInchargeBO(); inchargeBo.pid = id; LabInchargeBLLFactory validateInchargeBLLFacotry = new LabInchargeBLLFactory(); var inchargeDetails = validateInchargeBLLFacotry.CreateLabInchargeBLL().ValidateLabInchargeBLL().CreateLabInchargeDAL().GetAllLabInchargeDetials_DAL().Where(d => d.pid == id).FirstOrDefault(); return(inchargeDetails.firstName); } else if (id > 5000 && id < 6000) { DoctorBO doctorBO = new DoctorBO(); doctorBO.pid = id; DoctorBLLFactory doctorBLLFactory = new DoctorBLLFactory(); return(doctorBLLFactory.CreateDoctorBLL().ValidateDoctorBLL().CreateDoctorDAL().GetDoctorDetails_DAL(doctorBO).firstName); } else if (id > 6000 && id < 7000) { AdministratorBO adminBO = new AdministratorBO(); adminBO.pid = id; AdministratorBLLFactory adminBLLFactory = new AdministratorBLLFactory(); return(adminBLLFactory.CreateAdministratorBLL().ValidateAdminBLL().CreateAdminstratorDAL().GetAdminDetailsByID_DAL(adminBO).firstName); } else if (id > 7000 && id < 8000) { PatientBO patientBO = new PatientBO(); patientBO.pid = id; PatientBLLFactory patientBLLFactory = new PatientBLLFactory(); return(patientBLLFactory.CreatePatientBLL().ValidatePatientBLL().CreatePatientDAL().GetPatientDetialsByID(patientBO).FirstOrDefault().firstName); } return(response); }
//Method to validate, with return type string public string ValidateDoctor_DAL(DoctorBO doctorBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } bool validation = ObjHmsDataContext.Doctors.Where(d => (d.Doctor_ID == doctorBO.pid && d.Password == doctorBO.pwd)).Select(d => d.IsActive).SingleOrDefault(); return(Convert.ToString(validation)); } } catch (Exception ex) { return("Unable to Validate now please try again later"); } }
//Method to Check Availability of EmailID, with return type string public string CheckAvailability_DAL(DoctorBO doctorBO) { try { using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } var checkAvailablity = (from doctors in ObjHmsDataContext.Doctors select doctors.Email_ID == doctorBO.emailID ).SingleOrDefault(); return(checkAvailablity.ToString()); } } catch { return("Unable to check availability"); } }
//Method To convert Doctor to DoctorBO public DoctorBO ConvertDoctorToBO(Doctor doctor) { try { DoctorBO doctorBO = new DoctorBO(doctor.Doctor_ID, doctor.First_Name, doctor.Last_Name, doctor.Email_ID, doctor.Password, doctor.DateOfBirth, doctor.Security_Question, doctor.Security_Answer, doctor.Phone, doctor.Address, doctor.Gender, doctor.IsActive, (DoctorBO.DrDesignation)ConvertStringToEnumDesign(doctor.Designation), (DoctorBO.DrDepartment)ConvertStringToEnumDept(doctor.Department)); if (!string.IsNullOrEmpty(doctor.Security_Question) && !string.IsNullOrEmpty(doctorBO.securityQn)) { doctorBO.securityQn = doctor.Security_Question; } return(doctorBO); } catch (Exception e) { DoctorBO doctor_BO = new DoctorBO(); return(doctor_BO); } }
//funtion to register new doctor, with return type doctor business object public DoctorBO InsertNewDoctor_DAL(DoctorBO doctorBO) { try { Doctor doctor = new Doctor(); Doctor doctor_new = ConvertBOToDoctor(doctor, doctorBO); using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } doctor_new.IsActive = true; ObjHmsDataContext.Doctors.InsertOnSubmit(doctor_new); ObjHmsDataContext.SubmitChanges(); DoctorBO doctor_Details = GetDoctorDetails_DAL(doctorBO); if (doctor_Details != null) { return(doctor_Details); } else { DoctorBO doctor_BO = new DoctorBO(); return(doctor_BO); } } } catch (Exception e) { DoctorBO doctor_BO = new DoctorBO(); return(doctor_BO); } }
public string ValidateEmailDoctor_DAL(DoctorBO doctorBO) { try { var validation = "false"; using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString)) { if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed) { ObjHmsDataContext.Connection.Open(); } validation = (from doctors in ObjHmsDataContext.Doctors where ((doctors.Email_ID == doctorBO.emailID)) select doctors.Password).SingleOrDefault(); return(Convert.ToString(validation)); } } catch (Exception ex) { return(""); } }
public int Authenticate(int id, string pwd) { int response = -1; if (id > 3000 && id < 4000) { NurseBO nurseBo = new NurseBO(); nurseBo.pid = id; nurseBo.pwd = pwd; NurseBLLFactory validatenurseBLLFactory = new NurseBLLFactory(); string validateNurse = validatenurseBLLFactory.CreateNurseBLL().ValidateNurse().CreateNurseDAL().ValidateNurse_DAL(nurseBo); if (validateNurse.Equals("True")) { response = 1; } else if (validateNurse.Equals("False")) { response = 0; } } else if (id > 4000 && id < 5000) { LabInchargeBO inchargeBo = new LabInchargeBO(); inchargeBo.pid = id; inchargeBo.pwd = pwd; LabInchargeBLLFactory validateInchargeBLLFacotry = new LabInchargeBLLFactory(); string validateIncharge = validateInchargeBLLFacotry.CreateLabInchargeBLL().ValidateLabInchargeBLL().CreateLabInchargeDAL().ValidateLabIncharge_DAL(inchargeBo); if (validateIncharge.Equals("True")) { response = 2; } else if (validateIncharge.Equals("False")) { response = 0; } } else if (id > 5000 && id < 6000) { DoctorBO doctorBO = new DoctorBO(); doctorBO.pid = id; doctorBO.pwd = pwd; DoctorBLLFactory doctorBLLFactory = new DoctorBLLFactory(); string validateDoctor = doctorBLLFactory.CreateDoctorBLL().ValidateDoctorBLL().CreateDoctorDAL().ValidateDoctor_DAL(doctorBO); if (validateDoctor.Equals("True")) { response = 3; } else if (validateDoctor.Equals("False")) { response = 0; } } else if (id > 6000 && id < 7000) { AdministratorBO adminBO = new AdministratorBO(); adminBO.pid = id; adminBO.pwd = pwd; AdministratorBLLFactory adminBLLFactory = new AdministratorBLLFactory(); string validateAdmin = adminBLLFactory.CreateAdministratorBLL().ValidateAdminBLL().CreateAdminstratorDAL().ValidateAdmin_DAL(adminBO); if (validateAdmin.Equals("True")) { response = 4; } else if (validateAdmin.Equals("False")) { response = 0; } } else if (id > 7000 && id < 8000) { PatientBO patientBO = new PatientBO(); patientBO.pid = id; patientBO.pwd = pwd; PatientBLLFactory patientBLLFactory = new PatientBLLFactory(); string validatePatient = patientBLLFactory.CreatePatientBLL().ValidatePatientBLL().CreatePatientDAL().ValidatePatient_DAL(patientBO); if (validatePatient.Equals("True")) { response = 5; } else if (validatePatient.Equals("False")) { response = 0; } } return(response); }
public IEnumerable <DoctorBO> UpdateDoctor(DoctorBO updateDoctor) { AdministratorBLLFactory adminBLLFactory = new AdministratorBLLFactory(); return(adminBLLFactory.CreateAdministratorBLL().UpdatePatientDetailsBLL().CreateAdminstratorDAL().UpdateDoctor_DAL(updateDoctor)); }
public void InsertNewDoctor(DoctorBO doctorBO) { DoctorBLLFactory insertDoctor = new DoctorBLLFactory(); DoctorBO newDoctor = insertDoctor.CreateDoctorBLL().InsertNewDoctorBLL().CreateDoctorDAL().InsertNewDoctor_DAL(doctorBO); }
//funtion to convert DoctorBO to Doctor public Doctor ConvertBOToDoctor(Doctor doctor, DoctorBO doctorBO) { if (doctorBO.pid != 0) { doctor.Doctor_ID = doctorBO.pid; } if (!string.IsNullOrEmpty(doctorBO.firstName)) { doctor.First_Name = doctorBO.firstName; } if (!string.IsNullOrEmpty(doctorBO.lastName)) { doctor.Last_Name = doctorBO.lastName; } if (!string.IsNullOrEmpty(Convert.ToString(doctorBO.drDepartment))) { doctor.Department = Convert.ToString(doctorBO.drDepartment); } if (!string.IsNullOrEmpty(Convert.ToString(doctorBO.drDesignation))) { doctor.Designation = Convert.ToString(doctorBO.drDesignation); } if (!string.IsNullOrEmpty(doctorBO.emailID)) { doctor.Email_ID = doctorBO.emailID; } if (!string.IsNullOrEmpty(doctorBO.pwd)) { doctor.Password = doctorBO.pwd; } if (!string.IsNullOrEmpty(doctorBO.gender)) { doctor.Gender = doctorBO.gender; } if (doctorBO.dateOfBirth != DateTime.MinValue) { doctor.DateOfBirth = doctorBO.dateOfBirth; } if (!string.IsNullOrEmpty(doctorBO.phone)) { doctor.Phone = doctorBO.phone; } if (!string.IsNullOrEmpty(doctorBO.address)) { doctor.Address = doctorBO.address; } if (!string.IsNullOrEmpty(doctorBO.securityQn)) { doctor.Security_Question = doctorBO.securityQn; } if (!string.IsNullOrEmpty(doctorBO.securityAns)) { doctor.Security_Answer = doctorBO.securityAns; } { doctor.IsActive = doctorBO.isActive; } return(doctor); }
public IEnumerable <ReportBO> ViewAllReportsByDoctor(DoctorBO doctor) { LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory(); return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().GetAllPatientsReports_DAL()); }
public IEnumerable <AppointmentBO> GetDoctorAppointments(DoctorBO doctor) { DoctorBLLFactory docBLLFactory = new DoctorBLLFactory(); return(docBLLFactory.CreateDoctorBLL().GetDocAppointments().CreateDoctorDAL().GetDocAppointments(doctor.pid)); }