示例#1
0
        public void FillSupportForm()
        {
            //ComboBoxHelper.SelectElement(EnquiryReasonDropDown, value);
            var modelFaker = new Faker <DataModel>()
                             .RuleFor(o => o.firstName, f => f.Name.FirstName())
                             .RuleFor(o => o.lastName, f => f.Name.LastName())
                             .RuleFor(o => o.emailAddress, f => f.Internet.Email())
                             .RuleFor(o => o.phoneNumber, f => f.Phone.PhoneNumber())
                             .RuleFor(o => o.websiteUrl, f => f.Internet.Url())
                             .RuleFor(o => o.company, f => f.Company.CompanyName())
                             .RuleFor(o => o.reason, f => f.PickRandom <Reason>())
                             .RuleFor(o => o.message, f => f.Lorem.Sentence());


            var    dataModel    = modelFaker.Generate();
            string firstName    = dataModel.firstName;
            string lastName     = dataModel.lastName;
            string emailAddress = dataModel.emailAddress;
            string phoneNumber  = dataModel.phoneNumber;
            string websiteurl   = dataModel.websiteUrl;
            string company      = dataModel.company;
            string reason       = dataModel.reason.ToString();
            string message      = dataModel.message;

            FirstNameTextBox.SendKeys(firstName);
            LastNameTextBox.SendKeys(lastName);
            EmailAddressTextBox.SendKeys(emailAddress);
            PhoneNumberTextBox.SendKeys(phoneNumber);
            WebsiteUrlTextBox.SendKeys(websiteurl);
            CompanyTextBox.SendKeys(company);
            EnquiryReasonDropDown.SendKeys(reason);
            MessageTextBox.SendKeys(message);
        }
 private void ClearFormData()
 {
     FirstNameTextBox.Clear();
     LastNameTextBox.Clear();
     EmailAddressTextBox.Clear();
     ContactNumberTextBox.Clear();
 }
