コード例 #1
0
ファイル: Sales.cs プロジェクト: Kirik13/ShoeStore
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            MenuAdmin admin = new MenuAdmin();

            admin.ShowDialog();
        }
コード例 #2
0
ファイル: Authorization.cs プロジェクト: Kirik13/ShoeStore
        private void SingIN_Click(object sender, EventArgs e)
        {
            connection.Open();
            OleDbCommand command = new OleDbCommand();

            command.Connection  = connection;
            command.CommandText = "select * from Users where Логин='" + Login.Text + "' and Пароль='" + Password.Text + "'";
            OleDbDataReader reader = command.ExecuteReader();

            int count = 0;

            while (reader.Read())
            {
                count = count + 1;
            }
            if (count == 1)
            {
                id();

                string dostyp = "";

                OleDbCommand command1 = new OleDbCommand();
                command1.Connection  = connection;
                command1.CommandText = "select * from Users where Код=" + Convert.ToInt32(id_p) + "";
                OleDbDataReader reader1 = command1.ExecuteReader();

                while (reader1.Read())
                {
                    dostyp = reader1["Доступ"].ToString();
                }
                if (dostyp == "1")
                {
                    this.Hide();
                    MenuAdmin admin = new MenuAdmin();
                    admin.ShowDialog();
                }
                else
                {
                    this.Hide();
                    MenuAdmin admin = new MenuAdmin();
                    admin.Add.Enabled     = false;
                    admin.DeletTB.Enabled = false;
                    admin.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Неправильный логин или пароль");
            }
            connection.Close();
        }