public ActionResult SaveNewAppointments(AppointmentModel appointmentModel)
        {
            string doctorId = User.GetId();

            PatientProfileModel ppm = new PatientProfileModel {
                FirstName   = appointmentModel.FirstName,
                LastName    = appointmentModel.LastName,
                Email       = appointmentModel.Email,
                PhoneNumber = appointmentModel.PhoneNumber
            };

            Guid _patinetId = _applicationClientRepository.SaveClientProfile(ppm, doctorId);

            Appointments appointments = new Appointments {
                //BeforeOPDAppointmentTime = appointmentModel.BeforeOPDAppointmentTime,
                DoctorId  = new Guid(doctorId),
                PatientId = _patinetId
            };

            appointments.AfterOPDActualAppointmentTime = DateTime.Now;
            appointments.BeforeOPDAppointmentTime      = DateTime.Now;

            _appointmentRepository.SaveAppointment(appointments);

            return(Json(new { isTrue = true }));
        }
Exemple #2
0
        public static PatientProfileModel ToModel(this PatientProfileViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new PatientProfileModel
            {
                ContactID                   = model.ContactID,
                ClientTypeID                = model.ClientTypeID,
                FirstName                   = model.FirstName,
                Middle                      = model.Middle,
                LastName                    = model.LastName,
                PreferredName               = model.PreferredName,
                MRN                         = model.MRN,
                CareID                      = model.CareID,
                GenderID                    = model.GenderID,
                DOB                         = model.DOB,
                LegalStatusID               = model.LegalStatusID,
                EmergencyContactFirstName   = model.EmergencyContactFirstName,
                EmergencyContactLastName    = model.EmergencyContactLastName,
                EmergencyContactPhoneNumber = model.EmergencyContactPhoneNumber,
                EmergencyContactExtension   = model.EmergencyContactExtension,
                ModifiedOn                  = model.ModifiedOn
            };

            return(entity);
        }
        /// <summary>
        /// Patient Profile Failed
        /// </summary>
        private void PatientProfile_Failed()
        {
            Mock <IPatientProfileRuleEngine> mock = new Mock <IPatientProfileRuleEngine>();

            patientProfileRuleEngine = mock.Object;

            var patientProfileModels = new List <PatientProfileModel>();

            patientProfileModel = new PatientProfileModel()
            {
                ContactID     = 0,
                ClientTypeID  = 1,
                FirstName     = "FirstName",
                Middle        = "MiddleName",
                LastName      = "LastName",
                GenderID      = 1,
                DOB           = DateTime.Now,
                PreferredName = "PreferredName",
            };

            patientProfileModels.Add(patientProfileModel);
            var financialAssessment = new Response <PatientProfileModel>()
            {
                DataItems   = null,
                RowAffected = 0
            };

            //Get PatientProfile
            Response <PatientProfileModel> patientProfileResponse = new Response <PatientProfileModel>();

            patientProfileResponse.DataItems = patientProfileModels.Where(contact => contact.ContactID == contactId).ToList();

            mock.Setup(r => r.GetPatientProfile(It.IsAny <long>()))
            .Returns(patientProfileResponse);
        }
Exemple #4
0
        public ActionResult EditProfile(PatientProfileModel model)
        {
            //if (model != null)
            //{

            //    _patientProfileService.Update(model);
            //    return RedirectToAction("Profile", "Patient");
            //}
            if (model != null)
            {
                model = new PatientProfileModel()
                {
                    Id          = 1,
                    Name        = model.Name,
                    Password    = model.Password,
                    Age         = model.Age,
                    Email       = model.Email,
                    Birthday    = model.Birthday,
                    BloodGroup  = model.BloodGroup,
                    Gender      = model.Gender,
                    District    = model.District,
                    Division    = model.Division,
                    CreatedDate = DateTime.UtcNow,
                    UpdatedDate = DateTime.UtcNow
                };
                _patientProfileService.Update(model);
                return(RedirectToAction("Profile", "Patient"));
            }
            return(View());
        }
        public ActionResult SaveNewPatient(PatientProfileModel ppm)
        {
            string doctorId = User.GetId();

            Guid clientId = _applicationClientRepository.SaveClientProfile(ppm, doctorId);

            bool isSaved = clientId != Guid.Empty ? true : false;

            return(Json(new { result = isSaved }));
        }
        public Guid SaveClientProfile(PatientProfileModel patientProfileModel, string doctorId)
        {
            ApplicationClient applicationClient = new ApplicationClient();

            using (var ctx = new ApplicationDbContext())
            {
                // applicationOperator = GetDoctorDetails(userId);

                ctx.Configuration.ProxyCreationEnabled = true;
                ctx.Configuration.LazyLoadingEnabled   = true;
                applicationClient.FirstName            = patientProfileModel.FirstName;
                applicationClient.LastName             = patientProfileModel.LastName;
                applicationClient.ParentOperatorId     = doctorId;

                ctx.ApplicationClients.Add(applicationClient);
                //ctx.Entry(applicationClient).CurrentValues.SetValues(applicationClient);
                ctx.SaveChanges();
            }
            return(applicationClient.ApplicationClientId);
        }
