/// <summary> /// Handles the Click event of the Next control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void Next_Click(object sender, RoutedEventArgs e) { bool membershipCodeValid = ValidateMembershipCode(MembershipTextBox.Text); if (membershipCodeValid) { User user = BaseController.LoggedOnUser; try { bool isAddBetteryMemberSuccess; using (KioskServiceClient proxy = new KioskServiceClient()) { isAddBetteryMemberSuccess = proxy.AddBetteryMember(user.FirstName, user.LastName, user.Email, user.Password, user.Zipcode.ToString(CultureInfo.CurrentCulture), user.IsEmailSubscription, user.SubscriptionPlan); } if (isAddBetteryMemberSuccess) { Start page = new Start(); this.NavigationService.Navigate(page); } } catch (Exception ex) { // TODO: log error message } } }
/// <summary> /// Saves the registration user. /// </summary> /// <returns>Save registration user of state</returns> public static bool?SaveRegistrationUser() { bool?isSuccess = true; BetteryUser user = BaseController.RegistrationUser; using (KioskServiceClient client = new KioskServiceClient()) { try { string Hash; string Salt; HashUtils hashUtils = new HashUtils(); hashUtils.GetHashAndSaltString(user.Password, out Hash, out Salt); user.PasswordDigest = Hash + Salt; isSuccess = client.AddBetteryMember(user.MemberFirstName, user.MemberLastName, user.Email, user.PasswordDigest, user.ZipCode, user.GetEmails, 0); } catch (Exception ex) { Logger.Log(EventLogEntryType.Error, ex, BaseController.StationId); BaseController.RaiseOnThrowExceptionEvent(); isSuccess = null; } finally { client.Close(); } } return(isSuccess); }