Beispiel #1
0
        private void button_Login_Click(object sender, EventArgs e)
        {
            // Requete For LoginEntr
            string reqEnt = string.Format(@"select * from LoginEntr where Username='******' and Password = '******'", Textbox_user.Text.Trim(), Textbox_pass.Text.Trim());

            Program.da_LoginEntr = new SqlDataAdapter(reqEnt, Program.con);
            DataTable dtEnt = new DataTable();

            Program.da_LoginEntr.Fill(dtEnt);
            //

            // Requete For LoginAdh
            string req = string.Format(@"select * from LoginAdh where Username='******' and Password = '******'", Textbox_user.Text.Trim(), Textbox_pass.Text.Trim());

            Program.da_loginAdh = new SqlDataAdapter(req, Program.con);
            DataTable dtAdh = new DataTable();

            Program.da_loginAdh.Fill(dtAdh);

            // Requete For LoginAdmin
            string reqAdmin = string.Format(@"select * from LoginAdmin where Username='******' and Password = '******'", Textbox_user.Text.Trim(), Textbox_pass.Text.Trim());

            Program.da_LoginAdmin = new SqlDataAdapter(reqAdmin, Program.con);
            DataTable dtAdmin = new DataTable();

            Program.da_LoginAdmin.Fill(dtAdmin);

            // Login For LoginAdmin
            if (dtAdmin.Rows.Count == 1)
            {
                Dashboard fh = new Dashboard();
                this.Visible = false;
                fh.Show();
            }

            // Login For Form Adhérent
            else if (dtAdh.Rows.Count == 1)
            {
                string UserT = dtAdh.Rows[0][3].ToString().Trim();
                if (dtAdh.Rows[0][3].ToString().Trim() == @"adhérent")
                {
                    FormAdherent fh = new FormAdherent();
                    this.Visible = false;
                    fh.Show();
                }
            }
            // Login For Form Entraineur
            else if (dtEnt.Rows.Count == 1)
            {
                string UserTEnt = dtEnt.Rows[0][3].ToString().Trim();
                if (UserTEnt == @"Entraineur")
                {
                    FormEntraineur fh = new FormEntraineur();
                    this.Visible = false;
                    fh.Show();
                }
            }
            // finally Erreur
            else
            {
                MessageBox.Show("Check Your Username And Password");
            }
        }
        private void Button_AjtAdh_Click_1(object sender, EventArgs e)
        {
            FormAdherent fa = new FormAdherent();

            fa.Show();
        }