コード例 #1
0
        //funtion to register new nurse, with nurse BO as return type
        public NurseBO InsertNurseDetails_DAL(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Nurse objNurse = new Nurse();
                    nurseBO.isActive = true;
                    objHmsDataContext.Nurses.InsertOnSubmit(ConvertBoTONurse(objNurse, nurseBO));

                    objHmsDataContext.SubmitChanges();

                    Nurse nurse = objHmsDataContext.Nurses.SingleOrDefault(newnurse => (newnurse.Email_ID == nurseBO.emailID ||
                                                                                        newnurse.Nurse_ID == nurseBO.pid));

                    return(ConvertNurseToBO(nurse));
                }
            }
            catch (Exception e)
            {
                NurseBO nurse_BO = new NurseBO();
                return(nurse_BO);
            }
        }
コード例 #2
0
        //funtion to activate Account, with return type string
        public string ActivateAccount_DAL(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }

                    Nurse nurse_Activate = ObjHmsDataContext.Nurses.SingleOrDefault(nrse => (nrse.Email_ID == nurseBO.emailID ||
                                                                                             nrse.Nurse_ID == nurseBO.pid));


                    nurse_Activate.IsActive = true;

                    ObjHmsDataContext.SubmitChanges();

                    return("Successfully Account Activated");
                }
            }
            catch (Exception e)
            {
                return("Unable to activate Account, please try once again");
            }
        }
コード例 #3
0
        public IEnumerable <NurseBO> UpdateNurseDetails_DAL(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }
                    Nurse nurse = ObjHmsDataContext.Nurses.SingleOrDefault(nrse => (nrse.Email_ID == nurseBO.emailID ||
                                                                                    nrse.Nurse_ID == nurseBO.pid));

                    Nurse nurseDetails = ConvertBoTONurse(nurse, nurseBO);

                    ObjHmsDataContext.SubmitChanges();

                    return(GetAllNurses_DAL());
                }
            }
            catch (Exception e)
            {
                return(GetAllNurses_DAL());
            }
        }
コード例 #4
0
        //Method to updateDetails, with return type string
        public string UpdateDetails_DAL(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (ObjHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        ObjHmsDataContext.Connection.Open();
                    }
                    Nurse nurse = ObjHmsDataContext.Nurses.SingleOrDefault(nrse => (nrse.Email_ID == nurseBO.emailID ||
                                                                                    nrse.Nurse_ID == nurseBO.pid));

                    Nurse nurseDetails = ConvertBoTONurse(nurse, nurseBO);

                    ObjHmsDataContext.SubmitChanges();

                    return("Successfully Updated");
                }
            }
            catch (Exception e)
            {
                return("Unable to Update Please try once again");
            }
        }
コード例 #5
0
        // PUT: api/Nurse/5
        //Put action, which accepts int and nurse Business object as parameters and void as return type
        public void Put(int id, [FromBody] NurseBO nurseBO)
        {
            NurseBLLFactory nurseBLLFactory = new NurseBLLFactory();

            string nurse = nurseBLLFactory.CreateNurseBLL().UpdateNurseDetailsBLL().CreateNurseDAL().UpdateDetails_DAL(nurseBO);

            string activateNurse = nurseBLLFactory.CreateNurseBLL().ActivateNurseBLL().CreateNurseDAL().ActivateAccount_DAL(nurseBO);

            string deactivateNurse = nurseBLLFactory.CreateNurseBLL().DeActivateNurseBLL().CreateNurseDAL().DeActivateAccount_DAL(nurseBO);
        }
コード例 #6
0
        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");
            }
        }
コード例 #7
0
        // GET: api/Nurse/5
        //Get action which accepts int and string as parameters, with nurse business object as return type
        public NurseBO Get(int id, string pwd)
        {
            NurseBLLFactory nurseBLLFactory = new NurseBLLFactory();

            NurseBO nurseBO = new NurseBO();

            nurseBO.pid = id;
            nurseBO.pwd = pwd;

            nurseBO = nurseBLLFactory.CreateNurseBLL().GetNurseDetails().CreateNurseDAL().GetNurseDetails_DAL(nurseBO);
            return(nurseBO);
        }
コード例 #8
0
        public string RegisterNewNurse(NurseBO nurseBO)
        {
            NurseBLLFactory nurseBLLFactory = new NurseBLLFactory();

            NurseBO nurse_BO = nurseBLLFactory.CreateNurseBLL().InsertNewNurseBLL().CreateNurseDAL().InsertNurseDetails_DAL(nurseBO);

            if (nurse_BO.pid != 0)
            {
                return("Your new User ID " + Convert.ToString(nurse_BO.pid) + " - Login Using this UserID");
            }
            return("Email ID is already Used by other User, try using other EmailID");
        }