Exemple #7
0
        public ActionResult Registration(RegistrationViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Type == "Doctor")
                {
                    DoctorProfileModel doctor = new DoctorProfileModel();
                    doctor.FullName   = model.Name;
                    doctor.Email      = model.Email;
                    doctor.Password   = model.Password;
                    doctor.Gender     = "Female";
                    doctor.Specialist = "Dentist";
                    doctor.Location   = "Rajshahi";
                    doctor.Phone      = "017XXXXXXXX";
                    doctor.NewFee     = 1000;
                    doctor.OldFee     = 750;
                    _doctorProfileService.Insert(doctor);
                    return(RedirectToAction("Login", "Account"));
                }
                else if (model.Type == "Patient")
                {
                    PatientProfileModel patient = new PatientProfileModel();
                    patient.Name       = model.Name;
                    patient.Email      = model.Email;
                    patient.Password   = model.Password;
                    patient.Gender     = "Female";
                    patient.BloodGroup = "B+";
                    patient.District   = "Dhaka";
                    _patientProfileService.Insert(patient);

                    return(RedirectToAction("Login", "Account"));
                }
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                return(View(model: model));
            }
        }
Exemple #8
0
        public ActionResult Registration(RegistrationViewModel model)
        {
            bool   statusRegistration  = false;
            string messageRegistration = string.Empty;

            if (ModelState.IsValid)
            {
                // Email Verification
                string userName = Membership.GetUserNameByEmail(model.Email);
                if (!string.IsNullOrEmpty(userName))
                {
                    ModelState.AddModelError("Warning Email", "Sorry: Email already Exists");
                    return(View(model));
                }

                //Save User Data
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        var user = new User()
                        {
                            Username       = model.Name,
                            Email          = model.Email,
                            Password       = model.Password,
                            ActivationCode = Guid.NewGuid(),
                            IsActive       = true
                        };
                        int UserId = _helper.CreateUser(user);
                        int RoleId = _helper.GetRoleIdByRoleName(model.Type);
                        _helper.CreateRole(UserId, RoleId);
                        if (model.Type == "Doctor")
                        {
                            DoctorProfileModel doctor = new DoctorProfileModel();
                            doctor.FullName = model.Name;
                            doctor.Email    = model.Email;
                            doctor.Password = model.Password;
                            //doctor.Gender = "Female";
                            //doctor.Specialist = "Dentist";
                            //doctor.Location = "Rajshahi";
                            //doctor.Phone = "017XXXXXXXX";
                            //doctor.NewFee = 1000;
                            //doctor.OldFee = 750;
                            _doctorProfileService.Insert(doctor);
                            scope.Complete();
                            return(RedirectToAction("Login", "Account"));
                        }
                        else if (model.Type == "Patient")
                        {
                            PatientProfileModel patient = new PatientProfileModel();
                            patient.Name     = model.Name;
                            patient.Email    = model.Email;
                            patient.Password = model.Password;
                            //patient.Gender = "Female";
                            //patient.BloodGroup = "B+";
                            //patient.District = "Dhaka";
                            _patientProfileService.Insert(patient);
                            scope.Complete();
                            return(RedirectToAction("Login", "Account"));
                        }
                        else
                        {
                            return(null);
                        }
                    }
                    catch (Exception ex)
                    {
                        // Log error
                        scope.Dispose();
                        throw ex;
                    }
                }


                ////Verification Email
                //messageRegistration = "Your account has been created successfully. ^_^";
                //statusRegistration = true;
            }
            else
            {
                messageRegistration = "Something Wrong!";
                return(View(model));
            }
            ViewBag.Message = messageRegistration;
            ViewBag.Status  = statusRegistration;
        }
Exemple #9
0
 public new ActionResult Profile(PatientProfileModel model)
 {
     return(View(model: _patientProfileService.Find(1)));
 }