コード例 #1
0
        public ActionResult Home(PatientBaseViewModel vm)
        {
            if (vm.AccId.Equals(Guid.Empty))
            {
                return(RedirectToAction("PatientLogin", "HomePage", null));
            }
            else
            {
                PatientProcess       process = new PatientProcess();
                PatientBaseViewModel result  = process.PatientProfile(vm);

                result.DateOfBirth = result.DateOfBirth.ToLocalTime();

                if (result.AccId.Equals(Guid.Empty))
                {
                    return(RedirectToAction("PatientLogin", "HomePage", null));
                }
                else if (result != null)
                {
                    return(View(result));
                }
                else
                {
                    return(RedirectToAction("PatientLogin", "HomePage", null));
                }
            }
        }
コード例 #2
0
ファイル: HomePageController.cs プロジェクト: JesperMoon/FYP
        public ActionResult PatientLogin(LoginInfo loginInfo)
        {
            LoginInfo result = new LoginInfo();

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

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

                    //Account found
                    if (result.AccountNo != Guid.Empty)
                    {
                        //Check Status
                        if (result.AccountStatus.Equals(ConstantHelper.AccountStatus.Active))
                        {
                            FormsAuthentication.SetAuthCookie(result.AccountNo.ToString(), false);
                            PatientBaseViewModel vm = new PatientBaseViewModel();
                            vm.AccId = result.AccountNo;
                            return(RedirectToAction("Home", "Patient", 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));
        }
コード例 #3
0
ファイル: PatientController.cs プロジェクト: JesperMoon/FYP
        public List <AuthorizedPractitionersTable> AuthorizedPractitionersTable(PatientBaseViewModel vm)
        {
            List <AuthorizedPractitionersTable> result = new List <AuthorizedPractitionersTable>();

            PatientBusiness businessLayer = new PatientBusiness();

            result = businessLayer.GetAuthorizedPractitionersTable(vm.AccId);

            return(result);
        }
コード例 #4
0
ファイル: PatientController.cs プロジェクト: JesperMoon/FYP
        public PatientBaseViewModel PatientProfile(PatientBaseViewModel vm)
        {
            PatientBaseViewModel result = new PatientBaseViewModel();
            Guid accId = vm.AccId;

            PatientBusiness businessLayer = new PatientBusiness();

            result = businessLayer.PatientProfile(accId);

            return(result);
        }
コード例 #5
0
ファイル: PatientController.cs プロジェクト: JesperMoon/FYP
        public List <PractitionerRecordsDirectory> GetRecordsDirectory(PatientBaseViewModel vm)
        {
            List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>();

            if (vm != null)
            {
                PatientBusiness businessLayer = new PatientBusiness();
                result = businessLayer.GetRecordsDirectory(vm.AccId);
            }

            return(result);
        }
コード例 #6
0
        public ActionResult Records(string patientId)
        {
            PatientBaseViewModel vm = new PatientBaseViewModel();

            vm.AccId = Guid.Parse(patientId);
            List <PractitionerRecordsDirectory> result = new List <PractitionerRecordsDirectory>();
            PatientProcess process = new PatientProcess();

            result = process.GetRecordsDirectory(vm);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
ファイル: PatientController.cs プロジェクト: JesperMoon/FYP
        public int ProfileEdit(PatientBaseViewModel profile)
        {
            int result = 0;

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

            return(result);
        }
コード例 #8
0
        public ActionResult AuthorizedUsers(string patientId)
        {
            AuthorizedPractitionersViewModel result = new AuthorizedPractitionersViewModel();
            PatientBaseViewModel             vm     = new PatientBaseViewModel();

            vm.AccId = Guid.Parse(patientId);

            PatientProcess process = new PatientProcess();

            result.AuthorizedPractitionersTable = process.AuthorizedPractitionersTable(vm);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
 public ActionResult AuthorizedUsers(PatientBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PatientLogin", "HomePage", null));
     }
     else
     {
         PatientBaseViewModel result = new PatientBaseViewModel();
         result.AccId = vm.AccId;
         return(View(result));
     }
 }
コード例 #10
0
 public ActionResult SpecialistNearby(PatientBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PatientLogin", "HomePage", null));
     }
     else
     {
         //vm.SpecialistNearby.Specialist = Enum.GetValues(typeof(Specialist)).Cast<Specialist>().Select(v => v.ToString()).ToList();
         //vm.SpecialistNearby.State = Enum.GetValues(typeof(State)).Cast<State>().Select(v => v.ToString()).ToList();
         return(View(vm));
     }
 }
コード例 #11
0
        public int ProfileEdit(PatientBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

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

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

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

            return(result);
        }
コード例 #12
0
 public ActionResult Records(PatientBaseViewModel vm)
 {
     if (vm.AccId.Equals(Guid.Empty))
     {
         return(RedirectToAction("PatientLogin", "HomePage", null));
     }
     else
     {
         PatientBaseViewModel result = new PatientBaseViewModel();
         result.AccId = vm.AccId;
         result.PractitionerRecordSearch.Year = DateTime.Now.Year;
         return(View(result));
     }
 }
コード例 #13
0
        public List <PractitionerRecordsDirectory> GetRecordsDirectory(PatientBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

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

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

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

            return(result);
        }
コード例 #14
0
        public List <AuthorizedPractitionersTable> AuthorizedPractitionersTable(PatientBaseViewModel vm)
        {
            var client = new RestClient(ConstantHelper.AppSettings.BackEndUrl);

            RestRequest request = new RestRequest(ConstantHelper.API.Patient.AuthorizedPractitionersTable, Method.POST);

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

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

            return(result);
        }
コード例 #15
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));
        }
