/// <summary> /// Updates user system information over user contract client. /// </summary> /// <param name="dto">User dto which has to be updated.</param> public void UpdateUsersSystemInformationDetails(UserSystemInformationDto dto) { _usic.UpdateUsersSystemInformationDetails(dto); }
/// <summary> /// Inserts user system information over user contract client. /// </summary> /// <param name="dto">User dto which has to be inserted.</param> public void InsertUsersSystemInformationDetails(UserSystemInformationDto dto) { _usic.InsertUsersSystemInformationDetails(dto); }
/// <summary> /// Performs validation entries from tbUserName and tbPassword and /// returns condition for login operation /// </summary> /// <returns>Returns true if validation process passes, otherwise returns false.</returns> private Boolean ValidateUserNameAndPassword() { String enteredUserName = tbUserName.Text; String enteredPassword = tbPassword.Text; List<UserDto> users = null; List<UserSystemInformationDto> userSystemInfos = null; try { users = userPresenter.GetAllUsers(); userSystemInfos = userSystemInformationPresenter.GetAllUsersSystemInformationDetails(); userEntered = users.Find(delegate(UserDto user) { return user.UserName == tbUserName.Text; }); } catch (Exception exception) { //message which will be shown string message = exception.Message; //if exception have inner exception, show his message, too if (exception.InnerException != null) message += exception.InnerException.Message; //shows message in message box MessageBox.Show(message, exception.GetType().Name); } if (userEntered != null) { if (userEntered.UserPassword == tbPassword.Text) { enteredUserSystemInformation = userSystemInfos.Find( delegate(UserSystemInformationDto userSysInfo) { return userSysInfo.UserId == userEntered.UserId; }); return true; } } return false; }
/// <summary> /// Deletes user system information over user contract client. /// </summary> /// <param name="dto">User dto which has to be deleted.</param> public void DeleteUsersSystemInformationDetails(UserSystemInformationDto dto) { _usic.DeleteUsersSystemInformationDetails(dto); }
/// <summary> /// Fills all fields in form with data from passed dto object. /// </summary> /// <param name="dto">UserDto which represents current user (logged or selected)</param> private void PopulateFields(UserDto currentUserDto, UserPersonalDetailsDto currentUserPersonalDetailsDto, UserSystemInformationDto currentUserSystemInformationDto, UserContactDetailsDto currentUserContactDetailsDto, AddressDto currentAddressDto) { //Populate all text boxes tbUserId.Text = currentUserDto.UserId.ToString(); tbUserName.Text = currentUserDto.UserName; tbFirstName.Text = currentUserPersonalDetailsDto.FirstName; tbLastName.Text = currentUserPersonalDetailsDto.LastName; tbUserPassword.Text = currentUserDto.UserPassword; tbSocialSecurityNumber.Text = currentUserPersonalDetailsDto.SocSecNumber; tbLastSuccessfullLogIn.Text = currentUserSystemInformationDto.LastSuccessfullLogIn; tbUserLoggedIn.Text = currentUserSystemInformationDto.IsLoggedIn; tbAddress1.Text = currentAddressDto.AddressLine1; tbAddress2.Text = currentAddressDto.AddressLine2; tbAddress3.Text = currentAddressDto.AddressLine3; tbCity.Text = currentAddressDto.City; tbZip.Text = currentAddressDto.Zip; tbTelephone.Text = currentUserContactDetailsDto.Telephone; tbMobilePhone.Text = currentUserContactDetailsDto.Mobile; //Populate all combo boxes cbUserType.DataSource = UserTypeDtoList; cbUserType.DisplayMember = "UserTypeName"; cbUserType.ValueMember = "id"; cbUserType.DropDownStyle = ComboBoxStyle.DropDownList; cbUserType.SelectedIndex = currentUserSystemInformationDto.UserTypeId - 1; cbCountry.DataSource = CountryDtoList; cbCountry.DisplayMember = "Name"; cbCountry.ValueMember = "id"; cbCountry.DropDownStyle = ComboBoxStyle.DropDownList; cbCountry.SelectedIndex = currentAddressDto.CountryId - 1; cbState.DataSource = StateDtoList; cbState.DisplayMember = "Name"; cbState.ValueMember = "id"; cbState.DropDownStyle = ComboBoxStyle.DropDownList; cbState.SelectedIndex = currentAddressDto.StateId - 1; }