public ActionResult viewNewBooking()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            var       patients = adminApi.GetAllPatients();

            TreatmentRoomModel trModel = new TreatmentRoomModel();

            foreach (var p in patients)
            {
                trModel.patientDropDown.Add(new SelectListItem {
                    Text  = p.firstName,
                    Value = Convert.ToString(p.pid)
                });
            }

            TreatmentRoom_Api roomApi  = new TreatmentRoom_Api();
            var bookedRooms            = roomApi.GetAllTreatmentRooms().Where(t => t.isBooked == true).Select(t => t.patient_ID);
            AppointmentTimings timings = new AppointmentTimings();

            trModel.appointmentTimings = timings.timingsDropDown;

            return(View("~/Views/Administrator/AdminBookRoom.cshtml", trModel));
        }
        public ActionResult Index(int?id)
        {
            if (Convert.ToString(Session["key"]) != "doctor")
            {
                return(RedirectToAction("Login", "Home"));
            }

            // id = 5006;
            if (id != null)
            {
                System.Web.HttpContext.Current.Session.Add("key", "doctor");
                System.Web.HttpContext.Current.Session.Add("UserId", id);
                Login_Api la   = new Login_Api();
                var       name = la.GetUserName(id);

                System.Web.HttpContext.Current.Session.Add("UserName", name);
            }


            NotificationsModel notificationModel = new NotificationsModel();
            Admin_Api          adminApi          = new Admin_Api();

            notificationModel.UserRoleID = (int)Session["UserId"];//6003;
            var notifications = adminApi.GetAllNotificationsByRole(notificationModel);

            return(View("~/Views/Doctor/DoctorHome.cshtml", notificationModel));
        }
        public ActionResult ViewPatRoomBooking()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }
            Admin_Api adminApi = new Admin_Api();
            var       patients = adminApi.GetAllPatients();

            List <SelectListItem> dropDownpatients = new List <SelectListItem>();

            foreach (var p in patients)
            {
                dropDownpatients.Add(new SelectListItem
                {
                    Text  = p.firstName,
                    Value = Convert.ToString(p.pid)
                });
            }
            AccountModel model = new AccountModel();

            model.patientdropDown = dropDownpatients;

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewPatientsForRoom.cshtml", model));
            }
            return(RedirectToAction("ViewRooms"));
        }
        public ActionResult ManageAccount(DoctorModel doctor)
        {
            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.UpdateDoctor(doctor);

            return(View("~/Views/Doctor/ViewAccountDetails.cshtml", model));
        }
        public ActionResult NewReport()
        {
            if (Convert.ToString(Session["key"]) != "doctor")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Doctor_Api doctorApi    = new Doctor_Api();
            var        appointments = doctorApi.GetDocApntment_Api((int)Session["UserId"]).Where(a => a.appointment_Date < DateTime.Now);

            Admin_Api        adminApi = new Admin_Api();
            var              pats     = adminApi.GetAllPatients();
            AppointmentModel docapts  = new AppointmentModel();

            foreach (var d in pats)
            {
                docapts.dropDown.Add(new SelectListItem
                {
                    Text  = d.firstName,
                    Value = Convert.ToString(d.pid)
                });
            }

            return(View("~/Views/Doctor/RequestReport.cshtml", docapts));
        }
        public ActionResult ViewDoctorAppointments(AppointmentModel person)
        {
            if (Convert.ToString(Session["key"]) != "nurse")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Doctor_Api doctorApi = new Doctor_Api();

            if (person.doctor_ID != 0)
            {
                var doctorApmnts = doctorApi.GetDocApntment_Api(person.doctor_ID).Where(a => (a.cancelled == false && a.appointment_Date > DateTime.Now));
                return(View("~/Views/Nurse/NurseViewDoctorAppointments.cshtml", doctorApmnts));
            }
            else
            {
                AppointmentModel doctorApts = new AppointmentModel();

                Admin_Api adminApi = new Admin_Api();
                var       docs     = adminApi.GetAllDoctor();

                foreach (var d in docs)
                {
                    doctorApts.dropDown.Add(new SelectListItem
                    {
                        Text  = d.firstName,
                        Value = Convert.ToString(d.pid)
                    });
                }

                return(View("~/Views/Nurse/ViewDoctorsList.cshtml", doctorApts));
            }
        }
        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));
        }
