private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { var senderGrid = (DataGridView)sender; if (e.ColumnIndex == senderGrid.Columns[2].Index && e.RowIndex >= 0) { Affichage affichage = new Affichage(gridRecherche.Rows[e.RowIndex].Cells["idEntreprise"].Value.ToString()); affichage.Show(); this.Close(); } else if (e.ColumnIndex == senderGrid.Columns[3].Index && e.RowIndex >= 0) { Modifier modifier = new Modifier(gridRecherche.Rows[e.RowIndex].Cells["idEntreprise"].Value.ToString()); modifier.Show(); this.Close(); } else if (e.ColumnIndex == senderGrid.Columns[4].Index && e.RowIndex >= 0) { AjoutContrat ajoutContrat = new AjoutContrat(gridRecherche.Rows[e.RowIndex].Cells["idEntreprise"].Value.ToString()); ajoutContrat.Show(); this.Close(); } else if (e.ColumnIndex == senderGrid.Columns[5].Index && e.RowIndex >= 0) { DialogResult result = MetroMessageBox.Show(this, "Voulez-vous vraiment supprimé?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { AdoEntreprise.delete(Convert.ToInt16(gridRecherche.Rows[e.RowIndex].Cells["idEntreprise"].Value.ToString())); refreshDTListeEntreprise(); refreshGrid(dtListeEntreprise); } } }
private void ajoutBtn_Click(object sender, EventArgs e) { Entreprise ent = new Entreprise(siretBox.Text, entBox.Text, adresseBox.Text, cpBox.Text, villeBox.Text, tbxCommentaire.Text, false); AdoEntreprise.create(ent, "App"); Accueil accueil = new Accueil(); accueil.Show(); this.Close(); }
private void ValideBox_Click(object sender, EventArgs e) { Entreprise uneEntreprise = new Entreprise(Convert.ToInt32(idEntreprise), siretBox.Text, entBox.Text, adresseBox.Text, cpBox.Text, villeBox.Text, tbxCom.Text, false); AdoEntreprise.update(uneEntreprise); Accueil accueil = new Accueil(); accueil.Show(); this.Close(); }
public string Test() { // SERIALISATION List <Entreprise> LesEntreprises = new List <Entreprise>(); LesEntreprises = AdoEntreprise.readAll(); File.WriteAllText(@"C:\temp\Test.json", LesEntreprises.ToString()); string json = JsonConvert.SerializeObject(LesEntreprises, Formatting.Indented); return(json); }
public Affichage(string idEntreprise) { InitializeComponent(); laEntreprise = AdoEntreprise.readOne(Convert.ToInt32(idEntreprise)); siretLabel.Text = laEntreprise.NumeroSiret; entLabel.Text = laEntreprise.NomEntreprise; adresseLabel.Text = laEntreprise.Adresse; cpLabel.Text = laEntreprise.CodePostal; villeLabel.Text = laEntreprise.Ville; comLabel.Text = laEntreprise.Commentaire; }
public Modifier(string idEntreprise) { InitializeComponent(); this.idEntreprise = Convert.ToInt32(idEntreprise); Entreprise laEntreprise; laEntreprise = AdoEntreprise.readOne(Convert.ToInt32(idEntreprise)); siretBox.Text = laEntreprise.NumeroSiret; entBox.Text = laEntreprise.NomEntreprise; adresseBox.Text = laEntreprise.Adresse; cpBox.Text = laEntreprise.CodePostal; villeBox.Text = laEntreprise.Ville; tbxCom.Text = laEntreprise.Commentaire; }
public AjoutContrat(string idEntreprise) { InitializeComponent(); laEntreprise = AdoEntreprise.readOne(Convert.ToInt32(idEntreprise)); }
private void refreshDTListeEntreprise() { dtListeEntreprise = AdoEntreprise.dtReadAll(); }