コード例 #1
0
ファイル: Glav.cs プロジェクト: Alenchic/Kursach
        private void button6_Click(object sender, EventArgs e)
        {
            Klient kl = new Klient();

            kl.Show();
        }
コード例 #2
0
ファイル: Glav.cs プロジェクト: Alenchic/Kursach
        public void Button_Click(object sender, EventArgs e)
        {
            ConnectionClass ConCheck = new ConnectionClass();

            ConCheck.Connection_Options();
            SqlConnection connectionUser = new SqlConnection(ConCheck.ConnectString);
            SqlCommand    Select_USID    = new SqlCommand("select concat(Imya,' ',Fam,' ',Oth)  from Sotrudnik where Parol='" + New_Password_Text.Text + "' and [Login]='" + New_Login_Text.Text + "'", connectionUser);
            SqlCommand    Select_ISA     = new SqlCommand("select Otdel  from Sotrudnik where Parol='" + New_Password_Text.Text + "' and [Login]='" + New_Login_Text.Text + "'", connectionUser);

            try
            {
                connectionUser.Open();
                string USID = Select_USID.ExecuteScalar().ToString();
                string ISA  = Select_ISA.ExecuteScalar().ToString();


                MessageBox.Show("Здравствуйте: " + USID);
                switch (ISA)
                {
                case "Отдел закупок":
                    Zakupka zakupka = new Zakupka();
                    Gl.sotr = USID;
                    zakupka.Show();
                    this.Hide();
                    Registration_Window.Close();
                    connectionUser.Close();
                    break;

                case "Складской отдел":
                    Sklad Sklad = new Sklad();
                    Gl.sotr = USID;
                    Sklad.Show();
                    this.Hide();
                    Registration_Window.Close();
                    connectionUser.Close();
                    break;

                case "Отдел продаж":
                    Klient Klient = new Klient();
                    Gl.sotr = USID;
                    Klient.Show();
                    this.Hide();
                    Registration_Window.Close();
                    connectionUser.Close();

                    break;

                case "Админ":
                    Admin Admin = new Admin();
                    Gl.sotr = USID;
                    Admin.Show();
                    this.Hide();
                    Registration_Window.Close();
                    connectionUser.Close();

                    break;
                }
            }
            catch
            {
                MessageBox.Show( );
            }
        }