public IEnumerable <int> GetPaitentsListByDate(AppointmentBO app)
        {
            PatientBLLFactory patientBBLFactory = new PatientBLLFactory();
            var patientsList = patientBBLFactory.CreatePatientBLL().GetPatientBLL().CreatePatientDAL().GetPatientsList();

            return(patientsList);
        }
예제 #2
0
        public void SendAppCancelledEmail(List <AppointmentBO> cancelledAppts)
        {
            try
            {
                foreach (var p in cancelledAppts)
                {
                    PatientBO pat = new PatientBO();
                    pat.pid = p.paitent_ID;

                    PatientBLLFactory patientBBLFactory = new PatientBLLFactory();
                    var details = (patientBBLFactory.CreatePatientBLL().GetPatientBLL().CreatePatientDAL().GetPatientDetialsByID(pat));

                    foreach (var e in details)
                    {
                        MailMessage mailMessage = new MailMessage("*****@*****.**", e.emailID);
                        // Specify the email body
                        mailMessage.Body    = "Dear Patient Your appointment with doctor" + p.doctorName + "and appointment Number" + p.appointment_ID + "and date" + p.appointment_Date + "is cancelled, Kindly reschedule it.";
                        mailMessage.Subject = "Appointment Cancelled";
                        SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
                        smtpClient.Credentials = new System.Net.NetworkCredential()
                        {
                            UserName = "******",
                            Password = "******"
                        };
                        smtpClient.EnableSsl = true;
                        smtpClient.Send(mailMessage);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        // PUT: api/Patient/5
        //Put action with int and patient Business object as input parameter, string as return type
        public string Put(int id, [FromBody] PatientBO patientUpdates)
        {
            PatientBLLFactory patientBLLFactory = new PatientBLLFactory();

            string result = patientBLLFactory.CreatePatientBLL().UpdatePatientBLL().CreatePatientDAL().UpdatePatientDetails_DAL(patientUpdates);

            return(result);
        }
        public string PatientValidateEmail(string text)
        {
            PatientBLLFactory patient = new PatientBLLFactory();
            PatientBO         pat     = new PatientBO();

            pat.emailID = text;
            return(patient.CreatePatientBLL().ValidatePatientBLL().CreatePatientDAL().ValidateEmailPatient_DAL(pat));
        }
        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");
            }
        }
        // GET: api/Patient/7001
        //Get action which accepts int and string as parameters and patient business object as return type
        public PatientBO Get(int id, string userPwd)
        {
            PatientBO patient_BO = new PatientBO();

            patient_BO.pid = id;
            patient_BO.pwd = userPwd;
            PatientBLLFactory patientBBLFactory = new PatientBLLFactory();

            patient_BO = patientBBLFactory.CreatePatientBLL().GetPatientBLL().CreatePatientDAL().GetPatientDetials_DAL(patient_BO);

            return(patient_BO);
        }
        public string RegisterNewUser(PatientBO patientDetails)
        {
            PatientBO patient_BO = new PatientBO();

            PatientBLLFactory patientBLLFactory = new PatientBLLFactory();

            PatientBO patientID = patientBLLFactory.CreatePatientBLL().InsertNewPatientBLL().CreatePatientDAL().InsertPatientDetails_DAL(patientDetails);

            if (patientID.pid != 0)
            {
                return("Your new User ID " + Convert.ToString(patientID.pid) + "- Login Using this UserID");
            }
            return("Email ID is already Used by other User, try using other EmailID");
        }
        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);
        }
        // DELETE: api/Patient/5
        //Delete action which accpets patient business object as input parameter and string as return type
        public string Delete(PatientBO details)
        {
            PatientBLLFactory patientBLLFactory = new PatientBLLFactory();

            PatientBO patientBO = new PatientBO();

            patientBO.pid     = 7002;
            patientBO.emailID = "*****@*****.**";
            patientBO.pwd     = "karthik123";

            string deactivateResult = patientBLLFactory.CreatePatientBLL().DeActivatePatientBLL().CreatePatientDAL().DeactivatePatient_DAL(patientBO);

            string activateResult = patientBLLFactory.CreatePatientBLL().ActivatePatientBLL().CreatePatientDAL().ActivatePatient_DAL(patientBO);

            string validateResult = patientBLLFactory.CreatePatientBLL().ValidatePatientBLL().CreatePatientDAL().ValidatePatient_DAL(patientBO);

            string checkAvailability = patientBLLFactory.CreatePatientBLL().CheckEmailAvailabilityBLL().CreatePatientDAL().CheckAvailability_DAL(patientBO);

            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 <PatientBO> GetPatientById(PatientBO patientBO)
        {
            PatientBLLFactory patientBBLFactory = new PatientBLLFactory();

            return(patientBBLFactory.CreatePatientBLL().GetPatientBLL().CreatePatientDAL().GetPatientDetialsByID(patientBO));
        }