예제 #1
0
        Administrateur FillAdmin()
        {
            Administrateur Admin;

            con = new SqlConnection(connectionString);
            dt.Clear();
            da   = new SqlDataAdapter("select * from Administrateur where CIN = '" + cin.Text + "'", con);
            cmdb = new SqlCommandBuilder(da);
            da.Fill(dt);
            string   date    = dt.Rows[0][3].ToString().Substring(0, 10);
            string   day     = date.Substring(0, 2);
            string   month   = date.Substring(3, 2);
            string   year    = date.Substring(6, 4);
            DateTime dateNai = new DateTime(Convert.ToInt32(year), Convert.ToInt32(month), Convert.ToInt32(day));

            Admin = new Administrateur(dt.Rows[0][0].ToString(), dt.Rows[0][1].ToString(), dt.Rows[0][2].ToString(), dateNai, dt.Rows[0][4].ToString(), dt.Rows[0][5].ToString(), dt.Rows[0][6].ToString(), dt.Rows[0][7].ToString(), "filiere");
            return(Admin);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            con = new SqlConnection(connectionString);
            da  = new SqlDataAdapter("SELECT * FROM login WHERE CIN = '" + cin.Text + "' AND password = '******'", con);
            ds  = new DataSet();
            try
            {
                da.Fill(ds, "Login");
                if (ds.Tables["Login"].Rows.Count != 0)
                {
                    switch (ds.Tables["Login"].Rows[0][2].ToString())
                    {
                    case "Etudiant":
                        Etd = FillEtd();
                        Etudiant etudiant = new Etudiant(Etd);
                        this.Hide();
                        etudiant.Show();
                        break;

                    case "Enseignant":
                        Ens = FillEns();
                        Enseignant_UI.Enseignant enseignant = new Enseignant_UI.Enseignant(Ens);
                        this.Hide();
                        enseignant.Show();
                        break;

                    case "Administrateur":
                        admn = FillAdmin();
                        AdminPanel adm = new AdminPanel(admn);
                        this.Hide();
                        adm.Show();
                        break;
                    }
                }
                else
                {
                    incorrect.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erreur ! \nPlus de détials : " + ex.ToString());
            }
        }
예제 #3
0
 public AdminPanel(Administrateur adm)
 {
     InitializeComponent();
     adminProfile1.admin = adm;
 }