Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            {
                var connection = new SqlConnection(Properties.Settings.Default.dbConnectionString);
                connection.Open();
                string        login    = textBox1.Text;
                string        password = maskedTextBox1.Text;
                SqlCommand    cmd      = new SqlCommand("SELECT id, admin FROM users WHERE login = '******' AND pass = '******'", connection);
                SqlDataReader reader   = cmd.ExecuteReader();
                int           id       = 0;
                int           admin    = 0;

                while (reader.Read())
                {
                    id    = Convert.ToInt32(reader[0]);
                    admin = Convert.ToInt32(reader[1]);
                }
                if (id > 0 && admin == 0)
                {
                    OrdersList odform = new OrdersList(this, id);
                    odform.Show();
                    textBox1.Text       = "";
                    maskedTextBox1.Text = "";
                    this.Hide();
                }
                else if (id > 0 && admin == 1)
                {
                    AdminList adform = new AdminList();
                    textBox1.Text       = "";
                    maskedTextBox1.Text = "";
                    adform.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Wrong Data");
                }
            }
        }
Beispiel #2
0
 public ChangeUserPass(OrdersList o, int id)
 {
     InitializeComponent();
     this.orderlist = o;
     this.userid    = id;
 }