コード例 #1
0
        public ActionResult ProductUpdate(MedicineModel medicine)
        {
            int result = 0;

            PractitionerProcess process = new PractitionerProcess();

            result = process.UpdateProduct(medicine);

            if (result == 0)
            {
                PractitionerBaseViewModel viewModel = new PractitionerBaseViewModel();
                viewModel.AccId         = medicine.PractitionerId;
                viewModel.MedicineModel = medicine;

                return(View(viewModel));
            }
            else
            {
                return(Content(@"<body>
                           <script type='text/javascript'>
                             if(confirm('Product update is updated successfully. Press Ok to close this tab.')){ window.close();window.opener.location.reload(); };
                           </script>
                         </body> "));
            }
        }
コード例 #2
0
        public ActionResult SpecialistProfile(string specialistId, string accId)
        {
            AppointmentViewModel      result       = new AppointmentViewModel();
            PractitionerBaseViewModel practitioner = new PractitionerBaseViewModel();

            if (String.IsNullOrEmpty(specialistId) && String.IsNullOrEmpty(accId))
            {
                return(new HttpNotFoundResult("Oops..There is no account selected. Please try again."));
            }
            else
            {
                Guid patientAccId = Guid.Parse(accId);
                result.PatientId = patientAccId;

                Guid specialistAccId = Guid.Parse(specialistId);
                if (specialistAccId.Equals(Guid.Empty))
                {
                    return(new HttpNotFoundResult("Oops..There is some errors occur. Please try again."));
                }
                else
                {
                    PractitionerBaseViewModel vm = new PractitionerBaseViewModel();
                    vm.AccId = specialistAccId;
                    PractitionerProcess process = new PractitionerProcess();
                    practitioner = process.GetProfile(vm);

                    result.Practitioner = practitioner;
                }
            }

            return(View(result));
        }
コード例 #3
0
        public List <PractitionerRecordsDirectory> GetRecordsDirectory(PractitionerBaseViewModel vm)
        {
            PractitionerBusiness businessLayer         = new PractitionerBusiness();
            List <PractitionerRecordsDirectory> result = businessLayer.GetRecordsDirectory(vm.AccId);

            return(result);
        }
コード例 #4
0
        public ActionResult CreateProduct(PractitionerBaseViewModel viewModel)
        {
            MedicineModel model = new MedicineModel();

            model.PractitionerId = viewModel.AccId;
            return(View(model));
        }
コード例 #5
0
        public int AppointmentRejected(AppointmentModel appointmentModel)
        {
            int result = 0;

            try
            {
                //Change Appointment Status to rejected
                PractitionerData dataLayer = new PractitionerData();
                AppointmentModel model     = new AppointmentModel();
                //model is with appointmentdatestring and appointmenttimestring and PatientId + RejectReasons + PracitionerId
                model = dataLayer.AppointmentRejected(appointmentModel);

                if (!model.PatientId.Equals(Guid.Empty))
                {
                    //Get PatientId to retrieve email
                    PatientData patientDataLayer             = new PatientData();
                    string      patientEmailAddress          = patientDataLayer.GetPatientEmail(model.PatientId);
                    PractitionerBaseViewModel companyDetails = new PractitionerBaseViewModel();
                    PractitionerBaseViewModel temp           = new PractitionerBaseViewModel();
                    temp.AccId     = appointmentModel.PractitionerId;
                    companyDetails = dataLayer.GetProfile(temp);
                    result         = SentAppointmentRejectedNotificationEmail(patientEmailAddress, model.AppointmentDateString, model.AppointmentTimeString, model.RejectReasons, companyDetails);
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PractitionerBusiness.AppointmentAccepted : " + err);
            }

            return(result);
        }
コード例 #6
0
ファイル: HomePageController.cs プロジェクト: JesperMoon/FYP
        public ActionResult PractitionerLogin(LoginInfo loginInfo)
        {
            LoginInfo result = new LoginInfo();

            if (Request.Form["Submit"] != null)
            {
                if (ModelState.IsValid == true)
                {
                    PractitionerProcess process = new PractitionerProcess();
                    result = process.PractitionerLogin(loginInfo);

                    TempData["Deleted"]   = "";
                    TempData["Pending"]   = "";
                    TempData["Incorrect"] = "";

                    //Account found
                    if (result.AccountNo != Guid.Empty)
                    {
                        //Check Status
                        if (result.AccountStatus.Equals(ConstantHelper.AccountStatus.Active))
                        {
                            PractitionerBaseViewModel vm = new PractitionerBaseViewModel();
                            vm.AccId = result.AccountNo;
                            FormsAuthentication.SetAuthCookie(result.AccountNo.ToString(), false);
                            return(RedirectToAction("Profile", "Practitioner", vm));
                        }

                        else if (result.AccountStatus.Equals(ConstantHelper.AccountStatus.Deleted))
                        {
                            //Account deleted
                            TempData["Deleted"] = "Deleted";
                            loginInfo.Password  = "";

                            return(View(loginInfo));
                        }

                        else if (result.AccountStatus.Equals(ConstantHelper.AccountStatus.Pending))
                        {
                            //Account pending
                            TempData["Pending"] = "Pending";
                            loginInfo.Password  = "";

                            return(View(loginInfo));
                        }
                    }
                    else
                    {
                        //Account not found
                        TempData["Incorrect"] = "Incorrect";
                        loginInfo.Password    = "";

                        return(View(loginInfo));
                    }
                }
            }

            return(View(loginInfo));
        }
コード例 #7
0
        public PractitionerBaseViewModel GetProfile(PractitionerBaseViewModel vm)
        {
            PractitionerBaseViewModel result = new PractitionerBaseViewModel();

            PractitionerBusiness businessLayer = new PractitionerBusiness();

            result = businessLayer.GetProfile(vm);

            return(result);
        }
コード例 #8
0
        public List <AppointmentModel> GetAppointmentsTable(PractitionerBaseViewModel vm)
        {
            List <AppointmentModel> result = new List <AppointmentModel>();

            PractitionerBusiness businessLayer = new PractitionerBusiness();

            result = businessLayer.GetAppointmentsTable(vm.AccId);

            return(result);
        }
コード例 #9
0
        public ActionResult Records(string practitionerId)
        {
            PractitionerBaseViewModel vm = new PractitionerBaseViewModel();

            vm.AccId = Guid.Parse(practitionerId);
            PractitionerProcess process = new PractitionerProcess();
            List <PractitionerRecordsDirectory> result = process.GetRecordsDirectory(vm);

            //pass balck list of records model
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        public List <PractitionerRecordsDirectory> PatientPractitionerRecords(PractitionerBaseViewModel vm)
        {
            List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>();

            if (vm != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.PatientPractitionerRecords(vm.AccId, vm.PatientBaseViewModel.AccId);
            }

            return(result);
        }
コード例 #11
0
        public ActionResult PatientPractitionerRecords(string practitionerId, string patientId)
        {
            List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>();
            PractitionerProcess       process          = new PractitionerProcess();
            PractitionerBaseViewModel vm = new PractitionerBaseViewModel();

            vm.AccId = Guid.Parse(practitionerId);
            vm.PatientBaseViewModel.AccId = Guid.Parse(patientId);
            result = process.PatientPractitionerRecords(vm);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #12
0
        public List <MedicineModel> GetProducts(PractitionerBaseViewModel profile)
        {
            List <MedicineModel> result = new List <MedicineModel>();

            if (profile != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.GetProducts(profile.AccId);
            }

            return(result);
        }
コード例 #13
0
        public int ProfileEdit(PractitionerBaseViewModel profile)
        {
            int result = 0;

            if (profile != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.ProfileEdit(profile);
            }

            return(result);
        }
コード例 #14
0
        public PatientRecordModel GetMedicinesDropDown(PractitionerBaseViewModel vm)
        {
            PatientRecordModel result = new PatientRecordModel();

            if (vm != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.GetMedicinesDropDown(vm.CompanyId);
            }

            return(result);
        }
コード例 #15
0
        public List <PatientsDirectory> GetPatientsDirectory(PractitionerBaseViewModel vm)
        {
            List <PatientsDirectory> result = new List <PatientsDirectory>();

            if (vm != null)
            {
                PractitionerBusiness businessLayer = new PractitionerBusiness();
                result = businessLayer.GetPatientsDirectory(vm.AccId);
            }

            return(result);
        }
コード例 #16
0
        public int ProfileEdit(PractitionerBaseViewModel profile)
        {
            PractitionerData dataLayer = new PractitionerData();

            profile.DateOfBirth = Convert.ToDateTime(profile.DateOfBirthString);

            int result = 0;

            result = dataLayer.ProfileEdit(profile);

            return(result);
        }
コード例 #17
0
 public ActionResult Patients(PractitionerBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PractitionerLogin", "HomePage", null));
     }
     else
     {
         PractitionerBaseViewModel result = new PractitionerBaseViewModel();
         result.AccId = vm.AccId;
         return(View(result));
     }
 }
コード例 #18
0
ファイル: PractitionerProcess.cs プロジェクト: JesperMoon/FYP
        public int ProfileEdit(PractitionerBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.Practitioner.ProfileEdit, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(vm);

            IRestResponse <int> response = client.Execute <int>(request);
            int result = response.Data;

            return(result);
        }
コード例 #19
0
 public ActionResult Records(PractitionerBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PractitionerLogin", "HomePage", null));
     }
     else
     {
         PractitionerBaseViewModel result = new PractitionerBaseViewModel();
         result.AccId = vm.AccId;
         result.PractitionerRecordSearch.Year = DateTime.Today.Year;
         return(View(result));
     }
 }
コード例 #20
0
ファイル: PractitionerProcess.cs プロジェクト: JesperMoon/FYP
        public List <PatientsDirectory> GetPatientsDirectory(PractitionerBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.Practitioner.GetPatientsDirectory, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(vm);

            IRestResponse <List <PatientsDirectory> > response = client.Execute <List <PatientsDirectory> >(request);
            List <PatientsDirectory> result = response.Data;

            return(result);
        }
コード例 #21
0
 public ActionResult Profile(PractitionerBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PractitionerLogin", "HomePage", null));
     }
     else
     {
         PractitionerBaseViewModel result  = new PractitionerBaseViewModel();
         PractitionerProcess       process = new PractitionerProcess();
         result = process.GetProfile(vm);
         return(View(result));
     }
 }
コード例 #22
0
ファイル: PractitionerProcess.cs プロジェクト: JesperMoon/FYP
        public Dictionary <string, string> GetMedicinesDropDown(PractitionerBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.PatientRecord.GetMedicinesDropDown, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(vm);

            IRestResponse <PatientRecordModel> response = client.Execute <PatientRecordModel>(request);
            PatientRecordModel result = response.Data;

            return(result.MedicineDropDown);
        }
コード例 #23
0
        public ActionResult ProfileEdit(PractitionerBaseViewModel vm)
        {
            if (vm.AccId.Equals(Guid.Empty))
            {
                return(RedirectToAction("PractitionerLogin", "HomePage", null));
            }
            else
            {
                vm.Religion          = (Religion)Enum.Parse(typeof(Religion), vm.ReligionString);
                vm.Specialist        = (Specialist)Enum.Parse(typeof(Specialist), vm.SpecialistString);
                vm.DateOfBirthString = vm.DateOfBirth.ToString("yyyy-MM-dd");

                return(View(vm));
            }
        }
コード例 #24
0
        public ActionResult ViewPatient(string patientId, string practitionerId)
        {
            PractitionerBaseViewModel result = new PractitionerBaseViewModel();

            PatientBaseViewModel patientModel = new PatientBaseViewModel();

            patientModel.AccId = Guid.Parse(patientId);

            PractitionerProcess process = new PractitionerProcess();

            result.PatientBaseViewModel = process.ViewPatient(patientModel);
            result.AccId = Guid.Parse(practitionerId);

            return(View(result));
        }
コード例 #25
0
        public PractitionerBaseViewModel GetProfile(PractitionerBaseViewModel vm)
        {
            PractitionerBaseViewModel result = new PractitionerBaseViewModel();

            try
            {
                PractitionerData dataLayer = new PractitionerData();
                result = dataLayer.GetProfile(vm);
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PractitionerBusiness.GetProfile : " + err);
            }

            return(result);
        }
コード例 #26
0
ファイル: PractitionerProcess.cs プロジェクト: JesperMoon/FYP
        public List <AppointmentModel> GetAppointmentsTable(string practitionerId)
        {
            PractitionerBaseViewModel vm = new PractitionerBaseViewModel();

            vm.AccId = Guid.Parse(practitionerId);

            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.Practitioner.GetAppointmentsTable, Method.POST);

            request.RequestFormat = DataFormat.Json;
            request.AddBody(vm);

            IRestResponse <List <AppointmentModel> > response = client.Execute <List <AppointmentModel> >(request);
            List <AppointmentModel> result = response.Data;

            return(result);
        }
コード例 #27
0
ファイル: PatientController.cs プロジェクト: JesperMoon/FYP
        public int MakeAppointment(AppointmentModel appointmentModel)
        {
            int result = 0;

            PatientBusiness businessLayer = new PatientBusiness();

            result = businessLayer.MakeAppointment(appointmentModel);

            if (result == 1)
            {
                PractitionerBaseViewModel pt       = new PractitionerBaseViewModel();
                PractitionerBaseViewModel ptResult = new PractitionerBaseViewModel();
                pt.AccId = appointmentModel.PractitionerId;
                PractitionerBusiness practitionerBusiness = new PractitionerBusiness();
                ptResult = practitionerBusiness.GetProfile(pt);
                businessLayer.SentEmailNotification(appointmentModel, ptResult);
            }

            return(result);
        }
コード例 #28
0
        public void SentEmailNotification(AppointmentModel model, PractitionerBaseViewModel ptResult)
        {
            string mailFrom = ConstantHelper.AppSettings.MailFrom;
            string userName = ConstantHelper.AppSettings.UserName;
            string password = ConstantHelper.AppSettings.Password;

            try
            {
                PatientData patientDataLayer = new PatientData();
                string      patientEmail     = patientDataLayer.GetPatientEmail(model.PatientId);
                if (!String.IsNullOrEmpty(patientEmail))
                {
                    //Sent notification email to patient
                    string patientEmailSubject = ConstantHelper.Email.AppointmentVerification.AppointmentMadeSubject;
                    string patientEmailBody    = ConstantHelper.Email.AppointmentVerification.AppointmentMadeBody;
                    //replace with appointment details
                    DateTime tempAppointmentDateTime = Convert.ToDateTime(model.AppointmentDate.ToString());
                    string   appointmentDetailsTable = "<table><caption>Appointment Details</caption><tr><th>Appointment Date</th><td>" + tempAppointmentDateTime.ToString("dd/MM/yyyy") + "</td></tr><tr><th>Appointment Time</th><td>" + tempAppointmentDateTime.ToString("hh:mm tt") + "</td></tr><tr><th>Company</th><td>" + ptResult.CompanyName + "</td></tr><tr><th>City</th><td>" + ptResult.City + "</td></tr><tr><th>Postal Code</th><td>" + ptResult.PostalCode + "</td></tr><tr><th>State</th><td>" + ptResult.State + "</td></tr><tr><th>Appointment Description</th><td>" + model.Description + "</td></tr><tr><th>Appointment Remarks</th><td>" + model.Remarks + "</td></tr></table>";
                    patientEmailBody = patientEmailBody.Replace(ConstantHelper.Email.Keyword.AppointmentDetails, appointmentDetailsTable);
                    EmailHelper.SentMail(mailFrom, patientEmail, patientEmailSubject, patientEmailBody, userName, password);
                }

                PractitionerData practitionerDataLayer = new PractitionerData();
                string           practitionerEmail     = practitionerDataLayer.GetPractitionerEmail(model.PractitionerId);
                if (!String.IsNullOrEmpty(practitionerEmail))
                {
                    //Sent notification email to practitioner
                    string practitionerEmailSubject = ConstantHelper.Email.AppointmentVerification.NewAppointmentSubject;
                    string practitionerEmailBody    = ConstantHelper.Email.AppointmentVerification.NewAppointmentBody;
                    //replace maybe link to practitionerLogin
                    string practitionerLoginPage = "<a href='" + ConstantHelper.AppSettings.RootSiteUrl + ConstantHelper.API.Practitioner.PractitionerLogin + "'>Practitioner Login Page</a>";
                    practitionerEmailBody = practitionerEmailBody.Replace(ConstantHelper.Email.Keyword.PractitionerLoginPage, practitionerLoginPage);
                    EmailHelper.SentMail(mailFrom, practitionerEmail, practitionerEmailSubject, practitionerEmailBody, userName, password);
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PatientBusiness.SentEmailNotification : " + err);
            }
        }
コード例 #29
0
        public ActionResult Products(Guid practitionerId)
        {
            if (practitionerId != null)
            {
                if (!practitionerId.Equals(Guid.Empty))
                {
                    List <MedicineModel>      result = new List <MedicineModel>();
                    PractitionerBaseViewModel vm     = new PractitionerBaseViewModel();
                    vm.AccId = practitionerId;
                    PractitionerProcess processLayer = new PractitionerProcess();
                    result = processLayer.GetProducts(vm);

                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                throw new UnauthorizedAccessException("Error! Not Authorized.", new Exception("No Practitioner Id Found!"));
            }

            return(View());
        }
コード例 #30
0
        public ActionResult ProfileEdit(PractitionerBaseViewModel vm, Guid accId)
        {
            PractitionerBaseViewModel result = new PractitionerBaseViewModel();

            result.AccId = accId;

            PractitionerProcess process = new PractitionerProcess();
            int returnValue             = process.ProfileEdit(vm);

            if (returnValue != 0)
            {
                return(RedirectToAction("Profile", "Practitioner", result));
            }
            else
            {
                return(Content(@"<body>
                           <script type='text/javascript'>
                             if(confirm('Profile is not updated successfully. Press Ok to try again.')){ window.history.back(); };
                           </script>
                         </body> "));
            }
        }