Пример #1
0
        public Accueil(int id)
        {
            InitializeComponent();
            Utilisateurs u = new Utilisateurs();
            DataTable d = u.SelectOneUser(id);
            DataTable d2 = u.SelectAllUsers();
            foreach (DataRow row in d.Rows)
            {
               lblName.Text = row["nom"].ToString() + " "   + row["prenom"].ToString();
            if (row["statut"].Equals(1))
            {
                btnConnexion.BackColor = Color.FromArgb(229, 229, 229);

            }
            else if (row["statut"].Equals(2))
            {
                btnAbsence.BackColor = Color.FromArgb(229, 229, 229);
            }
            else {
                btnHG.BackColor = Color.FromArgb(229, 229, 229);
            }
            if (row["img"].ToString() != null && row["img"].ToString()!="")
            {
            imgAvatar.ImageLocation = row["img"].ToString();
            }

            imgAvatar.SizeMode = PictureBoxSizeMode.Zoom;
            }
            btnImgChange.Visible = false;
            codeUser = id;

             foreach (DataRow row in d2.Rows)
             {
                 if (row["statut"].Equals(1))
                 {
                     listBox1.Items.Add(row["nom"] + " " + row["prenom"]);

                 }
                 else if (row["statut"].Equals(2))
                 {
                     listBox1.Items.Add(row["nom"] + " " + row["prenom"]);
                 }
                 else
                 {
                     listBox1.Items.Add(row["nom"] + " " + row["prenom"]);
                 }

             }
        }