Example #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         cpteur++;
         lblCpteur.Text = cpteur.ToString();
         if (cpteur == 100)
         {
             this.Hide();
             timer1.Enabled = false;
             Ecole1 frb = new Ecole1();
             frb.Show();
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
        public void login_user(string nom, string password, string fonction_l)
        {
            ap.connect();
            myconn = new SqlConnection(ap.chemin);
            myconn.Open();

            //cn.Open();
            SqlCommand    cmd = new SqlCommand("select * from utilisateur1 where nom='" + nom + "'and pass='******'and fonction='" + fonction_l + "'", myconn);
            SqlDataReader dr;

            dr = cmd.ExecuteReader();
            int count = 0; string fonction = "";

            while (dr.Read())
            {
                fonction = dr["fonction"].ToString();
                count   += 1;
            }

            if (count == 1)
            {
                MessageBox.Show("La connection a reussie !!!!!!");

                UserSession.GetInstance().UserName    = nom;
                UserSession.GetInstance().AccessLevel = fonction;


                Ecole1 f1 = new Ecole1();
                f1.Show();
                Visible = false;
            }
            else if (count > 1)
            {
                MessageBox.Show("duplicate");
            }
            else
            {
                MessageBox.Show("Echec de connection !!!!!!!!!");
            }

            //username
        }