コード例 #16
0
        public ActionResult ProfileEdit(PatientBaseViewModel vm)
        {
            if (vm.AccId.Equals(Guid.Empty))
            {
                return(RedirectToAction("PatientLogin", "HomePage", null));
            }
            else
            {
                vm.State             = (State)Enum.Parse(typeof(State), vm.StateString);
                vm.Religion          = (Religion)Enum.Parse(typeof(Religion), vm.ReligionString);
                vm.DateOfBirthString = vm.DateOfBirth.ToString("yyyy-MM-dd");

                return(View(vm));
            }
        }
コード例 #17
0
        public int ProfileEdit(PatientBaseViewModel profile)
        {
            PatientData dataLayer = new PatientData();

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

            if (String.IsNullOrEmpty(profile.ContactNumber3))
            {
                profile.ContactNumber3 = "";
            }
            int result = 0;

            result = dataLayer.ProfileEdit(profile);

            return(result);
        }
コード例 #18
0
ファイル: PractitionerProcess.cs プロジェクト: JesperMoon/FYP
        public PatientBaseViewModel ViewPatient(PatientBaseViewModel patientModel)
        {
            PatientBaseViewModel result = new PatientBaseViewModel();

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

            RestRequest request = new RestRequest(ConstantHelper.API.Patient.PatientProfile, Method.POST);

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

            IRestResponse <PatientBaseViewModel> response = client.Execute <PatientBaseViewModel>(request);

            result = response.Data;

            return(result);
        }
コード例 #19
0
        public PatientBaseViewModel PatientProfile(Guid accId)
        {
            PatientBaseViewModel result = new PatientBaseViewModel();

            result.AccId = accId;

            try
            {
                PatientData dataLayer = new PatientData();
                result = dataLayer.PatientProfile(accId);
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PatientBusiness.PatientProfile : " + err);
            }

            return(result);
        }
コード例 #20
0
ファイル: PatientData.cs プロジェクト: JesperMoon/FYP
        public PatientBaseViewModel PatientProfile(Guid accId)
        {
            PatientBaseViewModel result = new PatientBaseViewModel();

            try
            {
                using (var context = new ApplicationContext())
                {
                    var query = from pt in context.Patient
                                where pt.Id.Equals(accId)
                                select pt;

                    var patient = query.Select(p => p).FirstOrDefault();

                    if (query != null)
                    {
                        result.AccId            = accId;
                        result.FirstName        = patient.FirstName;
                        result.LastName         = patient.LastName;
                        result.UserName         = patient.UserName;
                        result.Gender           = patient.Gender;
                        result.ReligionString   = patient.Religion;
                        result.DateOfBirth      = patient.DateOfBirth.ToLocalTime();
                        result.EmailAddress     = patient.EmailAddress;
                        result.ContactNumber1   = patient.ContactNumber1;
                        result.ContactNumber2   = patient.ContactNumber2;
                        result.ContactNumber3   = patient.ContactNumber3;
                        result.HomeAddressLine1 = patient.HomeAddress1;
                        result.HomeAddressLine2 = patient.HomeAddress2;
                        result.HomeAddressLine3 = patient.HomeAddress3;
                        result.City             = patient.City;
                        result.PostalCode       = patient.PostalCode.ToString();
                        result.StateString      = patient.State;
                        result.BloodTypeString  = patient.BloodType;
                    }
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PatientData.PatientProfile : " + err);
            }

            return(result);
        }
コード例 #21
0
ファイル: PatientData.cs プロジェクト: JesperMoon/FYP
        public int ProfileEdit(PatientBaseViewModel profile)
        {
            int result = 0;

            try
            {
                using (var context = new ApplicationContext())
                {
                    var patientProfile = context.Patient.Where(p => p.Id.Equals(profile.AccId) && p.Status.Equals(ConstantHelper.AccountStatus.Active)).FirstOrDefault();

                    //profile found
                    if (patientProfile != null)
                    {
                        patientProfile.FirstName      = profile.FirstName;
                        patientProfile.LastName       = profile.LastName;
                        patientProfile.UserName       = profile.UserName;
                        patientProfile.Gender         = profile.Gender;
                        patientProfile.Religion       = profile.Religion.ToString();
                        patientProfile.DateOfBirth    = profile.DateOfBirth;
                        patientProfile.EmailAddress   = profile.EmailAddress;
                        patientProfile.ContactNumber1 = profile.ContactNumber1;
                        patientProfile.ContactNumber2 = profile.ContactNumber2;
                        patientProfile.ContactNumber3 = profile.ContactNumber3;
                        patientProfile.HomeAddress1   = profile.HomeAddressLine1;
                        patientProfile.HomeAddress2   = profile.HomeAddressLine2;
                        patientProfile.HomeAddress3   = profile.HomeAddressLine3;
                        patientProfile.PostalCode     = Convert.ToInt32(profile.PostalCode);
                        patientProfile.City           = profile.City;
                        patientProfile.State          = profile.State.ToString();

                        result = context.SaveChanges();
                    }
                }
            }
            catch (Exception err)
            {
                new LogHelper().LogMessage("PatientData.ProfileEdit : " + err);
            }

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

            result.AccId = accId;

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


            if (returnValue != 0)
            {
                return(RedirectToAction("Home", "Patient", 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> "));
            }
        }