Ejemplo n.º 1
0
 private bool ValidateInputs()
 {
     if (NameTextBox.Text == String.Empty)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidUserNameWhileRegistering, "basicWrap", "Oops!"));
         NameTextBox.Focus();
         return(false);
     }
     if (MobileNumberTextBox.Text == String.Empty)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidMobileNumberWhileRegistering, "basicWrap", "Oops!"));
         MobileNumberTextBox.Focus();
         return(false);
     }
     if (Config.IsEnterpriseBuild)
     {
         if (string.IsNullOrWhiteSpace(HiddenEmailSecurityCodeTextBox.Text) || HiddenEmailSecurityCodeTextBox.Text.Length > 5)
         {
             Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidEmailSecurityCodeWhileRegistering, "basicWrap", "Oops!"));
             EmailSecurityCodeTextBox.Focus();
             return(false);
         }
     }
     if (string.IsNullOrWhiteSpace(HiddenSecurityCodeTextBox.Text) || HiddenSecurityCodeTextBox.Text.Length > 5)
     {
         Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidSecurityCodeWhileRegistering, "basicWrap", "Oops!"));
         SecurityCodeTextBox.Focus();
         return(false);
     }
     //TODO: If there is alerady profile exisits, return error message "Profile Already exisits"
     return(true);
 }
Ejemplo n.º 2
0
        private void ValidateButton_Click(object sender, EventArgs e)
        {
            if (!IsMobileNumberEdited && Config.IsEnterpriseBuild && (string.IsNullOrWhiteSpace(EnterpriseEmailTextBox.Text) || !EnterpriseEmailTextBox.Text.EndsWith(Config.EnterpriseEmailDomain)))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidEnterpriseEmailWhileRegistering, "basicWrap", "Oops!"));
                EnterpriseEmailTextBox.Focus();
                return;
            }

            selectedCountryCode = (CountryCodes)CountryCodeListPicker.SelectedItem;
            if (selectedCountryCode == null)
            {
                selectedCountryCode = (CountryCodes)CountryCodeListPicker.Items[0];
                CountryCodeListPicker.SelectedIndex = CountryCodeListPicker.Items.IndexOf(CountryCodeListPicker.Items.First(c => ((c as CountryCodes).IsdCode == Constants.CountryCode)));
            }
            if (MobileNumberTextBox.Text == String.Empty || MobileNumberTextBox.Text.Length > int.Parse(selectedCountryCode.MaxPhoneDigits))
            {
                Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.InvalidMobileNumberWhileRegistering, "basicWrap", "Oops!"));
                MobileNumberTextBox.Focus();
                return;
            }

            if (IsMobileNumberEdited)
            {
                if (selectedCountryCode.IsdCode + MobileNumberTextBox.Text.Trim() == Globals.CurrentProfile.MobileNumber)
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.MobileNumberEditingText, "basicWrap", "Oops!"));
                    MobileNumberTextBox.Focus();
                    return;
                }
            }
            //BL: Disable the button for 5 minutes
            //Call Server to send SMS/ email
            try
            {
                m_ProgressBar.Visibility = Visibility.Visible;

                MembershipServiceWrapper.ValidateMobileNumberAsync(NameTextBox.Text, LiveIdTextBox.Text, selectedCountryCode.IsdCode, MobileNumberTextBox.Text, EnterpriseEmailTextBox.Text);
                m_ProgressBar.Visibility = Visibility.Collapsed;
                ValidateNumber.IsEnabled = false;
                Task ignoredAwaitableResult = this.delayedWork();

                Deployment.Current.Dispatcher.BeginInvoke(() => Globals.DisplayToast(CustomMessage.MobileNumberValidatingSMSToast, "basicWrap", "Information!"));
            }
            catch (Exception)
            {
                m_ProgressBar.Visibility = Visibility.Collapsed;
            }
        }
Ejemplo n.º 3
0
 private void LoadExistingProfileDetails()
 {
     try
     {
         if (Globals.IsRegisteredUser)
         {
             //NameTextBox.Text = App.CurrentUser.User.Name;
             //LiveIdTextBox.Text = App.CurrentUser.User.LiveEmail;
             ProfileHeading.Text = "Update Mobile Number";
             string Number = App.MyProfiles.CurrentProfile.MobileNumber;
             MobileNumberTextBox.Text            = Number.Replace(Constants.CountryCode, "");
             ProfilePanel.Visibility             = Visibility.Visible;
             WaitTextBlock.Visibility            = Visibility.Collapsed;
             CountryCodeListPicker.SelectedIndex = CountryCodeListPicker.Items.IndexOf(CountryCodeListPicker.Items.First(c => ((c as CountryCodes).IsdCode == Constants.CountryCode)));
             MobileNumberTextBox.Focus();
             EnterpriseEmailPanel.Visibility = Visibility.Collapsed;
             EmailKeyPanel.Visibility        = Visibility.Collapsed;
         }
     }
     catch (Exception exception)
     {
         ExceptionHandler.ShowExceptionMessageAndLog(exception, true);
     }
 }