Esempio n. 1
0
 private void ClearTextBoxes()
 {
     TypeContactComboBox.ResetText();
     NameInput.Clear();
     StreetNameInput.Clear();
     ZipCodeInput.Clear();
     PostalAreaInput.Clear();
     PhoneNumberInput.Clear();
     EmailInput.Clear();
 }
Esempio n. 2
0
        private void RegisterSubmit_Click(object sender, RoutedEventArgs e)
        {
            //Getting the data from the page
            var name     = NameInput.Text;
            var password = PasswordInput.Password;
            var email    = EmailInput.Text;

            //Check before using adding to DB
            if (name.Length < 4)
            {
                MessageBox.Show("The name should be greater than 3 symbols!");
            }
            else if (password.Length < 5)
            {
                MessageBox.Show("The password should be greater than 4 symbols!");
            }
            else if (!email.Contains("@") || email.Length < 6)
            {
                MessageBox.Show("Invalid Email!");
            }
            else
            {
                using (var context = new EverydayJournalContext())
                {
                    try
                    {
                        context.People
                        .Add(new Person()
                        {
                            Name     = name,
                            Password = password,
                            Email    = email
                        });

                        context.SaveChanges();
                        MessageBox.Show("Registration successful!");

                        //Saving Id and UserName for the current session.
                        LoggerUtility.UserId   = context.People.Where(n => n.Name == name).Select(x => x.Id).FirstOrDefault();
                        LoggerUtility.UserName = name;

                        UserHomePage homePage = new UserHomePage();
                        this.NavigationService?.Navigate(homePage);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Error with registering. Please, try again!");
                        NameInput.Clear();
                        PasswordInput.Clear();
                        EmailInput.Clear();
                    }
                }
            }
        }
 public RegistrationPage FillForm(string email, string fullName, string password, string cpassword)
 {
     EmailInput.Clear();
     EmailInput.Set(email);
     FullNameInput.Clear();
     FullNameInput.Set(fullName);
     PasswordInput.Clear();
     PasswordInput.Set(password);
     ConfirmPasswordInput.Clear();
     ConfirmPasswordInput.Set(cpassword);
     return(this);
 }
 public RegistrationPage FillForm(User user)
 {
     EmailInput.Clear();
     EmailInput.Set(user.Email.Value);
     FullNameInput.Clear();
     FullNameInput.Set(user.FullName);
     PasswordInput.Clear();
     PasswordInput.Set(user.Password);
     ConfirmPasswordInput.Clear();
     ConfirmPasswordInput.Set(user.Password);
     return(this);
 }
        private void AddRow_Click(object sender, EventArgs e)
        {
            EmployeePayroll employeePayRoll = new EmployeePayroll();

            employeePayRoll.EmployeeFirstName = FirstNameInput.Text;

            employeePayRoll.EmployeeLastName = LastNameInput.Text;

            employeePayRoll.EmployeeEmail = EmailInput.Text;

            double PayRate = 0;

            double.TryParse(PayRateInput.Text, out PayRate);
            employeePayRoll.EmployeePayRate = PayRate;

            double Quantity = 0;

            double.TryParse(QtyInput.Text, out Quantity);
            employeePayRoll.TaskQty = Quantity;

            double ExtraPay = 0;

            double.TryParse(ExtraInput.Text, out ExtraPay);
            employeePayRoll.EmployeeExtraPay = ExtraPay;

            double TotalPay = 0;

            double.TryParse(TotalPayInput.Text, out TotalPay);
            employeePayRoll.EmployeeTotalPay = TotalPay;

            employeePayRoll.EmployeeComments = CommentsInput.Text;

            // Display the new information in the grid from the field.
            dataGridView1.Rows.Add(FirstNameInput.Text, LastNameInput.Text, EmailInput.Text, PayRate, Quantity, ExtraPay, TotalPay, CommentsInput.Text);
            dataGridView1.Columns[0].DisplayIndex = 0;

            // Clear out the input fields
            FirstNameInput.Clear();
            LastNameInput.Clear();
            EmailInput.Clear();
            PayRateInput.Clear();
            QtyInput.Clear();
            ExtraInput.Clear();
            TotalPayInput.Clear();
            CommentsInput.Clear();
        }
Esempio n. 6
0
        private void PersonInfoNext_Click(object sender, EventArgs e)
        {
            bool IsValidEmail(string emailaddress)
            {
                Regex rx = new Regex(
                    @"^[-!#$%&'*+/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+/0-9=?A-Z^_a-z{|}~])*@[a-zA-Z](-?[a-zA-Z0-9])*(\.[a-zA-Z](-?[a-zA-Z0-9])*)+$");

                return(rx.IsMatch(emailaddress));
            }

            if (IsValidEmail(EmailInput.Text))
            {
                this.Hide();
                Overview personInfoform = new Overview(Tuple.Create(NameInput.Text, SurnameInput.Text, EmailInput.Text), information);
                personInfoform.ShowDialog();
                this.Close();
            }
            else
            {
                EmailInput.Clear();
                MessageBox.Show("The email was not valid. Please try again", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 7
0
 public void enterEmail(string email)
 {
     EmailInput.Clear();
     EmailInput.SendKeys(email);
 }