Пример #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            TripleDes ecription = new TripleDes();

            try
            {
                string name    = textBox.Text;
                string surname = textBox1.Text;
                string post    = comboBox.Text;
                string log     = textBox2.Text;
                string pass    = ecription.Encrypt(passwordBox.Password, "300");
                double salary  = Convert.ToDouble(textBox3.Text);
                if (salary == 0 || salary < 0 || name.Length == 0 || surname.Length == 0 || post.Length == 0 ||
                    log.Length == 0 || pass.Length == 0)
                {
                    MessageBox.Show("Проверьте данные сотрудника");
                }
                else
                {
                    DB db = new DB();
                    db.openConnection(connStr);
                    db.addEmploye(name, surname, post, log, pass, salary);
                    MessageBox.Show("Выполнено !!!");
                    db.closeConnection();
                }
            }
            catch
            {
                MessageBox.Show("Ошибка запроса");
            }
        }
 private void button_Click(object sender, RoutedEventArgs e)
 {
     if (passwordBox.Password.Equals("MainAdmin") && textBox.Text.Equals("MainAdmin"))
     {
         Admin admin = new Admin();
         admin.Show();
         this.Close();
     }
     else
     {
         DB        db          = new DB();
         TripleDes someEncrypt = new TripleDes();
         db.openConnection(connStr);
         if (db.getAllUsers(textBox.Text, someEncrypt.Encrypt(passwordBox.Password, "300")))
         {
             db.closeConnection();
             Admin admin = new Admin();
             admin.Show();
             this.Close();
         }
         else
         {
             db.closeConnection();
             MessageBox.Show("Администратор не найден!!!");
         }
     }
 }
Пример #3
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            TripleDes ecription = new TripleDes();
            DB        db        = new DB();

            db.openConnection(connStr);
            if (db.getAllEmplLogPass(textBox.Text, ecription.Encrypt(textBox1.Text, "300")))
            {
                db.closeConnection();
                Employe a = new Employe();
                a.Show();
                this.Close();
            }
            else
            {
                db.closeConnection();
                MessageBox.Show("Сотрудник не найден!!!");
            }
        }