private void bvalider_Click(object sender, EventArgs e) { string requete = "select idUtilisateur, motDePasse, Administrateur from Utilisateur where pseudo = '" + tBPseudo.Text.Trim() + "'"; DataSet dSUtilisateur = MaConnexion.ExecuteSelect(connectionString, requete); if (dSUtilisateur.Tables[0].Rows.Count == 0) { MessageBox.Show("Pseudo et mot de passe erroné", "Echec d'authentification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (dSUtilisateur.Tables[0].Rows[0][1].ToString().Trim() == tBMotDePasse.Text.Trim()) //le mot de passe est juste { this.Close(); if (dSUtilisateur.Tables[0].Rows[0][2].ToString().ToLower() == "true") { parent.tBSUtilisateur.Enabled = true; } parent.menuStrip.Enabled = true; parent.toolStrip.Enabled = true; parent.toolStripLabel_utilisateur.Text = tBPseudo.Text.Trim(); parent.Administrateur = dSUtilisateur.Tables[0].Rows[0][2].ToString().ToLower(); parent.idUtilisateur = dSUtilisateur.Tables[0].Rows[0][0].ToString().ToLower(); parent.toolStripStatusLabel.Text = "Utilisateur : " + tBPseudo.Text.Trim(); if (dSUtilisateur.Tables[0].Rows[0][2].ToString().ToLower() == "true") { parent.toolStripStatusLabel.Text += " (Administrateur)"; OuvrirInventaire ouvre = new OuvrirInventaire(parent); ouvre.MdiParent = parent; ouvre.Show(); parent.toolStripMenuAdmin.Visible = true; } else { parent.toolStripMenuAdmin.Visible = false; } } } }
// charger inventaire private void charger_inv() { string req = "select uidInventaire,DesigInventaire from inventaire where type='Comptable' and caract='En cours'"; DataSet idinvent = MaConnexion.ExecuteSelect(connectionString, req); if (idinvent.Tables[0].Rows.Count == 0) { OuvrirInventaire ouvre = new OuvrirInventaire(parent); ouvre.MdiParent = parent; ouvre.Show(); } else { string uidInventaire = idinvent.Tables[0].Rows[0][0].ToString(); FormInventaire formInventaire = new FormInventaire(mDIParent, uidInventaire); formInventaire.MdiParent = parent; formInventaire.Text = idinvent.Tables[0].Rows[0][1].ToString(); formInventaire.Show(); } }
private void ouvrirInToolStripMenuItem_Click(object sender, EventArgs e) { OuvrirInventaire ouvre = new OuvrirInventaire(this); ouvre.MdiParent = this; ouvre.Show(); }
private void OpenFile(object sender, EventArgs e) { foreach (Form childForm in MdiChildren) { childForm.WindowState = FormWindowState.Minimized; } Form child = new OuvrirInventaire(this); child.MdiParent = this; child.Show(); }