Esempio n. 1
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));
        }
Esempio n. 2
0
        public ActionResult NewPatientRecord(string appointmentId, string practitionerId, string patientId)
        {
            NewPatientRecordViewModel result = new NewPatientRecordViewModel();

            PatientRecordModel newPatientRecord = new PatientRecordModel();

            if (appointmentId != null)
            {
                newPatientRecord.AppointmentId = Guid.Parse(appointmentId);
            }
            else
            {
                newPatientRecord.AppointmentId = Guid.Empty;
            }

            newPatientRecord.PractitionerId = Guid.Parse(practitionerId);
            newPatientRecord.PatientId      = Guid.Parse(patientId);

            //for appointment users and no appointment users
            //!newPatientRecord.AppointmentId.Equals(Guid.Empty)
            if (!newPatientRecord.PractitionerId.Equals(Guid.Empty) && !newPatientRecord.PatientId.Equals(Guid.Empty))
            {
                PractitionerProcess process = new PractitionerProcess();
                result = process.CreateNewPatientRecord(newPatientRecord);
            }
            //for not appointment user
            else
            {
                //no appointment made, retrive practitioner details
            }

            return(View(result));
        }
Esempio n. 3
0
        public ActionResult ViewRecord(string recordId, string practitionerId)
        {
            RecordFileSystem record = new RecordFileSystem();

            record.Id             = Guid.Parse(recordId);
            record.PractitionerId = Guid.Parse(practitionerId);
            PractitionerProcess process = new PractitionerProcess();
            RecordFileSystem    result  = new RecordFileSystem();

            result = process.GetRecord(record);

            if (result != null)
            {
                if (result.FileContentsString != null)
                {
                    result.FileContents = Convert.FromBase64String(result.FileContentsString);
                    FileContentResult fileResult = new FileContentResult(result.FileContents, ConstantHelper.AppSettings.RecordFileType);

                    return(fileResult);
                }

                return(new HttpNotFoundResult("Record Not Found!"));
            }
            else
            {
                return(new HttpNotFoundResult("Record Not Found!"));
            }
        }
Esempio n. 4
0
        public ActionResult Createproduct(MedicineModel newMedicine)
        {
            if (newMedicine != null)
            {
                PractitionerProcess process = new PractitionerProcess();
                int result = 0;
                result = process.CreateProduct(newMedicine);

                if (result != 0)
                {
                    return(Content(@"<body>
                        <script type='text/javascript'>
                            if(confirm('Product has been created successfully. Press Ok to close this tab.')){ window.close();window.opener.location.reload(); };
                        </script>
                    </body> "));
                }
                else
                {
                    return(Content(@"<body>
                        <script type='text/javascript'>
                            if(confirm('Product creation error. Press Ok to go back the view.')){ window.history.back(); };
                        </script>
                    </body> "));
                }
            }
            else
            {
                return(View());
            }
        }
Esempio n. 5
0
        public ActionResult SearchRecords(string recordId, string month, string year, string practitionerId)
        {
            List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>();

            if (recordId.Length == 36 || recordId.Length == 4)
            {
                PractitionerRecordSearch vm = new PractitionerRecordSearch();
                if (recordId.Length == 4)
                {
                    vm.RecordId = Guid.Empty;
                }
                else
                {
                    vm.RecordId = Guid.Parse(recordId);
                }
                //vm.Month = (Month)Enum.ToObject(typeof(Month), month);
                vm.Month = (Month)Enum.Parse(typeof(Month), month);
                vm.Year  = Convert.ToInt32(year);
                vm.AccId = Guid.Parse(practitionerId);

                if ((vm.Year > 1800 && vm.Year < 2200) || String.IsNullOrEmpty(year))
                {
                    PractitionerProcess process = new PractitionerProcess();
                    result = process.SearchRecords(vm);
                }
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 6
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> "));
            }
        }
Esempio n. 7
0
        public ActionResult Appointments(string practitionerId)
        {
            PractitionerProcess     process = new PractitionerProcess();
            List <AppointmentModel> result  = process.GetAppointmentsTable(practitionerId);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        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));
        }
Esempio n. 9
0
        public ActionResult PractitionerRegister()
        {
            NewPractitionerViewModel newUser = new NewPractitionerViewModel();
            PractitionerProcess      process = new PractitionerProcess();
            NewPractitionerViewModel result  = process.GetCompanyList(newUser);

            TempData["ConflictEmailAddress"] = "";

            return(View(result));
        }
Esempio n. 10
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));
        }
Esempio n. 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));
        }
Esempio n. 12
0
        public ActionResult AppointmentAbsent(string appointmentId)
        {
            Guid             id          = Guid.Parse(appointmentId);
            AppointmentModel appointment = new AppointmentModel();

            appointment.AppointmentId = id;
            PractitionerProcess process = new PractitionerProcess();
            int result = process.AppointmentAbsent(appointment);

            //if result = 1 then success, if 0 means fail
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 13
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));
     }
 }