Ejemplo n.º 8
0
        //view  screen
        public ActionResult PatientAppointment(int patientId = 0)
        {
            if (Convert.ToString(Session["key"]) != "patient")
            {
                return(RedirectToAction("Login", "Home"));
            }

            AppointmentModel appModel = new AppointmentModel();
            Admin_Api        adminApi = new Admin_Api();
            var model = adminApi.GetAllDoctor().ToArray();

            List <DoctorDropDown> items = new List <DoctorDropDown>();

            foreach (var m in model)
            {
                appModel.doctorDetails.Add(m);
                items.Add(new DoctorDropDown
                {
                    Value = (m.pid),
                    Text  = m.firstName
                });
            }
            appModel.doctorDropDown = items;

            return(View("~/Views/Patient/PatientBookAppointment.cshtml", appModel));
        }
        public ActionResult ViewAddAccountDetail()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            var       patients = adminApi.GetAllPatients();

            List <SelectListItem> dropDownpatients = new List <SelectListItem>();

            foreach (var p in patients)
            {
                dropDownpatients.Add(new SelectListItem
                {
                    Text  = p.firstName,
                    Value = Convert.ToString(p.pid)
                });
            }

            AccountModel model = new AccountModel();

            model.patientdropDown = dropDownpatients;
            model.AppointmentIDDropDown.Add(new SelectListItem {
                Text = "-Select-", Value = "-Select-"
            });
            return(View("~/Views/Administrator/AdminAddViewBilling.cshtml", model));
        }
        public void EmailBooking(AppointmentModel app)
        {
            try
            {
                Email_Api       emailApi     = new Email_Api();
                Appointment_Api aptms        = new Appointment_Api();
                var             apppointment = aptms.GetAllAppointments().Where(a => a.appointment_ID == app.appointment_ID).First();
                var             patients     = emailApi.GetPatientsAppointments();

                Admin_Api adminApi   = new Admin_Api();
                var       patDetails = (adminApi.GetAllPatients()).Where(p => p.pid == apppointment.paitent_ID).First();

                MailMessage mailMessage = new MailMessage("*****@*****.**", patDetails.emailID);
                // Specify the email body
                mailMessage.Body = "Dear Patient you have booked appointment with Doctor " + app.doctorName +
                                   " Appointment ID is " + app.appointment_ID + " appointment time is " + app.timings;
                mailMessage.Subject = "Success Booking";
                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)
            {
                Utils.Logging(ex, 2);
            }
        }
        public ActionResult ViewBilling()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }
            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.GetAllAccounts();

            return(View("~/Views/Administrator/AdminViewBilling.cshtml", model.OrderByDescending(m => m.bill_ID)));
        }
        public ActionResult DeleteNotifications(NotificationsModel notification)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.DeleteNotifications(notification);

            return(View("~/Views/Administrator/AdminManageNotifications.cshtml", model));
        }
        public ActionResult DeleteAccountDetail(AccountModel accountModel)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.DeleteAccountDetail(accountModel);

            return(View("~/Views/Administrator/AdminViewBilling.cshtml", model));
        }
