private void BAjouterArticle_Click(object sender, RoutedEventArgs e) { if (TBSymbole.Text.Equals("") || TBDesc.Text.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.SymboleExiste(TBSymbole.Text) != 0) { MessageBox.Show("Ce symbole est déjà utilisé", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.SymboleExiste(TBSymbole.Text) != -1) { if (Requettes.AjouterArticle(Int16.Parse(TBSymbole.Text), TBDesc.Text, float.Parse(TBBesoin.Text), float.Parse(TBStock.Text), float.Parse(TBRatio.Text), float.Parse(TBSA.Text), float.Parse(TBSMdhilla.Text), float.Parse(TBSSkhira.Text), TBDesignation.Text, TBFormat.Text, TBEpisseur.Text) == 0) { MessageBox.Show("Cet article est ajouté avec succès", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Ajouter un nouveau article : " + TBSymbole.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } } } } } importerArticle(); }
private void BAjouter_Click(object sender, RoutedEventArgs e) { if (TBNom.Text.Equals("") || TBLogin.Text.Equals("") || TBMdp.Password.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.LoginExiste(TBLogin.Text) != 0) { MessageBox.Show("ce login est déjà utilisé", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.LoginExiste(TBLogin.Text) != -1) { if (Requettes.AjouterPersonel(TBNom.Text, CBRole.Text, TBLogin.Text, TBMdp.Password) == 0) { MessageBox.Show("ce Personnel est ajouté avec succès", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Ajouter un nouveau personel : " + TBLogin.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } } } } } importerPersonel(); }
private void importerArticle(String champ, String texte) { DataGridArticle.ItemsSource = null; List <Article> reader = Requettes.getAllArticle(champ, texte); DataGridArticle.ItemsSource = reader; }
private void importerJournalArticle(String champ, String texte) { DataGridArticleJ.ItemsSource = null; List <journalArticle> reader = Requettes.getAllJournalArticle(); DataGridArticleJ.ItemsSource = reader; }
private void importerJournalPersonel(String champ, String texte) { DataGridJournal.ItemsSource = null; List <journalP> reader = Requettes.getAllJournals(champ, texte); DataGridJournal.ItemsSource = reader; }
private void symboleArticleStat_KeyUp(object sender, KeyEventArgs e) { symboleArticleStat.Text = saisieFloat(sender); if (symboleArticleStat.Text.Equals("")) { ((LineSeries)mcChartSS.Series[0]).ItemsSource = null; symboleArticleStat.Background = Brushes.Bisque; } else { if (Requettes.SymboleExisteJournalArticle(symboleArticleStat.Text) == 0) { symboleArticleStat.Background = Brushes.Bisque; } else { List <journalArticle> art = Requettes.getAllJournalArticleBySymbole(symboleArticleStat.Text); List <PersonelStat> v = new List <PersonelStat>(); //List<Article> ls = Requettes.getAllArticle(); for (int i = 0; i < art.Count; i++) { v.Add(new PersonelStat(new DateTime(Int16.Parse(art.ElementAt(i).anne), Int16.Parse(art.ElementAt(i).moi), Int16.Parse(art.ElementAt(i).jour)).ToShortDateString(), Int16.Parse(art.ElementAt(i).remarque + ""))); } ((LineSeries)mcChartSS.Series[0]).ItemsSource = v; symboleArticleStat.Background = Brushes.GreenYellow; } } }
private void importerJournalPersonel() { DataGridJournal.ItemsSource = null; List <journalP> reader = Requettes.getAllJournals(); DataGridJournal.ItemsSource = reader; }
private void BASupprimerArticleS_Click(object sender, RoutedEventArgs e) { if (TBSymboleS.Text.Equals("")) { MessageBox.Show("Vous devez saisir le symbole d'un article", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.SymboleExiste(TBSymboleS.Text) == 0) { MessageBox.Show("Vous devez saisir un symbole valide", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.SupprimerArticle(Int16.Parse(TBSymboleS.Text)) == 0) { MessageBox.Show("Cet article a été Supprimer avec succèes", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Supprimer un article : " + TBSymboleS.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } TBIdAdminS.Background = Brushes.White; viderChampsArtileS(); importerArticle(); } } } }
private void TBSymboleas_KeyUp(object sender, KeyEventArgs e) { TBSymboleas.Text = saisieFloat(sender); if (!TBSymboleas.Text.Equals("")) { List <Article> art = Requettes.getAllArticle("symbole", TBSymboleas.Text); if (art.Count > 0) { TBDescas.Text = art.ElementAt(0).description; TBBesoinas.Text = art.ElementAt(0).besoin + ""; TBStockas.Text = art.ElementAt(0).stock + ""; TBRatioas.Text = art.ElementAt(0).ratio + ""; TBSAas.Text = art.ElementAt(0).sa + ""; TBSMdhillaas.Text = art.ElementAt(0).smdhilla + ""; TBSSkhiraas.Text = art.ElementAt(0).sskhira + ""; TBDesignationas.Text = art.ElementAt(0).designation; TBFormatas.Text = art.ElementAt(0).format; TBEpisseuras.Text = art.ElementAt(0).episseur; TBSymboleas.Background = Brushes.GreenYellow; } else { TBSymboleas.Background = Brushes.Bisque; MessageBox.Show("Ce symbole n'existe pas dans la base de données courante", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } } else { TBSymboleas.Background = Brushes.White; viderChampsArtileas(); } }
private void importerPersonel(String champ, String texte) { DataGridAdmin.ItemsSource = null; List <Personel> reader = Requettes.getAllPersonels(champ, texte); DataGridAdmin.ItemsSource = reader; }
private void importerArticle() { DataGridArticle.ItemsSource = null; List <Article> reader = Requettes.getAllArticle(); //MessageBox.Show(reader.Count+""); DataGridArticle.ItemsSource = reader; }
private void importerPersonel() { DataGridAdmin.ItemsSource = null; List <Personel> reader = Requettes.getAllPersonels(); //MessageBox.Show(reader.Count+""); DataGridAdmin.ItemsSource = reader; }
private void BAConfirmerArticlere_Click(object sender, RoutedEventArgs e) { if (TBSymbolere.Text.Equals("")) { MessageBox.Show("Vous devez saisir le symbole d'article", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.IdExiste(TBSymbolere.Text) == 0) { MessageBox.Show("Vous devez saisir un symbole valide", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (TBSymbolere.Text.Equals("") || TBDescre.Text.Equals("") || TBBesoinre.Text.Equals("") || TBStockre.Text.Equals("") || TBNouvelleQuantiterre.Text.Equals("") || TBUsagere.Text.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (float.Parse(TBNouvelleQuantiterre.Text) > float.Parse(TBStockre.Text)) { MessageBox.Show("Stock insuffisant", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.ModifierArticle(Int16.Parse(TBSymbolere.Text), TBDescre.Text, Int16.Parse(TBBesoinre.Text), float.Parse(TBStockre.Text) - float.Parse(TBNouvelleQuantiterre.Text), float.Parse(TBRatiore.Text), float.Parse(TBSAre.Text), float.Parse(TBSMdhillare.Text), float.Parse(TBSSkhirare.Text), TBDesignationre.Text, TBFormatre.Text, TBEpisseurre.Text) == 0) { MessageBox.Show("Cet article a été modifier avec succèes", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); DateTime localDate = DateTime.Now; int anne = localDate.Year; int moi = localDate.Month; int jour = localDate.Day; Requettes.AjouterJournalArticle(idGeneral, Int16.Parse(TBSymbolere.Text), anne + "", moi + "", jour + "", "retirer", (float.Parse(TBStockre.Text) - float.Parse(TBNouvelleQuantiterre.Text)) + ""); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Modifier l'article : " + TBSymbolere.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } TBSymbolere.Background = Brushes.White; viderChampsArtilere(); importerArticle(); importerJournalArticle(); } } } } } }
private void LoadColumnChartData() { List <PersonelStat> v = new List <PersonelStat>(); List <Article> ls = Requettes.getAllArticle(); for (int i = 0; i < ls.Count; i++) { v.Add(new PersonelStat(ls.ElementAt(i).symbole + "", Int16.Parse(ls.ElementAt(i).stock + ""))); } ((ColumnSeries)mcChartS.Series[0]).ItemsSource = v; }
private void LoadBarChartData() { List <PersonelStat> v = new List <PersonelStat>(); List <Personel> ls = Requettes.getAllPersonels(); for (int i = 0; i < ls.Count; i++) { v.Add(new PersonelStat(ls.ElementAt(i).nom, Requettes.nbApparenceJournal(ls.ElementAt(i).id))); } ((BarSeries)mcChart.Series[0]).ItemsSource = v; }
private void BAModifierArticle_Click(object sender, RoutedEventArgs e) { if (TBSymboleM.Text.Equals("")) { MessageBox.Show("Vous devez saisir le symbole d'article", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.IdArticleExiste(TBSymboleM.Text) == 0) { MessageBox.Show("Vous devez saisir un symbole valide", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (TBSymboleM.Text.Equals("") || TBDescM.Text.Equals("") || TBBesoinM.Text.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.ModifierArticle(Int16.Parse(TBSymboleM.Text), TBDescM.Text, float.Parse(TBBesoinM.Text), float.Parse(TBStockM.Text), float.Parse(TBRatioM.Text), float.Parse(TBSAM.Text), float.Parse(TBSMdhillaM.Text), float.Parse(TBSSkhiraM.Text), TBDesignationM.Text, TBFormatM.Text, TBEpisseurM.Text) == 0) { MessageBox.Show("Cet article a été modifier avec succèes", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Modifier l'article : " + TBSymboleM.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } TBIdM.Background = Brushes.White; TBSymboleM.Text = ""; TBDescM.Text = ""; TBBesoinM.Text = ""; TBStockM.Text = ""; TBRatioM.Text = ""; TBSAM.Text = ""; TBSMdhillaM.Text = ""; TBSSkhiraM.Text = ""; TBDesignationM.Text = ""; TBFormatM.Text = ""; TBEpisseurM.Text = ""; importerArticle(); } } } } }
private void ImprimerStatII_Click(object sender, RoutedEventArgs e) { PrintDialog printDlg = new PrintDialog(); printDlg.PrintVisual(gridStatII, "Statistique : Stock disponible"); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Impression Stock disponible " + thisDate.ToString()); } catch (Exception ex) { } }
private void ImprimerArticle_Click(object sender, RoutedEventArgs e) { PrintDialog printDlg = new PrintDialog(); printDlg.PrintVisual(DataGridArticleJ, "Journal des articles."); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Impression de journal des articles " + thisDate.ToString()); } catch (Exception ex) { } }
private void ButtonImpressionListePersonels_Click(object sender, RoutedEventArgs e) { PrintDialog printDlg = new PrintDialog(); printDlg.PrintVisual(DataGridAdmin, "Journal des Personel."); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Impression de la liste des personels " + thisDate.ToString()); } catch (Exception ex) { } }
private void BASupprimerAdminS_Click(object sender, RoutedEventArgs e) { if (TBIdAdminS.Text.Equals("")) { MessageBox.Show("Vous devez saisir l'identifiant d'un personel", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.IdExiste(TBIdAdminS.Text) == 0) { MessageBox.Show("Vous devez saisir un identifiant valide", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (TBNomAdminS.Text.Equals("") || TBLoginAdminS.Text.Equals("") || TBMdpAdminS.Password.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (Requettes.SupprimerPersonel(Int16.Parse(TBIdAdminS.Text)) == 0) { MessageBox.Show("Ce personel a été Supprimer avec succèes", "Confirmation", MessageBoxButton.OK, MessageBoxImage.Asterisk); try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(idGeneral, "Supprimer un personel : " + TBLoginAdminS.Text + " : " + thisDate.ToString()); } catch (Exception ex) { } TBIdAdminS.Background = Brushes.White; TBIdAdminS.Text = ""; TBNomAdminS.Text = ""; TBLoginAdminS.Text = ""; TBMdpAdminS.Password = ""; TBAfficherMdpAdminS.Text = ""; importerPersonel(); } } } } importerPersonel(); }
private void TBIdAdminS_TextChanged(object sender, TextChangedEventArgs e) { TBIdAdminS.Text = saisieFloat(sender); if (!TBIdAdminS.Text.Equals("")) { TBNomAdminS.Text = Requettes.GetNomFromIdAdmin(TBIdAdminS.Text); TBLoginAdminS.Text = Requettes.GetLoginFromIdAdmin(TBIdAdminS.Text); TBMdpAdminS.Password = Requettes.GetMdpFromIdAdmin(TBIdAdminS.Text); String role = Requettes.GetRoleFromIdAdmin(TBIdAdminS.Text); if (role.Equals("Administrateur")) { CBRoleAdminS.SelectedIndex = 0; } if (role.Equals("Gestionnaire")) { CBRoleAdminS.SelectedIndex = 1; } if (role.Equals("Utilisateur")) { CBRoleAdminS.SelectedIndex = 2; } } if (TBIdAdminS.Text.Equals("")) { TBIdAdminS.Background = Brushes.White; TBIdAdminS.Text = ""; TBNomAdminS.Text = ""; TBLoginAdminS.Text = ""; TBMdpAdminS.Password = ""; TBAfficherMdpAdminS.Text = ""; } else { if (Requettes.IdExiste(TBIdAdminS.Text) == 0) { TBIdAdminS.Background = Brushes.Bisque; } else { TBIdAdminS.Background = Brushes.GreenYellow; } } }
private void BConnexion_Click(object sender, RoutedEventArgs e) { if (TBLogin.Text.Equals("") || TBMdp.Password.Equals("")) { MessageBox.Show("Champ(s) vide(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { int a = Requettes.Authentification(TBLogin.Text, TBMdp.Password); if (a == -1) { MessageBox.Show("problème de connexion à la base de données", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { if (a == 0) { MessageBox.Show("Login et/ou mot de passe incorrecte(s)", "Erreur", MessageBoxButton.OK, MessageBoxImage.Error); } else { try { DateTime thisDate = DateTime.Now; CultureInfo culture = new CultureInfo("fr-FR"); Requettes.AjouterJournal(a, "Connexion : " + thisDate.ToString()); } catch (Exception ex) { } Principale aa = new Principale(a); aa.Show(); this.Close(); } } } }