public SecurityUserViewModel MapToPatientAddressViewModel(SecurityUserDto securityUserDto) { if (securityUserDto == null) { return(null); } SecurityUserViewModel securityUserViewModel = new SecurityUserViewModel(); securityUserViewModel.SecurityUserId = securityUserDto.SecurityUserId; securityUserViewModel.UserName = securityUserDto.UserName; securityUserViewModel.Title = securityUserDto.Title; securityUserViewModel.Initials = securityUserDto.Initials; securityUserViewModel.FirstName = securityUserDto.FirstName; securityUserViewModel.LastName = securityUserDto.LastName; securityUserViewModel.IDNumber = securityUserDto.IDNumber; securityUserViewModel.BirthDate = securityUserDto.BirthDate; securityUserViewModel.Gender = securityUserDto.Gender; securityUserViewModel.WorkTelephoneCode = securityUserDto.WorkTelephoneCode; securityUserViewModel.WorkTelephoneNumber = securityUserDto.WorkTelephoneNumber; securityUserViewModel.FaxCode = securityUserDto.FaxCode; securityUserViewModel.FaxNumber = securityUserDto.FaxNumber; securityUserViewModel.MobileNumber = securityUserDto.MobileNumber; securityUserViewModel.EmailAddress = securityUserDto.EmailAddress; securityUserViewModel.EmployeeNumber = securityUserDto.EmployeeNumber; securityUserViewModel.DisabledDate = securityUserDto.DisabledDate; securityUserViewModel.PasswordSalt = securityUserDto.PasswordSalt; securityUserViewModel.Password = securityUserDto.Password; securityUserViewModel.FirstTimeLogInInd = securityUserDto.FirstTimeLogInInd; return(securityUserViewModel); }
public SecurityUserViewModel MapToPatientAddressViewModel(SecurityUserDto securityUserDto) { if (securityUserDto == null) { return(null); } SecurityUserViewModel securityUserViewModel = new SecurityUserViewModel(); securityUserViewModel.SecurityUserId = securityUserDto.SecurityUserId; securityUserViewModel.UserName = securityUserDto.UserName; securityUserViewModel.Title = securityUserDto.Title; securityUserViewModel.Initials = securityUserDto.Initials; securityUserViewModel.FirstName = securityUserDto.FirstName; securityUserViewModel.LastName = securityUserDto.LastName; securityUserViewModel.IDNumber = securityUserDto.IDNumber; securityUserViewModel.BirthDate = securityUserDto.BirthDate; securityUserViewModel.Gender = securityUserDto.Gender; securityUserViewModel.WorkTelephoneCode = securityUserDto.WorkTelephoneCode; securityUserViewModel.WorkTelephoneNumber = securityUserDto.WorkTelephoneNumber; securityUserViewModel.FaxCode = securityUserDto.FaxCode; securityUserViewModel.FaxNumber = securityUserDto.FaxNumber; securityUserViewModel.MobileNumber = securityUserDto.MobileNumber; securityUserViewModel.EmailAddress = securityUserDto.EmailAddress; securityUserViewModel.EmployeeNumber = securityUserDto.EmployeeNumber; securityUserViewModel.DisabledDate = securityUserDto.DisabledDate; if (securityUserDto.SecurityUserRoles != null && securityUserDto.SecurityUserRoles.Count > 0) { securityUserViewModel.SecurityUserRoleId = securityUserDto.SecurityUserRoles.FirstOrDefault().SecurityUserRoleId.Value; } return(securityUserViewModel); }
private void FormsAuthenticationLogin(SecurityUserViewModel securityUserViewModel) { string userDisplayName = securityUserViewModel.Title + " " + securityUserViewModel.FirstName + " " + securityUserViewModel.LastName; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, securityUserViewModel.SecurityUserId.Value.ToString(), DateTime.Now, DateTime.Now.AddMinutes(30), true, "User|" + securityUserViewModel.UserName + ", " + userDisplayName + ",Midrand Surgery", FormsAuthentication.FormsCookiePath); string encryptCookie = FormsAuthentication.Encrypt(ticket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptCookie); Response.Cookies.Add(authCookie); }
public ActionResult SaveUser(SecurityUserViewModel model) { try { Response.CacheControl = "no-cache"; SecurityUserViewModel securityUserViewModel = _IUserHandler.SaveUser(model); return(Json(new { ok = true, data = securityUserViewModel })); } catch (ModelException ex) { return(Json(new { errors = ex.ModelErrors })); } }
public ActionResult Login(LoginViewModel model) { try { SecurityUserViewModel response = _IUserHandler.Login(model.UserName, model.Password); string returnUrl = Url.Action("PatientManagement", "PatientManagement", new { area = "PatientManagement" }); FormsAuthenticationLogin(response); return(JavaScript("window.location='" + returnUrl + "'")); } catch (ModelException ex) { return(Json(new { errors = ex.ModelErrors })); } }
public SecurityUserViewModel SaveUser(SecurityUserViewModel securityUserViewModel) { SecurityUserDtoResponse response = _PhekoServiceClient.SaveUser(_SecurityUserViewModelMapper.MapToSecurityUserDto(securityUserViewModel)); if (response.HasErrors) { ModelException modelException = new ModelException(); response.FieldErrors.ToList <FieldError>().ForEach(item => modelException.ModelErrors.Add(new ModelError() { FieldName = item.FieldName, Message = item.ErrorMessage })); throw modelException; } return(_SecurityUserViewModelMapper.MapToPatientAddressViewModel(response.Model)); }
public SecurityUserDto MapToSecurityUserDto(SecurityUserViewModel securityUserViewModel) { if (securityUserViewModel == null) { return(null); } SecurityUserDto securityUserDto = new SecurityUserDto(); securityUserDto.SecurityUserId = securityUserViewModel.SecurityUserId; securityUserDto.UserName = securityUserViewModel.UserName; securityUserDto.Title = securityUserViewModel.Title; securityUserDto.Initials = securityUserViewModel.Initials; securityUserDto.FirstName = securityUserViewModel.FirstName; securityUserDto.LastName = securityUserViewModel.LastName; securityUserDto.IDNumber = securityUserViewModel.IDNumber; securityUserDto.BirthDate = securityUserViewModel.BirthDate; securityUserDto.Gender = securityUserViewModel.Gender; securityUserDto.WorkTelephoneCode = securityUserViewModel.WorkTelephoneCode; securityUserDto.WorkTelephoneNumber = securityUserViewModel.WorkTelephoneNumber; securityUserDto.FaxCode = securityUserViewModel.FaxCode; securityUserDto.FaxNumber = securityUserViewModel.FaxNumber; securityUserDto.MobileNumber = securityUserViewModel.MobileNumber; securityUserDto.EmailAddress = securityUserViewModel.EmailAddress; securityUserDto.EmployeeNumber = securityUserViewModel.EmployeeNumber; securityUserDto.DisabledDate = securityUserViewModel.DisabledDate; securityUserDto.SecurityUserRoles = new List <SecurityUserRoleDto> { { new SecurityUserRoleDto { SecurityRoleId = securityUserViewModel.SecurityUserRoleId.Value } } }; return(securityUserDto); }