コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form_director cost = new Form_director();

            cost.ShowDialog();
            this.Close();
        }
コード例 #2
0
        private void button_auth_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlConnection Conn = new MySqlConnection(serv);
                Conn.Open();
                string          command = "SELECT `ID_Role` FROM `User` WHERE `Log` = '" + textBox_login.Text + "' AND `Pass` = '" + textBox_password.Text + "'";
                MySqlCommand    cmd     = new MySqlCommand(command, Conn);
                MySqlDataReader reader  = cmd.ExecuteReader();
                while (reader.Read())
                {
                    role = reader[0].ToString();
                }

                if (role == "1")
                {
                    this.Hide();
                    Form customer = new Form_customer();
                    customer.ShowDialog();
                    this.Close();
                }
                if (role == "2")
                {
                    this.Hide();
                    Form accman = new Form_accman();
                    accman.ShowDialog();
                    this.Close();
                }
                if (role == "3")
                {
                    this.Hide();
                    Form purman = new Form_purman();
                    purman.ShowDialog();
                    this.Close();
                }
                if (role == "4")
                {
                    this.Hide();
                    Form master = new Form_master();
                    master.ShowDialog();
                    this.Close();
                }
                if (role == "5")
                {
                    this.Hide();
                    Form director = new Form_director();
                    director.ShowDialog();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }