Пример #1
0
        public static void ShowTotaleMessage(string s, out Queue q1, out Queue q2, out Queue a1, out Queue a2)//message
        {
            q1 = new Queue(); q2 = new Queue(); a1 = new Queue(); a2 = new Queue(); string z;
            DataSet   ds = new DataSet(), ds2 = new DataSet(); int i = 0; ds.ReadXml("message.xml"); ds2.ReadXml("users.xml");
            DataTable dt = ds.Tables[0], dt2 = ds2.Tables[0];

            while (i < dt.Rows.Count)
            {
                if (s == dt.Rows[i][0].ToString())
                {
                    DataRow[] dr = dt2.Select("(([user] = '" + dt.Rows[i][0].ToString() + "'))");
                    z = dr[0]["Type"].ToString();

                    q1.Enqueue(dt.Rows[i][2].ToString());  a1.Enqueue(z + " " + dt.Rows[i][1].ToString());
                }                                                                                           //dt.Rows[i][1].ToString() bdna naarf l type l hal esm so mnbrm aale avec cryptage w decryptage l typpo
                if (s == dt.Rows[i][1].ToString())
                {
                    DataRow[] dr = dt2.Select("(([user] = '" + CryptageEtHachage.HashPasswordsAndScores(dt.Rows[i][0].ToString()) + "'))");
                    z = CryptageEtHachage.Combine(dr[0]["Type"].ToString());
                    q2.Enqueue(dt.Rows[i][2].ToString()); z = "Prof"; a2.Enqueue(z + " " + dt.Rows[i][0].ToString());
                }                                                                                                      //dt.Rows[i][0].ToString()  //////////same
                i++;
            }
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //zmouseClickButton.Play();

            if ((UserTxt.Text.Length > 0) && UserTxt.Text != "Votre nom d'utilisateur")
            {
                if (PassTxt.Text.Length > 0)
                {
                    dr = dt.Select("(([user] = '" + CryptageEtHachage.HashPasswordsAndScores(UserTxt.Text) + "') AND ([pass] = '" + CryptageEtHachage.HashPasswordsAndScores(PassTxt.Text) + "'))");
                }
                if (panel1.Visible == true)
                {
                    dr = dt.Select("(([user] = '" + CryptageEtHachage.HashPasswordsAndScores(UserTxt.Text) + "'))");
                    if (dr.Length == 1)
                    {
                        if (nomText.Text != dr[0]["nom"].ToString())
                        {
                            InfoFlse.Visible = true; return;
                        }
                        else
                        {
                            panel1.Visible = false;
                            PassTxt.Text   = dr[0]["pass"].ToString();
                        }
                    }
                    else
                    {
                        InfoFlse.Visible = true; return;
                    }
                }
                if (PassTxt.Text.Length < 0)
                {
                    motcle.Visible = true; return;
                }

                if (dr.Length == 1)
                {
                    Variables.intro   = new Introduction();
                    Variables.matiere = new MatiereStart();
                    intro_video intro_ = new intro_video();
                    intro_.Show();

                    if ((CryptageEtHachage.Combine(dr[0]["genre"].ToString()) == "mâle") && (CryptageEtHachage.Combine(dr[0]["Type"].ToString()) == "Eleve"))
                    {
                        Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\boy.png");
                        Variables.intro.userphoto.Image = Variables.B;
                    }
                    else if ((CryptageEtHachage.Combine(dr[0]["genre"].ToString()) == "femelle") && (CryptageEtHachage.Combine(dr[0]["Type"].ToString()) == "Eleve"))
                    {
                        Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\girl.png");
                        Variables.intro.userphoto.Image = Variables.B;
                    }
                    else if ((CryptageEtHachage.Combine(dr[0]["genre"].ToString()) == "mâle") && (CryptageEtHachage.Combine(dr[0]["Type"].ToString()) == "Prof"))
                    {
                        Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\administrator_male.png");
                        Variables.intro.userphoto.Image = Variables.B;
                    }
                    else if ((CryptageEtHachage.Combine(dr[0]["genre"].ToString()) == "femelle") && (CryptageEtHachage.Combine(dr[0]["Type"].ToString()) == "Prof"))
                    {
                        Variables.B = new Bitmap(Application.StartupPath + "\\Pics\\woman_profile.png");
                        Variables.intro.userphoto.Image = Variables.B;
                    }



                    this.ShowInTaskbar = false;

                    Variables.exSup = dr[0]["exSupp"].ToString().Split(',');

                    Variables.UserNom             = UserTxt.Text;
                    Variables.UserPass            = PassTxt.Text;
                    Variables.intro.username.Text = Variables.UserNom;
                    this.Hide();
                }
                else
                {
                    wrongData.Visible = true;
                }
            }

            if (PassTxt.Text == "")
            {
                motcle.Visible = true;
            }
        }