コード例 #9
0
        //funtion to convert Nurse to NurseBO
        public NurseBO ConvertNurseToBO(Nurse nurse)
        {
            NurseBO nurseBO = new NurseBO(nurse.Nurse_ID, nurse.First_Name, nurse.Last_Name, nurse.Email_ID,
                                          nurse.Password, nurse.DateOfBirth, nurse.Security_Question, nurse.Security_Answer,
                                          nurse.Phone, nurse.Address, nurse.Gender, nurse.IsActive);

            if (!string.IsNullOrEmpty(nurse.Security_Question))
            {
                nurseBO.securityQn = nurse.Security_Question;
            }

            return(nurseBO);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        public string ValidateEmailNurse_DAL(NurseBO nurseBO)
        {
            try
            {
                var validation = "false";
                HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString);

                validation = (from nurse in ObjHmsDataContext.Nurses
                              where (nurse.Nurse_ID == nurseBO.pid && nurse.Password == nurseBO.pwd)
                              select nurse.Password).FirstOrDefault();
                return(validation.ToString());
            }
            catch (Exception e)
            {
                return("");
            }
        }
コード例 #12
0
        //funtion to validate Account Login, with return type string
        public string ValidateNurse_DAL(NurseBO nurseBO)
        {
            try
            {
                HospitalManagementSystemDataContext ObjHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString);

                bool validation = (from nurse in ObjHmsDataContext.Nurses
                                   where (nurse.Nurse_ID == nurseBO.pid && nurse.Password == nurseBO.pwd) ||
                                   (nurse.Email_ID == nurseBO.emailID && nurse.Password == nurseBO.pwd)
                                   select nurse.IsActive).FirstOrDefault();
                return(validation.ToString());
            }
            catch (Exception e)
            {
                return("unable to process validation please try again later");
            }
        }
コード例 #13
0
        //funtion to check availability, with return type, string
        public string CheckAvailability(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    bool availability = (from nurse in objHmsDataContext.Nurses
                                         select nurse.Email_ID == nurseBO.emailID).SingleOrDefault();

                    return(Convert.ToString(availability));
                }
            }
            catch (Exception e)
            {
                return("Unable to chexk email Availability");
            }
        }
コード例 #14
0
        //funtion to get complete details by id, with return type Nurse Business object
        public NurseBO GetNurseDetails_DAL(NurseBO nurseBO)
        {
            try
            {
                using (HospitalManagementSystemDataContext objHmsDataContext = new HospitalManagementSystemDataContext(Utils.ConnectionString))
                {
                    if (objHmsDataContext.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        objHmsDataContext.Connection.Open();
                    }

                    Nurse nurseDetails = objHmsDataContext.Nurses.SingleOrDefault(nurse => ((nurse.Nurse_ID == nurseBO.pid || nurse.Email_ID == nurseBO.emailID) && (nurse.Password == nurseBO.pwd)));

                    return(ConvertNurseToBO(nurseDetails));
                }
            }
            catch (Exception e)
            {
                NurseBO emptyBO = null;

                return(emptyBO);
            }
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        public IEnumerable <NurseBO> UpdateNurse(NurseBO nurseBO)
        {
            NurseBLLFactory nurseBLLFactory = new NurseBLLFactory();

            return(nurseBLLFactory.CreateNurseBLL().UpdateNurseDetailsBLL().CreateNurseDAL().UpdateNurseDetails_DAL(nurseBO));
        }
コード例 #17
0
        //Method to convert NurseBO to Nurse
        public Nurse ConvertBoTONurse(Nurse objNurse, NurseBO nurseBO)
        {
            if (nurseBO.pid != 0)
            {
                objNurse.Nurse_ID = nurseBO.pid;
            }

            if (!string.IsNullOrEmpty(nurseBO.firstName))
            {
                objNurse.First_Name = nurseBO.firstName;
            }

            if (!string.IsNullOrEmpty(nurseBO.lastName))
            {
                objNurse.Last_Name = nurseBO.lastName;
            }

            if (!string.IsNullOrEmpty(nurseBO.lastName))
            {
                objNurse.Email_ID = nurseBO.emailID;
            }

            if (!string.IsNullOrEmpty(nurseBO.pwd))
            {
                objNurse.Password = nurseBO.pwd;
            }

            if (nurseBO.dateOfBirth != DateTime.MinValue)
            {
                objNurse.DateOfBirth = nurseBO.dateOfBirth;
            }

            if (!string.IsNullOrEmpty(nurseBO.phone))
            {
                objNurse.Phone = nurseBO.phone;
            }

            if (!string.IsNullOrEmpty(nurseBO.gender))
            {
                objNurse.Gender = nurseBO.gender;
            }

            if (!string.IsNullOrEmpty(nurseBO.address))
            {
                objNurse.Address = nurseBO.address;
            }

            if (!string.IsNullOrEmpty(nurseBO.securityQn))
            {
                objNurse.Security_Question = nurseBO.securityQn;
            }

            if (!string.IsNullOrEmpty(nurseBO.securityAns))
            {
                objNurse.Security_Answer = nurseBO.securityAns;
            }

            {
                objNurse.IsActive = nurseBO.isActive;
            }

            return(objNurse);
        }
コード例 #18
0
        // POST: api/Nurse
        //Post action which accepts nurse buisness object as parameter and void as return type
        public void Post([FromBody] NurseBO nurseBO)
        {
            NurseBLLFactory nurseBLLFactory = new NurseBLLFactory();

            NurseBO nurse_BO = nurseBLLFactory.CreateNurseBLL().InsertNewNurseBLL().CreateNurseDAL().InsertNurseDetails_DAL(nurseBO);
        }