public IEnumerable <int> GetDoctorIDs()
        {
            DoctorBLLFactory getDoctors = new DoctorBLLFactory();

            var val = getDoctors.CreateDoctorBLL().GetDoctorsListBLL().CreateDoctorDAL().GetDoctorIDs_DAL();

            return(val);
        }
        public void cancelAllAppointmentByDate(AppointmentBO appBO)
        {
            DoctorBLLFactory docBLLFactory = new DoctorBLLFactory();
            var             patIDs         = docBLLFactory.CreateDoctorBLL().GetDocAppointments().CreateDoctorDAL().cancelAllAppointmentByDate(appBO);
            EmailController emails         = new EmailController();

            emails.SendAppCancelledEmail(patIDs.ToList());
        }
        public List <string> GetAvailableTimingsForPatient(AppointmentBO appointmentBO)
        {
            DoctorBLLFactory getDoctors = new DoctorBLLFactory();

            var val = getDoctors.CreateDoctorBLL().GetDoctorsListBLL().CreateDoctorDAL().GetAvailableTimingsForPatient(appointmentBO);

            return(val);
        }
        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 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);
        }
        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 void InsertNewDoctor(DoctorBO doctorBO)
        {
            DoctorBLLFactory insertDoctor = new DoctorBLLFactory();

            DoctorBO newDoctor = insertDoctor.CreateDoctorBLL().InsertNewDoctorBLL().CreateDoctorDAL().InsertNewDoctor_DAL(doctorBO);
        }
        public IEnumerable <AppointmentBO> GetDoctorAppointments(DoctorBO doctor)
        {
            DoctorBLLFactory docBLLFactory = new DoctorBLLFactory();

            return(docBLLFactory.CreateDoctorBLL().GetDocAppointments().CreateDoctorDAL().GetDocAppointments(doctor.pid));
        }
        public IEnumerable <AppointmentBO> cancelAppointment(AppointmentBO appBO)
        {
            DoctorBLLFactory docBLLFactory = new DoctorBLLFactory();

            return(docBLLFactory.CreateDoctorBLL().GetDocAppointments().CreateDoctorDAL().cancelAppointment(appBO));
        }