private void BTConfirmer_Click(object sender, RoutedEventArgs e) { if (ChampVide()) { Afficher_Msg_Erreur("Erreur : champ(s) vide(s)"); } else { String solId; if (TBId.Text.Equals("")) { solId = "0"; } else { solId = TBId.Text; } fsg_gpao.Acteurs.Article adminx = new fsg_gpao.Acteurs.Article(Int16.Parse(solId), TBNom.Text, TBCat.Text, TBDesc.Text, Int16.Parse(TBQuantite.Text), TBPrix.Text); int res = fsg_gpao.Connecteurs.ArticleC.AjouterArticle(adminx); int idNew = fsg_gpao.Connecteurs.ArticleC.MaxId(); if (res == 1) { Afficher_Msg_Confirmation("L'article est bien ajouter"); try { DateTime localDate = DateTime.Now; fsg_gpao.Acteurs.JournalArticle journal = new fsg_gpao.Acteurs.JournalArticle(idCourant, idNew, localDate.ToString("F"), "Création du nouvel article : " + adminx.NOM, ""); fsg_gpao.Connecteurs.JournalArticleC.ajouterJournal(journal); } catch (Exception ex) { } } else { Afficher_Msg_Erreur("Erreur de connexion à la base de données!"); } cacherGroupeB(); } cacherGroupeB(); }
private void BTConfirmer_Click(object sender, RoutedEventArgs e) { if (ChampVide()) { Afficher_Msg_Erreur("Erreur : champ(s) vide(s)"); } else { String solId; if (TBId.Text.Equals("")) { solId = "0"; } else { solId = TBId.Text; } fsg_gpao.Acteurs.Client adminx = new fsg_gpao.Acteurs.Client(Int16.Parse(solId), TBNom.Text, TBAdresse.Text, TBTelephone.Text, TBRemarque.Text, CHEtat.IsChecked.Value); int res = fsg_gpao.Connecteurs.ClientC.AjouterClient(adminx); if (res == 1) { Afficher_Msg_Confirmation("Le client est bien ajouter"); try { DateTime localDate = DateTime.Now; fsg_gpao.Acteurs.JournalArticle journal = new fsg_gpao.Acteurs.JournalArticle(idCourant, adminx.ID, localDate.ToString("F"), "Création du nouvel " + adminx.NOM, ""); fsg_gpao.Connecteurs.JournalArticleC.ajouterJournal(journal); } catch (Exception ex) { } } else { Afficher_Msg_Erreur("Erreur de connexion à la base de données!"); } cacherGroupeB(); } cacherGroupeB(); }