// PUT: api/LabIncharge/5
        //Put action which accepts int and labincharge business object as parameter, void as return type
        public void Put(int id, [FromBody] LabInchargeBO inchargeBO)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            string updates = inchargeBLLFactory.CreateLabInchargeBLL().UpdateLabInchargeBLL().CreateLabInchargeDAL().UpdateLabInchargeDetails_DAL(inchargeBO);

            string Activate = inchargeBLLFactory.CreateLabInchargeBLL().ActivateLabInchargeBLL().CreateLabInchargeDAL().ActivateLabIncharge_DAL(inchargeBO);


            string validate = inchargeBLLFactory.CreateLabInchargeBLL().ValidateLabInchargeBLL().CreateLabInchargeDAL().ValidateLabIncharge_DAL(inchargeBO);

            string Deactive = inchargeBLLFactory.CreateLabInchargeBLL().DeActivateLabInchargeBLL().CreateLabInchargeDAL().DeactivateLabIncharge_DAL(inchargeBO);

            string isavailable = inchargeBLLFactory.CreateLabInchargeBLL().IsAvailableEmailBLL().CreateLabInchargeDAL().CheckAvailability_DAL(inchargeBO);
        }
        // POST: api/LabIncharge
        //Post action, which accepts Labincharge business object as parameter and same as return type
        public LabInchargeBO Post([FromBody] LabInchargeBO inchargeBO)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            LabInchargeBO updates = inchargeBLLFactory.CreateLabInchargeBLL().UpdateLabInchargeBLL().CreateLabInchargeDAL().InsertInchargeDetails_DAL(inchargeBO);

            return(updates);
        }
        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 RegisterNewIncharge([FromBody] LabInchargeBO inchargeBO)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            LabInchargeBO updates = inchargeBLLFactory.CreateLabInchargeBLL().UpdateLabInchargeBLL().CreateLabInchargeDAL().InsertInchargeDetails_DAL(inchargeBO);

            if (updates.pid != 0)
            {
                return("Your new User ID " + Convert.ToString(updates.pid) + "- Login Using this UserID");
            }
            return("Email ID is already Used by other User, try using other EmailID");
        }
        // GET: api/LabIncharge/5
        //Get Action which accepts int and string parameter, return type lab incharge business object
        public LabInchargeBO Get(int id, string pwd)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            LabInchargeBO incharge_BO = new LabInchargeBO();

            incharge_BO.pid = id;
            incharge_BO.pwd = pwd;

            LabInchargeBO inchargeBO = inchargeBLLFactory.CreateLabInchargeBLL().GetLabInchargeBLL().CreateLabInchargeDAL().GetLabInchargeDetials_DAL(incharge_BO);

            return(inchargeBO);
        }
        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 IEnumerable <ReportBO> GetAllPatientReports()
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().GetAllPatientsReports_DAL());
        }
        public IEnumerable <LabInchargeBO> UpdateLabIncharge(LabInchargeBO inchargeBO)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().UpdateLabInchargeBLL().CreateLabInchargeDAL().UpdateLabIncharge_DAL(inchargeBO));
        }
        public IEnumerable <LabInchargeBO> GetAllLabInchargeDetials()
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().UpdateLabInchargeBLL().CreateLabInchargeDAL().GetAllLabInchargeDetials_DAL());
        }
        public IEnumerable <ReportBO> ViewPatientReports(ReportBO report)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().ViewAllReports(report));
        }
        public ReportBO CreateNewReport(ReportBO patientReport)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().InsertNewReport(patientReport));
        }
        public IEnumerable <ReportBO> UpdatePatientReport(ReportBO patientReport)
        {
            LabInchargeBLLFactory inchargeBLLFactory = new LabInchargeBLLFactory();

            return(inchargeBLLFactory.CreateLabInchargeBLL().GetPatientReportsBLL().CreateReportDAL().UpdatePatientReport_DAL(patientReport));
        }
        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);
        }