Esempio n. 14
0
        public ActionResult SearchPatients(string firstName, string lastName, string practitionerId)
        {
            PatientsDirectorySearch search = new PatientsDirectorySearch();

            search.FirstName      = firstName;
            search.LastName       = lastName;
            search.PractitionerId = Guid.Parse(practitionerId);
            List <PatientsDirectory> result  = new List <PatientsDirectory>();
            PractitionerProcess      process = new PractitionerProcess();

            result = process.SearchPatients(search);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 15
0
        public ActionResult NewPatientRecord(NewPatientRecordViewModel vm)
        {
            PractitionerProcess process = new PractitionerProcess();

            vm.NewPatientRecord.MedicineDropDown = process.GetMedicinesDropDown(vm.PractitionerDetails);

            var test = vm.NewPatientRecord.MedicineDropDown[vm.NewPatientRecord.MedicinesId1];

            if ((vm.NewPatientRecord.AllergicBool.Equals("No")) || ((vm.NewPatientRecord.AllergicBool.Equals("Yes") && !String.IsNullOrEmpty(vm.NewPatientRecord.AllergicType))))
            {
                //Conversion to pdf
                var viewToString = RenderViewToString(ControllerContext, "~/Views/Shared/RecordTemplate.cshtml", vm, false);

                FileContentResult fileResult = new FileContentResult(PdfSharpConvert(viewToString), ConstantHelper.AppSettings.RecordFileType);

                RecordFileSystem fileRecord = new RecordFileSystem();
                fileRecord.Id               = vm.NewPatientRecord.RecordId;
                fileRecord.FileContents     = fileResult.FileContents;
                fileRecord.FileDownloadname = DateTime.Now.ToString("dd-MM-yyyy") + "-" + vm.PractitionerDetails.CompanyId + ".pdf";

                //Continue call to API
                vm.NewPatientRecord.CompanyId = vm.PractitionerDetails.CompanyId;
                int returnResult = process.StoreRecordToDB(fileRecord, vm.NewPatientRecord);

                if (returnResult != 0)
                {
                    //return fileResult;
                    return(Content(@"<body>
                        <script type='text/javascript'>
                            if(confirm('Patient Record updated successfully. Press Ok to close current tab.')){ window.close(); window.opener.location.reload(); };
                        </script>
                        </body> "));
                }
                else
                {
                    return(Content(@"<body>
                        <script type='text/javascript'>
                            if(confirm('Fail to insert record to database. Press ok to go back.')){ window.history.back(); };
                        </script>
                        </body> "));
                }
            }
            else
            {
                //Stop, return error
                return(Json(new { status = "Error", message = "Allergic selected is Yes. The textbox below it cannot be empty." }));
            }
            //return View(vm);
        }
Esempio n. 16
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));
        }
Esempio n. 17
0
        public ActionResult SearchProduct(string searchText, string productCode, string practitionerId)
        {
            if (!String.IsNullOrEmpty(practitionerId))
            {
                List <MedicineModel> result  = new List <MedicineModel>();
                PractitionerProcess  process = new PractitionerProcess();
                MedicineViewModel    vm      = new MedicineViewModel();
                vm.PractitionerId = Guid.Parse(practitionerId);
                vm.SearchText     = searchText;
                vm.ProductCode    = productCode;
                result            = process.SearchProduct(vm);

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            else
            {
                throw new UnauthorizedAccessException("Error! Not Authorized.", new Exception("No Practitioner Id Found!"));
            }
        }
Esempio n. 18
0
        public ActionResult ProductUpdate(string practitionerId, string productId)
        {
            if (practitionerId != null && productId != null)
            {
                MedicineModel medicine = new MedicineModel();
                medicine.PractitionerId = Guid.Parse(practitionerId);
                medicine.MedicineId     = Guid.Parse(productId);

                PractitionerProcess process = new PractitionerProcess();
                MedicineModel       result  = new MedicineModel();
                result = process.GetProduct(medicine);

                return(View(result));
            }
            else
            {
                return(new HttpNotFoundResult("Record Not Found!"));
            }
        }
Esempio n. 19
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());
        }
Esempio n. 20
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> "));
            }
        }
Esempio n. 21
0
        public ActionResult CompanyRegister(CompanyViewModel newCompany)
        {
            PractitionerProcess process = new PractitionerProcess();

            TempData["ConflictEmailAddress"] = "";

            if (Request.Form["Submit"] != null)
            {
                if (newCompany.CompanyEmailAddress.Equals(newCompany.ReconfirmEmail))
                {
                    if (ModelState.IsValid)
                    {
                        int result = process.CompanyRegister(newCompany);

                        if (result == 1)
                        {
                            TempData["CompanySuccess"] = "CompanySuccess";
                            return(RedirectToAction("AccCreateSuccess", "HomePage", null));
                        }
                        else if (result == 2)
                        {
                            TempData["ConflictEmailAddress"] = "ConflictEmailAddress";
                            return(View(newCompany));
                        }
                        else
                        {
                            return(View(newCompany));
                        }
                    }
                }
                else
                {
                    return(View(newCompany));
                }
            }
            return(View(newCompany));
        }
Esempio n. 22
0
        public ActionResult PractitionerRegister(NewPractitionerViewModel newUser)
        {
            PractitionerProcess process = new PractitionerProcess();

            TempData["ConflictEmailAddress"] = "";

            if (Request.Form["Submit"] != null)
            {
                if (newUser.EmailAddress.Equals(newUser.ReconfirmEmail) && newUser.Password.Equals(newUser.RetypePassword))
                {
                    if (ModelState.IsValid)
                    {
                        int result = process.PractitionerRegister(newUser);

                        if (result == 1)
                        {
                            return(RedirectToAction("AccCreateSuccess", "HomePage", null));
                        }
                        else if (result == 2)
                        {
                            TempData["ConflictEmailAddress"] = "ConflictEmailAddress";
                            return(View(newUser));
                        }
                        else
                        {
                            return(View(newUser));
                        }
                    }
                }
                else
                {
                    return(View(newUser));
                }
            }
            return(View(newUser));
        }