示例#1
0
        public ApiResultModel UpdatePatientProfileWithAllValues(PatientProfileVM model)
        {
            var strContent = JsonConvert.SerializeObject(model);
            var request    = ApiConsumerHelper.PostData("api/updatePatientProfileWithAllValues?patientID=" + model.PatientID, strContent);

            var result = JsonConvert.DeserializeObject <ApiResultModel>(request);

            return(result);
        }
示例#2
0
        public string SavePatientProfile(PatientProfileVM oModel)
        {
            try
            {
                oModel.ConvertBase64ToByteArray();
                var oRetMsg = oProfileRepository.UpdatePatientProfileWithAllValues(oModel);

                SessionHandler.ProfilePhoto   = oModel.ProfilePhotoBase64;
                SessionHandler.UserInfo.title = oModel.TitleName;
                var timezone = oProfileRepository.GetPatientTimeZone(SessionHandler.UserId);
                SessionHandler.UserInfo.timeZone       = timezone.zonename;
                SessionHandler.UserInfo.timeZoneOffset = timezone.zoneoffset;
                return(oRetMsg.message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
示例#3
0
        public ActionResult EditProfile(PatientProfileVM profile)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Guid authId = new Guid(User.Identity.Name);

                    // get data from db and assign new value to patient obj
                    Patient patient = context.Patients.SingleOrDefault(q => q.UserId == authId);

                    patient.UserId = authId;

                    patient.FirstName        = profile.FirstName;
                    patient.LastName         = profile.LastName;
                    patient.HealthCardNumber = String.IsNullOrEmpty(profile.HealthCardNumber) ? null : profile.HealthCardNumber;
                    patient.Gender           = String.IsNullOrEmpty(profile.Gender) ? null : profile.Gender;
                    patient.Address1         = String.IsNullOrEmpty(profile.Address1) ? null : profile.Address1;
                    patient.Address2         = String.IsNullOrEmpty(profile.Address2) ? null : profile.Address2;
                    patient.City             = String.IsNullOrEmpty(profile.City) ? null : profile.City;
                    patient.Province         = String.IsNullOrEmpty(profile.Province) ? null : profile.Province;
                    patient.PostalCode       = String.IsNullOrEmpty(profile.PostalCode) ? null : profile.PostalCode;
                    patient.DateOfBirth      = profile.DateOfBirth == null ? null : profile.DateOfBirth;
                    patient.Phone            = String.IsNullOrEmpty(profile.Phone) ? null : profile.Phone;

                    context.SaveChanges();

                    return(RedirectToAction("MyProfile"));
                }

                return(RedirectToAction("MyProfile"));
            }
            catch (DbUpdateException DbException)
            {
                ViewBag.DbExceptionMessage = ErrorHandler.DbUpdateHandler(DbException);
            }
            catch (Exception e)
            {
                ViewBag.ExceptionMessage = e.Message;
            }
            return(View("~/Views/Errors/Details.cshtml"));
        }
示例#4
0
 public string SaveSecretAnswers(PatientProfileVM oModel)
 {
     try
     {
         var oRetMsg = oProfileRepository.updatePatientSecretAnswers(SessionHandler.UserInfo.Id, new UpdateSecretQuestions
         {
             secretanswer1   = oModel.SectetAnswer1,
             secretanswer2   = oModel.SectetAnswer2,
             secretanswer3   = oModel.SectetAnswer3,
             secretquestion1 = oModel.SectetQuestion1,
             secretquestion2 = oModel.SectetQuestion2,
             secretquestion3 = oModel.SectetQuestion3,
             doctorID        = SessionHandler.UserInfo.Id
         });
         return(oRetMsg.message);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
示例#5
0
        public ActionResult EditProfile()
        {
            try
            {
                // Guid id = new Guid(Session["id"].ToString());
                Guid authId = new Guid(User.Identity.Name);

                // get data from db
                Patient patient = context.Patients.SingleOrDefault(q => q.UserId == authId);

                if (patient != null)
                {
                    // assigining value from db to VM
                    PatientProfileVM profile = new PatientProfileVM();
                    profile.FirstName        = patient.FirstName;
                    profile.LastName         = patient.LastName;
                    profile.Gender           = patient.Gender;
                    profile.HealthCardNumber = (String.IsNullOrEmpty(patient.HealthCardNumber)) ? null : patient.HealthCardNumber;
                    profile.Address1         = (String.IsNullOrEmpty(patient.Address1)) ? null : patient.Address1;
                    profile.Address2         = (String.IsNullOrEmpty(patient.Address1)) ? null : patient.Address2;
                    profile.City             = (String.IsNullOrEmpty(patient.City)) ? null : patient.City;
                    profile.Province         = (String.IsNullOrEmpty(patient.Province)) ? null : patient.Province;
                    profile.PostalCode       = (String.IsNullOrEmpty(patient.PostalCode)) ? null : patient.PostalCode;
                    profile.DateOfBirth      = patient.DateOfBirth;
                    profile.Phone            = (String.IsNullOrEmpty(patient.Phone)) ? null : patient.Phone;

                    ViewBag.PatientName = DisplayPatientName(patient);
                    return(View(profile));
                }

                return(RedirectToAction("Index", authId));
            }
            catch (Exception e)
            {
                ViewBag.ExceptionMessage = e.Message;
            }
            return(View("~/Views/Errors/Details.cshtml"));
        }