private void EnterButton_Click(object sender, EventArgs e)
 {
     using
     (SqlConnection connection = new SqlConnection(connectionString))
     {
         try
         {
             connection.Open();
         }
         catch
         {
             MessageBox.Show("Ошибка подключения к базе данных", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         SqlCommand requestauth = new SqlCommand("SELECT dbo.AuthUser('" +
                                                 LoginTextbox.Text + "','" + PasswordTextbox.Text + "')", connection);
         string result = requestauth.ExecuteScalar().ToString();
         connection.Close();
         if (result == "Fail")
         {
             MessageBox.Show("Неверный логин или пароль", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             InitiateNewForm(result);
             this.Hide();
         }
         LoginTextbox.Clear();
         PasswordTextbox.Clear();
         LoginTextbox.Focus();
     }
 }
Пример #2
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!String.Equals(PasswordTextbox.Text, ConfirmTextbox.Text))
            {
                label13.Text    = "Passwords Must Match";
                label13.Visible = true;
            }
            else
            {
                string str = Properties.Settings.Default.DefaultConnection;

                SqlConnection con = new SqlConnection
                {
                    ConnectionString = str
                };
                con.Open();
                SqlCommand cmd = new SqlCommand("Insert into Employee(SSN, FirstName, LastName, City, State, " +
                                                "ZipCode, Email, Password, Telephone, StartDate, HourlyRate, Type) " +
                                                "Values(@SSN, @FirstName, @LastName, @City, @State, @ZipCode, @Email, @Password, @Telephone, @AccountCreationDate, " +
                                                "@HourlyRate, @AccountType)", con);
                cmd.Parameters.AddWithValue("@SSN", SSNTextbox.Text);
                cmd.Parameters.AddWithValue("@FirstName", FirstNameTextbox.Text);
                cmd.Parameters.AddWithValue("@LastName", LastNameTextbox.Text);
                cmd.Parameters.AddWithValue("@City", CityTextbox.Text);
                cmd.Parameters.AddWithValue("@State", StateTextbox.Text);
                cmd.Parameters.AddWithValue("@ZipCode", ZipTextbox.Text);
                cmd.Parameters.AddWithValue("@Email", EmailTextbox.Text);
                cmd.Parameters.AddWithValue("@Password", PasswordTextbox.Text);
                cmd.Parameters.AddWithValue("@Telephone", TelephoneTextbox.Text);
                cmd.Parameters.AddWithValue("@AccountCreationDate", DateTime.Now.Date);
                cmd.Parameters.AddWithValue("@HourlyRate", HourlyWageTextBox.Text);
                cmd.Parameters.AddWithValue("@AccountType", comboBox1.Text);

                cmd.ExecuteNonQuery();
                label13.Text    = "Successfully Added " + FirstNameTextbox.Text + " " + LastNameTextbox.Text;
                label13.Visible = true;

                //Clear the textboxes
                SSNTextbox.Clear();
                FirstNameTextbox.Clear();
                FirstNameTextbox.Clear();
                LastNameTextbox.Clear();
                CityTextbox.Clear();
                StateTextbox.Clear();
                ZipTextbox.Clear();
                EmailTextbox.Clear();
                PasswordTextbox.Clear();
                ConfirmTextbox.Clear();
                TelephoneTextbox.Clear();
                HourlyWageTextBox.Clear();
                comboBox1.SelectedIndex = -1;
            }
        }
Пример #3
0
 private void SetPassword(string Password)
 {
     try
     {
         Console.WriteLine("Is Password textbox displayed? {0}", PasswordTextbox.Displayed);
         PasswordTextbox.Clear();
         PasswordTextbox.SendKeys(Password);
     }
     catch (Exception e)
     {
         Logger.Error("Error: ", e);
         throw (e);
     }
 }
Пример #4
0
        private void ClearForm()
        {
            if (UserId == 0)
            {
                IdTextbox.Text = "0";
                UsernameTextbox.Clear();
                FirstnameTextbox.Clear();
                LastnameTextbox.Clear();
                PasswordTextbox.Clear();
                ConfirmTextbox.Clear();
                IsAdminCheckbox.Checked    = false;
                IsApproverCheckbox.Checked = false;
                IsVisitorCheckbox.Checked  = false;
            }
            else
            {
                LoadUserDetails();
            }

            passwordNotMatch = false;
        }
Пример #5
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     PasswordTextbox.Clear();
 }
Пример #6
0
 private void ClearText()
 {
     UserTextbox.Clear();
     PasswordTextbox.Clear();
 }
Пример #7
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     PasswordTextbox.Clear();
 }
Пример #8
0
 private void SetPassword(string Password)
 {
     Logger.InfoFormat("Is username box displayed? {0}", PasswordTextbox.Displayed);
     PasswordTextbox.Clear();
     PasswordTextbox.SendKeys(Password);
 }