Пример #1
0
        private TB_User GetChamp()
        {
            TB_User r = new TB_User();

            r.Login    = (string)c1TextBox1.Value;
            r.Password = (string)c1TextBox2.Value;
            r.Tel      = (string)c1TextBox3.Value;
            r.Role     = comboBox1.SelectedIndex;
            return(r);
        }
Пример #2
0
 private void Supprimer_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Vous ete sure de vouloire Supprimer l'utilisateur ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int    index = c1TrueDBGrid1.Row;
         string Code  = c1TrueDBGrid1.Columns["Login"].CellText(index);
         if (Code == null)
         {
             MessageBox.Show("Login Vide");
             return;
         }
         TB_User Ar = new TB_User();
         Ar.FindByKey(Code);
         Ar.DeleteData();
         ((DataTable)c1TrueDBGrid1.DataSource).Rows.Find(Code).Delete();
     }
 }
Пример #3
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            TB_User Utilisateur = new TB_User();

            if (Utilisateur.FindByKey(textBoxLogin.Text))
            {
                if ((Utilisateur.Login == textBoxLogin.Text) && (Utilisateur.Password == textBoxPass.Text))
                {
                    GlobalVars.Utilisateur = Utilisateur;
                    this.Close();
                }
                this.labelError.Visible = true;
            }
            else
            {
                this.labelError.Visible = true;
            }
        }
Пример #4
0
        public InfoUtilisateur(string Code)
        {
            InitializeComponent();
            Save = false;
            TB_User Utilisateut = new TB_User();

            Utilisateut.FindByKey(Code);
            c1TextBox1.Enabled      = false;
            c1TextBox1.Value        = Utilisateut.Login;
            c1TextBox2.Value        = Utilisateut.Password;
            c1TextBox3.Value        = Utilisateut.Tel;
            comboBox1.SelectedIndex = Utilisateut.Role;
            MemoryStream ms = new MemoryStream();

            ms.Write(Utilisateut.Photo, 0, Utilisateut.Photo.Length);
            Image imgPhoto = Image.FromStream(ms);

            pictureBox1.Image = imgPhoto;
        }
Пример #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            MyUtils myUtils = new MyUtils();

            if (VerifierChamp())
            {
                TB_User newUser = GetChamp();
                if (newPic)
                {
                    newUser.Photo = myUtils.GetPhoto(pictureBox1.Text);
                }
                if (!Save)
                {
                    newUser.UpdateData();
                }
                else
                {
                    newUser.SaveData();
                }
                this.Close();
            }
        }