示例#3
0
        private bool isFormValidate()
        {
            if (BranchNametextBox.Text.Trim() == "")
            {
                MessageBox.Show("Branch Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                BranchNametextBox.Clear();
                BranchNametextBox.Focus();
                return(false);
            }
            if (EmailAddressTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Email is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                EmailAddressTextBox.Clear();
                EmailAddressTextBox.Focus();
                return(false);
            }
            if (TelephoneTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Telephone is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TelephoneTextBox.Clear();
                TelephoneTextBox.Focus();
                return(false);
            }
            if (AddressLineTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Address is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AddressLineTextBox.Clear();
                AddressLineTextBox.Focus();
                return(false);
            }

            return(true);
        }
示例#4
0
        private bool isFormValid()
        {
            if (BranchNameTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Branch Name is required");
                BranchNameTextBox.Focus();
                return(false);
            }

            if (EmailAddressTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Email is required");
                EmailAddressTextBox.Focus();
                return(false);
            }

            if (TelephoneTextBox.Text.Trim() == string.Empty)
            {
                SMSMessageBox.ShowErrorMessage("Telephone is required");
                TelephoneTextBox.Focus();
                return(false);
            }

            return(true);
        }
 private void EmailAddressTextBox_Leave(object sender, EventArgs e)
 {
     if (EmailAddressTextBox.TextLength < 8)
     {
         EmailAddressTextBox.Focus();
         EmailAddressTextBox.SelectAll();
     }
 }
        private void ResetForm()
        {
            FirstNameTextBox.Clear();
            LastNameTextBox.Clear();
            EmailAddressTextBox.Clear();
            ContactNumberTextBox.Clear();

            // clear Contact ComboBox List Items
            ContactComboBox.Items.Clear();
        }
示例#7
0
        public Fraud()
        {
            InitializeComponent();
            // Get the file modified date, and generate appVersion from this date.
            DateTime CompiledDate = File.GetLastWriteTimeUtc(Environment.CurrentDirectory + "\\dashboard.exe");

            FraudTextBlock.Text       = "Sign up for free at http://ipqualityscore.com\nto get your Private Key.";
            FraudTextBlock.Foreground = Brushes.LightGray;

            EmailAddressTextBox.Text = Properties.Settings.Default.EmailAddress;
            PrivareKeyTextBox.Text   = Properties.Settings.Default.PrivateKey;

            EmailAddressTextBox.Focus();
        }
        /// <summary>
        /// Add EmailAddressTextBox.Text to List when AddToListButton on OnClick
        /// </summary>
        /// <param name="sender">Sender Parameter</param>
        /// <param name="e">Event Parameter</param>
        private void AddToListButtonOnClick(object sender, RoutedEventArgs e)
        {
            if (Regex.IsMatch(EmailAddressTextBox.Text, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase))
            {
                var emailAddress = new CustomEmailAddress()
                {
                    Email = EmailAddressTextBox.Text
                };

                vm.Add(emailAddress);
                EmailAddressTextBox.Clear();
            }
            else
            {
                MessageBox.Show("Please use a valid Email format");
            }
        }
示例#9
0
 /// <summary>
 /// Enter text into the 'Email Address' text box
 /// </summary>
 /// <param name="emailAddress">The applicants email address</param>
 public void EnterEmailAddress(string emailAddress)
 {
     EmailAddressTextBox.SendKeys(emailAddress);
 }
示例#10
0
        private bool IsFormValidate()
        {
            if (FullNameTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Full Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                FullNameTextBox.Clear();
                FullNameTextBox.Focus();
                return(false);
            }
            if (EmailAddressTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Email is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                EmailAddressTextBox.Clear();
                EmailAddressTextBox.Focus();
                return(false);
            }
            if ((TelephoneTextBox.Text.Trim() == "") && (MobileTextBox.Text.Trim() == ""))
            {
                MessageBox.Show("Mobile or Telephone Number is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TelephoneTextBox.Clear();
                TelephoneTextBox.Focus();
                return(false);
            }
            if (NICTextBox.Text.Trim() == "")
            {
                MessageBox.Show("NIC is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                NICTextBox.Clear();
                NICTextBox.Focus();
                return(false);
            }
            if (GenderComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Gender is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            if (AddressLineTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Address is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AddressLineTextBox.Clear();
                AddressLineTextBox.Focus();
                return(false);
            }
            if (CityComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("City is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (DistrictComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("District is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (PostCodeTextBox.Text.Trim() == "")
            {
                MessageBox.Show("PostCode is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PostCodeTextBox.Clear();
                PostCodeTextBox.Focus();
                return(false);
            }
            if (JobTitleComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Job Title is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (CurrentSalaryTextBox1.Text.Trim() == "")
            {
                MessageBox.Show("Current Salary is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CurrentSalaryTextBox1.Clear();
                CurrentSalaryTextBox1.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(CurrentSalaryTextBox1.Text.Trim()) < 1)
                {
                    MessageBox.Show("Current Salary can not be Zero or less than zero");
                    CurrentSalaryTextBox1.Focus();
                    return(false);
                }
            }
            if (StartingSalaryTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Starting Salary is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                StartingSalaryTextBox.Clear();
                StartingSalaryTextBox.Focus();
                return(false);
            }
            else
            {
                if (Convert.ToDecimal(StartingSalaryTextBox.Text.Trim()) < 1)
                {
                    MessageBox.Show("Starting Salary can not be Zero or less than zero");
                    StartingSalaryTextBox.Focus();
                    return(false);
                }
            }

            return(true);
        }
示例#11
0
        private string TextBoxValidation()
        {
            string errorMessage = string.Empty;

            if (FirstNameTextBox.Text.Length > 0 && FirstNameTextBox.Text != null)
            {
                this.FirstName = FirstNameTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for first name. Please enter a valid first name";

                FirstNameTextBox.Focus();
            }

            if (MiddleNameTextBox.Text != null)
            {
                this.MiddleName = MiddleNameTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for middle name. Please enter a valid middle name";

                MiddleNameTextBox.Focus();
            }

            if (LastNameTextBox.Text.Length > 0 && LastNameTextBox.Text != null)
            {
                this.LastName = LastNameTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for last name. Please enter a valid last name";

                LastNameTextBox.Focus();
            }

            if (CityTextBox.Text.Length > 0 && CityTextBox.Text != null)
            {
                this.City = CityTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for city. Please enter a valid city";

                CityTextBox.Focus();
            }

            if (StateTextBox.Text.Length > 0 && StateTextBox.Text != null)
            {
                this.State = StateTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for state. Please enter a valid state";

                StateTextBox.Focus();
            }

            if (CountryTextBox.Text.Length > 0 && CountryTextBox.Text != null)
            {
                this.Country = CountryTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for Country. Please enter a valid country";

                CountryTextBox.Focus();
            }

            if (PhoneNumberTextBox.Text.Length > 0 && PhoneNumberTextBox.Text != null)
            {
                this.PhoneNumber = PhoneNumberTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for phone number. Please enter a valid phone number";

                PhoneNumberTextBox.Focus();
            }

            if (EmailAddressTextBox.Text.Length > 0 && EmailAddressTextBox.Text != null)
            {
                this.EmailAddress = EmailAddressTextBox.Text;
            }
            else
            {
                errorMessage = "Invalid entry for email address. Please enter a valid email address";

                EmailAddressTextBox.Focus();
            }

            return(errorMessage);
        }
示例#12
0
        private void onOkClick(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(EmailAddressTextBox.Text))
            {
                FraudTextBlock.Text       = "PLease enter youe email address.";
                FraudTextBlock.Foreground = Brushes.Red;

                EmailAddressTextBox.Focus();
                SystemSounds.Beep.Play();
            }
            else if (String.IsNullOrEmpty(PrivareKeyTextBox.Text))
            {
                FraudTextBlock.Text       = "PLease enter youe private key.";
                FraudTextBlock.Foreground = Brushes.Red;

                PrivareKeyTextBox.Focus();
                SystemSounds.Beep.Play();
            }
            else if (PrivareKeyTextBox.Text.Length != 32)
            {
                FraudTextBlock.Text       = "Private key must be 32 characters long.";
                FraudTextBlock.Foreground = Brushes.Red;

                PrivareKeyTextBox.Focus();
                SystemSounds.Beep.Play();
            }
            else
            {
                try
                {
                    string Uri   = "https://www.ipqualityscore.com/api/xml/ip";
                    string Email = EmailAddressTextBox.Text;
                    string Key   = PrivareKeyTextBox.Text;

                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load($"{Uri}/{Key}/8.8.8.8");
                    XmlNode resultNode = xmlDoc.SelectSingleNode("//result");
                    if (!resultNode["success"].FirstChild.Value.Contains("true"))
                    {
                        FraudTextBlock.Text       = "Private key appears to be invalid.\nPlease enter a valid key from ipqualityscore.com";
                        FraudTextBlock.Foreground = Brushes.Red;

                        PrivareKeyTextBox.Focus();
                        SystemSounds.Beep.Play();
                    }
                    else
                    {
                        Properties.Settings.Default.EmailAddress   = EmailAddressTextBox.Text;
                        Properties.Settings.Default.PrivateKey     = PrivareKeyTextBox.Text;
                        Properties.Settings.Default.FraudDetection = true;
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    FraudTextBlock.Text       = ex.Message;
                    FraudTextBlock.Foreground = Brushes.Red;

                    PrivareKeyTextBox.Focus();
                    SystemSounds.Beep.Play();
                }
            }
        }