Ejemplo n.º 14
0
        public ActionResult ManageAccount(PatientModel patientModel)
        {
            if (Convert.ToString(Session["key"]) != "patient")
            {
                return(RedirectToAction("Login", "Home"));
            }
            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.UpdatePatient(patientModel);

            var m = model.Where(p => p.pid == patientModel.pid);

            return(View("~/Views/Patient/ManageAccount.cshtml", m));
        }
        public ActionResult GetAllNotifications(NotificationsModel getNotifications)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();

            getNotifications.AdminID = (int)System.Web.HttpContext.Current.Session["UserId"]; //6003;
            var notificationsModels = adminApi.GetAllNotifications(getNotifications);

            return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels));
        }
        public ActionResult ManageNotification(NotificationsModel mangeNotifications)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();

            mangeNotifications.AdminID = (int)Session["UserId"]; //6003;
            var notificationsModels = adminApi.ManageNotifications(mangeNotifications);

            return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels));
        }
        public ActionResult ViewPatients()
        {
            Admin_Api        adminApi = new Admin_Api();
            var              pats     = adminApi.GetAllPatients();
            AppointmentModel docapts  = new AppointmentModel();

            foreach (var d in pats)
            {
                docapts.dropDown.Add(new SelectListItem
                {
                    Text  = d.firstName,
                    Value = Convert.ToString(d.pid)
                });
            }
            return(View("~/Views/Doctor/ViewPatientList.cshtml", docapts));
        }
        public ActionResult ViewAccountsByID(AccountModel accountModel)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            IEnumerable <AccountModel> model = null;

            if (accountModel.account_ID != 0)
            {
                model = adminApi.GetAccountsByID(accountModel);
            }
            return(View("~/Views/Administrator/AdminViewAccounts.cshtml", model));
        }
        public ActionResult ManagePatients(PatientModel patientUpdates)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminGetAllPatients = new Admin_Api();
            var       model = adminGetAllPatients.UpdatePatient(patientUpdates);

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewPatients.cshtml", model));
            }
            return(View("~/Views/Error.cshtml"));
        }
        public ActionResult ManageNurses(NurseModel nurseUpdates)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();

            var model = adminApi.UpdateNurse(nurseUpdates);

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewNurses.cshtml", model));
            }
            return(View("~/Views/Error.cshtml"));
        }
        public ActionResult AddAccountDetail(AccountModel accModel)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            accModel.generatedDate_Time = DateTime.Now;
            accModel.paid_Amount        = 0;
            Admin_Api adminApi = new Admin_Api();

            adminApi.AddAccountDetail(accModel);

            var model = adminApi.GetAllAccounts();

            return(View("~/Views/Administrator/AdminViewBilling.cshtml", model.OrderByDescending(m => m.bill_ID)));
        }
        public ActionResult ViewPatients()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminGetAllPatientsApi = new Admin_Api();
            var       model = adminGetAllPatientsApi.GetAllPatients();

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewPatients.cshtml", model));
            }
            error.ErrorMessage = "Unable to Get Patient Details";
            return(View("~/Views/Error.cshtml", error));
        }
        public ActionResult SaveNotification(NotificationsModel mangeNotifications)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            IEnumerable <NotificationsModel> notificationsModels = null;

            if (!mangeNotifications.Expiry.Equals("1/1/0001 12:00:00 AM"))
            {
                mangeNotifications.AdminID          = (int)Session["UserId"];
                mangeNotifications.Created_DateTime = DateTime.Now;
                notificationsModels = adminApi.InsertNotifications(mangeNotifications);
            }
            return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notificationsModels));
        }
        public ActionResult ManageDoctors(DoctorModel doctorUpdates)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();

            var model = adminApi.UpdateDoctor(doctorUpdates);

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewDoctors.cshtml", model));
            }
            //ErrorModel.ErrorMessage = "Unable to fetch patient Details Please Again later";
            return(View("~/Views/Error.cshtml"));
        }
 public ActionResult ViewRoleNoti(string role)
 {
     if (role != null && role != "-Select")
     {
         if (Convert.ToString(Session["key"]) != "admin")
         {
             return(RedirectToAction("Login", "Home"));
         }
         Admin_Api          adminApi = new Admin_Api();
         NotificationsModel model    = new NotificationsModel();
         ViewBag.dropdownModel = null;
         model.UserRoleID      = Convert.ToInt32(role);
         var notis = adminApi.GetAllNotificationsByRole(model);
         ViewBag.dropdownModel = "true";
         return(View("~/Views/Administrator/AdminManageNotifications.cshtml", notis));
     }
     return(View("~/Views/Administrator/AdminManageNotifications.cshtml"));
 }
        public ActionResult ViewDoctors()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminGetAllDoctorsApi = new Admin_Api();

            var model = adminGetAllDoctorsApi.GetAllDoctor();

            if (model != null)
            {
                return(View("~/Views/Administrator/AdminViewDoctors.cshtml", model));
            }

            return(View("~/Views/Error.cshtml"));
        }
        public ActionResult BookNewAppointment(AppointmentModel apmnt = null)
        {
            if (Convert.ToString(Session["key"]) != "doctor")
            {
                return(RedirectToAction("Login", "Home"));
            }

            if (apmnt.timings != null)
            {
                Doctor_Api doc_Api = new Doctor_Api();
                apmnt.doctor_ID = (int)Session["UserId"]; //5006;
                apmnt.date      = DateTime.Now;           //booking date
                var newBooking = doc_Api.BookDocApnmt_Api(apmnt);
                List <AppointmentModel> newAppointment = new List <AppointmentModel>();
                newBooking.canCancel = true;
                newAppointment.Add(newBooking);
                if (newBooking != null)
                {
                    return(View("~/Views/Doctor/DoctorViewAppointments.cshtml", newAppointment));
                }
                else
                {
                    return(View("~/Views/Error.cshtml"));
                }
            }
            else
            {
                AppointmentModel appModel = new AppointmentModel();
                Admin_Api        adminApi = new Admin_Api();
                var patients = adminApi.GetAllPatients();

                foreach (var p in patients)
                {
                    appModel.dropDown.Add(new SelectListItem {
                        Text  = p.firstName,
                        Value = Convert.ToString(p.pid)
                    });
                }

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

            Admin_Api        adminApi = new Admin_Api();
            var              pats     = adminApi.GetAllPatients();
            AppointmentModel docapts  = new AppointmentModel();

            foreach (var d in pats)
            {
                docapts.dropDown.Add(new SelectListItem
                {
                    Text  = d.firstName,
                    Value = Convert.ToString(d.pid)
                });
            }

            return(View("~/Views/Nurse/ViewPatientList.cshtml", docapts));
        }
        public ActionResult GetAccountsByDropDown(AccountModel accountModel)
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api adminApi = new Admin_Api();
            var       model    = adminApi.GetAllAccounts();

            if (accountModel.account_ID == 1)
            {
                ViewBag.AccountDropDrown = new SelectList(model.Select(a => a.account_ID));
            }
            else if (accountModel.account_ID == 2)
            {
                ViewBag.AccountDropDrown = new SelectList(model.Select(a => a.patient_ID));
            }
            else if (accountModel.account_ID == 3)
            {
                ViewBag.AccountDropDrown = new SelectList(model.Select(a => a.payment_ID));
            }
            return(View("~/Views/Administrator/AdminViewAccounts.cshtml"));
        }
        public ActionResult ViewForPayments()
        {
            if (Convert.ToString(Session["key"]) != "admin")
            {
                return(RedirectToAction("Login", "Home"));
            }

            Admin_Api        adminGetAllPatientsApi = new Admin_Api();
            var              model = adminGetAllPatientsApi.GetAllPatients();
            AppointmentModel app   = new AppointmentModel();

            foreach (var p in model)
            {
                app.dropDown.Add(new SelectListItem {
                    Text = p.firstName, Value = Convert.ToString(p.pid)
                });
            }
            if (model != null)
            {
                return(View("~/Views/Administrator/ViewPatientsForPayments.cshtml", app));
            }
            error.ErrorMessage = "Unable to Get Patient Details";
            return(View("~/Views/Error.cshtml", error));
        }