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 GetPayments(AccountModel account) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var d = TempData["id"]; TempData.Keep("id"); if (account.patient_ID != 0) { TempData["id"] = account.patient_ID; } if (account.patient_ID != 0) { var paymentsModel = patientApi.GetPatientPayments(account.patient_ID); return(View("~/Views/Administrator/AdminViewPayments.cshtml", paymentsModel.OrderBy(p => p.bill_ID))); } else { var paymentsModel = patientApi.GetPatientPayments((int)d); return(View("~/Views/Administrator/AdminViewPayments.cshtml", paymentsModel.OrderBy(p => p.bill_ID))); } }
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 GetPaymentsWithBillID(PaymentModel p) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetAllPayments().Where(b => b.bill_ID == p.bill_ID); if (paymentsModel.Count() != 0) { ViewBag.totalAmount = paymentsModel.Last().total_Amount; ViewBag.paidAmount = paymentsModel.Last().paid_Amount; double totalPaidAmount = 0; foreach (var pp in paymentsModel) { totalPaidAmount = totalPaidAmount + pp.paid_Amount; } ViewBag.TotalPaid = totalPaidAmount; ViewBag.PendingAmount = ViewBag.totalAmount - totalPaidAmount; } else { return(Redirect("ViewPatientsForPayments")); } return(View("~/Views/Administrator/AdminPayPayments.cshtml", paymentsModel)); }
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 ViewCreateNewReport() { if (Convert.ToString(Session["key"]) != "labIncharge") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); //ViewBag.GetPatientsList = new SelectList(patientApi.GetPaitentsList()); Admin_Api adminApi = new Admin_Api(); var pats = adminApi.GetAllPatients(); ReportModel repts = new ReportModel(); foreach (var d in pats) { repts.dropDown.Add(new SelectListItem { Text = d.firstName, Value = Convert.ToString(d.pid) }); } //ViewBag.GetPatientsList = docapts; return(View("~/Views/LabIncharge/LabInchargeCreateReport.cshtml", repts)); }
public ActionResult GetAppointments(int?patientID = 0) { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } int id = (int)Session["UserId"]; Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id).Where(a => a.cancelled == false); foreach (var p in patientAppointments) { if (p.appointment_Date > DateTime.Now) { p.canCancel = true; } } if (patientAppointments != null) { return(View("~/Views/Patient/PatientViewAppointments.cshtml", patientAppointments)); } return(View("~Views/Error.cshtml")); }
public ActionResult ViewPatientAppointments(AppointmentModel person) { if (Convert.ToString(Session["key"]) != "nurse") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var patientApmnts = patientApi.GetAppointments(person.paitent_ID).Where(a => (a.cancelled == false && a.appointment_Date > DateTime.Now)); return(View("~/Views/Nurse/NurseViewPatientAppointments.cshtml", patientApmnts)); }
public ActionResult ValidateEmail(string text) { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api validateEmail = new Patient_Api(); string result = validateEmail.PatientValidateEmail(text); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult PayPayments() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]); return(View("~/Views/Patient/PatientPayments.cshtml", paymentsModel)); }
public ActionResult GetAppointments(int id) { if (Convert.ToString(Session["key"]) != "labIncharge") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id); ReportModel rptmOld = new ReportModel(); //if (patientAppointments) { foreach (var a in patientAppointments) { try { if (a.requestedReport) { rptmOld.appointmentIntIDs.Add(a.appointment_ID); } } catch (Exception ex) { string test = ex.ToString(); } } } LabIncharge_Api inchargeApi = new LabIncharge_Api(); var reportsModel = inchargeApi.GetPatientReports_Api(id); ReportModel rptmNew = new ReportModel(); foreach (var a in reportsModel) { { rptmNew.appointmentIntIDs.Add(a.appointment_ID); } } foreach (var a in rptmNew.appointmentIntIDs) { rptmOld.appointmentIntIDs.Remove(a); } foreach (var a in rptmOld.appointmentIntIDs) { rptmOld.appointmentIDs.Add(new SelectListItem { Text = a.ToString(), Value = a.ToString() }); } return(Json(rptmOld.appointmentIDs, JsonRequestBehavior.AllowGet)); }
public ActionResult SendAppointmentEmail(int appID) { PatientModel pat = new PatientModel(); pat.pid = (int)Session["UserID"]; Patient_Api patApi = new Patient_Api(); var appDetails = patApi.GetAppointments((int)Session["UserId"]).Where(a => a.appointment_ID == appID).First(); EmailsController emails = new EmailsController(); emails.EmailBooking(appDetails); return(RedirectToAction("GetAppointments")); }
public ActionResult EditPayments(PaymentModel payment) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.PayPayments(payment); return(View("~/Views/Administrator/AdminViewPayments.cshtml", paymentsModel.OrderBy(p => p.bill_ID))); }
public ActionResult GetAvailableTimings(AppointmentModel apmtModel) { Doctor_Api doctorApi = new Doctor_Api(); apmtModel.appointment_Date = DateTime.Parse(apmtModel.timings); apmtModel.paitent_ID = (int)Session["UserId"]; List <string> bookedTimings = doctorApi.GetAvailableTimings(apmtModel); AppointmentTimings appTimings = new AppointmentTimings(); List <timingsValues> timings = appTimings.timingsDropDown; int id = (int)Session["UserId"]; Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id); List <timingsValues> displayTimings = new List <timingsValues>(); if (bookedTimings.Count == 0) { var app = patientAppointments.Where(a => a.appointment_Date == apmtModel.appointment_Date).Select(t => t.timings).ToList(); if (app.Count() > 0) { List <timingsValues> t = new List <timingsValues>(); foreach (var a in app) { var aa = a.Trim('0'); t.Add(new timingsValues { Text = aa.Trim(':'), Value = aa.Trim(':') }); } var i = 0; foreach (var val in t) { displayTimings = timings.Where(d => d.Text != t.ElementAt(i).Text).ToList(); i++; } } else { displayTimings = timings;//.Where(t => !bookedTimings.Contains(t.Value)).ToList(); } } if (bookedTimings.Count != 0) { displayTimings.Add(new timingsValues { Value = "00:00", Text = "00:00" }); } return(Json(displayTimings, JsonRequestBehavior.AllowGet)); }
public ActionResult ViewBookedRoom() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); PatientModel pat = new PatientModel(); pat.pid = (int)Session["UserId"]; var model = patientApi.ViewBookedRoom(pat); return(View("~/Views/Patient/ViewRoomAlloted.cshtml", model)); }
//Used to get aptmts for patients with no room booking public List <SelectListItem> GetApptsForRooms(int patientID) { Patient_Api patientApi = new Patient_Api(); Appointment_Api app = new Appointment_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointmentsForBookedRooms(patientID).Where(a => a.appointment_Date > DateTime.Now && a.cancelled == false); //apts with no rooms IEnumerable <AppointmentModel> patAptsNoBilling = app.GetAppointmentsWithNoBilling().Where(a => (a.paitent_ID == patientID && a.appointment_Date > DateTime.Now && a.cancelled == false)); //not billed apts List <int> aptsInt = new List <int>(); foreach (var a in patientAppointments) { aptsInt.Add(a.appointment_ID); } List <int> aptsIntNoBilling = new List <int>(); foreach (var a in patAptsNoBilling) { aptsIntNoBilling.Add(a.appointment_ID); } PatientModel patModel = new PatientModel(); patModel.pid = patientID; TreatmentRoom_Api trApi = new TreatmentRoom_Api(); var bookedAppointments = trApi.GetBookedRooms(patModel); //apts with room booked List <int> bookedaptsInt = new List <int>(); foreach (var a in bookedAppointments) { bookedaptsInt.Add(a.appointment_ID); } IEnumerable <int> finalApts = aptsIntNoBilling.Concat(aptsInt);//aptsIntNoBilling.Except(bookedaptsInt).ToList(); finalApts = finalApts.Except(bookedaptsInt).ToList(); List <SelectListItem> appts = new List <SelectListItem>(); foreach (var a in finalApts) { appts.Add(new SelectListItem { Text = a.ToString(), Value = a.ToString() }); } return(appts); }
public ActionResult AdminPayPayments(PaymentModel payment) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.PayPayments(payment); return(RedirectToAction("ViewPatientsForPayments")); //return View("~/Views/Patient/PatientPayments.cshtml", paymentsModel); }
public ActionResult ViewManageAccount() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); PatientModel patientModel = new PatientModel(); patientModel.pid = (int)Session["UserId"]; var model = patientApi.GetPatientById(patientModel); return(View("~/Views/Patient/ManageAccount.cshtml", model)); }
public ActionResult GetReqReportNotes(int aptId) { if (Convert.ToString(Session["key"]) != "labIncharge") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); Appointment_Api appApi = new Appointment_Api(); AppointmentModel appModel = new AppointmentModel(); appModel.appointment_ID = aptId; var appDetails = appApi.GetApnmt_Api(appModel); return(Json(appDetails.reqReportNotes, JsonRequestBehavior.AllowGet)); }
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 ViewAppointments(int patientID) { int id = (int)Session["UserId"]; Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointmentsForBookedRooms(patientID).Where(a => a.appointment_Date < DateTime.Now); //IEnumerable<AppointmentModel> patientAppointments = patientApi.GetAppointmentsForBookedRooms(patientID); List <SelectListItem> appts = new List <SelectListItem>(); foreach (var a in patientAppointments) { appts.Add(new SelectListItem { Text = a.appointment_ID.ToString(), Value = a.appointment_ID.ToString() }); } return(Json(appts, JsonRequestBehavior.AllowGet)); }
public ActionResult GetPayments() { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]).GroupBy(g => g.bill_ID).Select(pa => pa.First()).ToList(); PaymentModel p = new PaymentModel(); foreach (var pay in paymentsModel) { p.billList.Add(new SelectListItem { Text = pay.bill_ID.ToString(), Value = pay.bill_ID.ToString() }); } return(View("~/Views/Patient/SelectBillID.cshtml", p)); }
public ActionResult SelectPatientsForPayments(AppointmentModel app) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); var paymentsModel = patientApi.GetPatientPayments(app.paitent_ID).GroupBy(g => g.bill_ID).Select(pa => pa.First()).ToList(); PaymentModel p = new PaymentModel(); foreach (var pay in paymentsModel) { p.billList.Add(new SelectListItem { Text = pay.bill_ID.ToString(), Value = pay.bill_ID.ToString() }); } return(View("~/Views/Administrator/AdminSelectBillID.cshtml", p)); }
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)); }
//post data for booking public ActionResult PatientBookAppointment(AppointmentModel patientAppointment) { if (Convert.ToString(Session["key"]) != "patient") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); patientAppointment.paitent_ID = (int)Session["UserId"]; patientAppointment.date = DateTime.Now; AppointmentModel model = patientApi.PatientBookAppointment(patientAppointment); if (model.appointment_ID != 0) { return(View("~/Views/Patient/SuccessBooking.cshtml", model)); } return(View("~/Views/Error.cshtml")); }
public ActionResult ViewAppointmentsForReport(int patientID) { int id = (int)Session["UserId"]; Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(patientID).Where(a => (a.appointment_Date < DateTime.Now && a.reqReportNotes == "N/A" && a.requestedReport == false && a.doctor_ID == id && a.cancelled == false)); List <int> patapts = new List <int>(); foreach (var a in patientAppointments) { patapts.Add(a.appointment_ID); } PatientModel patient = new PatientModel(); patient.pid = patientID; Reports_Api reports_Api = new Reports_Api(); var allReports = reports_Api.GetReportsByPatient(patient); List <int> patrptapts = new List <int>(); foreach (var a in allReports) { patrptapts.Add(a.appointment_ID); } { patapts = patapts.Except(patrptapts).ToList(); } List <SelectListItem> patReports = new List <SelectListItem>(); foreach (var a in patapts) { patReports.Add(new SelectListItem { Text = a.ToString(), Value = a.ToString() }); } return(Json(patReports, JsonRequestBehavior.AllowGet)); }
public ActionResult GetPaymentsWithID(int id) { if (Convert.ToString(Session["key"]) != "admin") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); Account_Api accApi = new Account_Api(); AccountModel accModel = new AccountModel(); accModel.patient_ID = (int)Session["UserId"]; var model = accApi.GetAccountsByBillID(accModel); var billingID = model.Where(a => a.appointment_ID == id).FirstOrDefault(); if (billingID != null) { var paymentsModel = patientApi.GetPatientPayments((int)Session["UserId"]); List <PaymentModel> pay = null; if (paymentsModel.Count() != 0) { var pp = paymentsModel.Where(p => p.bill_ID == billingID.bill_ID).FirstOrDefault(); if (pp != null) { pay.Add(pp); return(View("~/Views/Patient/PatientViewPayments.cshtml", pay)); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); } ViewBag.info = "Billing is not yet generated"; return(View("~/Views/Patient/NoReports.cshtml")); }
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)); }