public ActionResult GetAvailableAppointments(string text)
        {
            if (Convert.ToString(Session["key"]) != "doctor")
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (text != null)
            {
                Doctor_Api doc_Api    = new Doctor_Api();
                var        newBooking = doc_Api.GetDocApntment_Api((int)Session["UserId"]);
                if (newBooking != null)
                {
                    return(View("~/Views/Doctor/DoctorBookAppointment.cshtml", newBooking));
                }
                else
                {
                    return(View("~/Views/Error.cshtml"));
                }
            }
            else
            {
                AppointmentModel appModel   = new AppointmentModel();
                Patient_Api      patientApi = new Patient_Api();
                appModel.PatientList = patientApi.GetPaitentsList().ToList();

                return(View("~/Views/Doctor/DoctorBookAppointment.cshtml", appModel));
            }
        }
        public ActionResult GetRoomsRecordsByPatID(AccountModel acc)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            TreatmentRoom_Api roomApi = new TreatmentRoom_Api();
            PatientModel      pat     = new PatientModel();

            pat.pid = acc.patient_ID;
            var model = roomApi.GetRoomsRecordsByPatID(pat);

            Patient_Api patientApi = new Patient_Api();
            var         p          = patientApi.GetPaitentsList();

            foreach (var r in model)
            {
                if (r.date > DateTime.Now)
                {
                    r.canEdit = true;
                }
            }

            foreach (var m in model)
            {
                m.patientList = p;
            }
            return(View("~/Views/Administrator/ViewRoomBooking.cshtml", model.OrderBy(m => m.date)));
        }
        public ActionResult ViewRooms()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            TreatmentRoom_Api roomApi = new TreatmentRoom_Api();
            var model = roomApi.GetAllTreatmentRoomRecs();

            Patient_Api patientApi = new Patient_Api();
            var         p          = patientApi.GetPaitentsList();

            foreach (var r in model)
            {
                if (r.date > DateTime.Now)
                {
                    r.canEdit = true;
                }
            }
            foreach (var m in model)
            {
                m.patientList = p;
            }
            return(View("~/Views/Administrator/AdminViewRooms.cshtml", model));
        }
        public ActionResult ViewAllReportsByDoctor()
        {
            if (Convert.ToString(Session["key"]) != "doctor")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Patient_Api patientApi = new Patient_Api();

            ViewBag.GetPatientsList = new SelectList(patientApi.GetPaitentsList());

            LabIncharge_Api inchargeApi  = new LabIncharge_Api();
            var             reportsModel = inchargeApi.GetAllPatientReports_Api();

            return(View("~/Views/Doctor/DoctorManageReports.cshtml", reportsModel));
        }
        public ActionResult ViewRooms()
        {
            if (Convert.ToString(Session["key"]) != "nurse")
            {
                return(RedirectToAction("Login", "Home"));
            }

            TreatmentRoom_Api roomApi = new TreatmentRoom_Api();
            var model = roomApi.GetAllTreatmentRooms();

            Patient_Api patientApi = new Patient_Api();
            var         p          = patientApi.GetPaitentsList();

            foreach (var m in model)
            {
                m.patientList = p;
            }

            return(View("~/Views/Nurse/NurseViewRooms.cshtml", model));
        }
        public ActionResult BookRooms(TreatmentRoomModel roomModel)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            TreatmentRoom_Api tr_Api = new TreatmentRoom_Api();

            roomModel.isBooked = true;
            roomModel.timings  = "09:00";
            tr_Api.InsertTreatmentRoomRec(roomModel);

            TreatmentRoom_Api roomApi = new TreatmentRoom_Api();
            PatientModel      pat     = new PatientModel();

            pat.pid = roomModel.patient_ID;
            var model = roomApi.GetRoomsRecordsByPatID(pat);

            Patient_Api patientApi = new Patient_Api();
            var         p          = patientApi.GetPaitentsList();

            foreach (var r in model)
            {
                if (r.date > DateTime.Now)
                {
                    r.canEdit = true;
                }
            }

            foreach (var m in model)
            {
                m.patientList = p;
            }
            return(View("~/Views/Administrator/ViewRoomBooking.cshtml", model));
        }