コード例 #1
0
        private void BTConfirmer_Click(object sender, RoutedEventArgs e)
        {
            if (actionDemander.Equals("Ajouter"))
            {
                if (!ChampVide())
                {
                    DateTime      localDate = DateTime.Now;
                    ClasseurVente cv        = new ClasseurVente(idc, idCourant, Int16.Parse(TBIdClient.Text), localDate.ToString("F"));
                    ClasseurVenteC.AjouterVente(cv);
                    for (int i = 0; i < DataGridAchat.Items.Count; i++)
                    {
                        VenteC.AjouterVente(listeVenteTemp.ElementAt(i));
                        int idart = listeVenteTemp.ElementAt(i).IDARTICLE;
                        fsg_gpao.Connecteurs.journalVenteC.ajouterJournal(new fsg_gpao.Acteurs.JournalVente(1, this.idCourant, idart, localDate.ToString("F"), "Vente", " Quantité vendue : " + listeVenteTemp.ElementAt(i).NBEX));

                        ArticleC.ModifierQuantiteArticle(idart, (ArticleC.getQuantite(idart) - listeVenteTemp.ElementAt(i).NBEX));
                    }
                    viderChamps();
                    Afficher_Msg_Confirmation("Vente bien ajouter");
                    idc++;
                }
                else
                {
                    Afficher_Msg_Erreur("Erreur : Champ(s) vide(s)");
                }
            }
            else
            {
                this.Close();
            }
        }
コード例 #2
0
 private void BTLivraison_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         object itemC = DataGridClasseur.SelectedItem;
         int    idc   = (Int16.Parse((DataGridClasseur.SelectedCells[0].Column.GetCellContent(itemC) as TextBlock).Text));
         if (idc != null && idc > 0)
         {
             List <Devis> l           = Connecteurs.DeviC.GetAllDevis(classeurCourant);
             String       stockInsuff = "";
             for (int i = 0; i < l.Count; i++)
             {
                 if (l.ElementAt(i).NBEX > ArticleC.getQuantite(l.ElementAt(i).IDARTICLE))
                 {
                     stockInsuff += " (" + l.ElementAt(i).IDARTICLE + ") " + ArticleC.getNom(l.ElementAt(i).IDARTICLE);
                 }
             }
             if (stockInsuff.Equals(""))
             {
                 for (int i = 0; i < l.Count; i++)
                 {
                     int res = ArticleC.getQuantite(l.ElementAt(i).IDARTICLE) - l.ElementAt(i).NBEX;
                     // MessageBox.Show("new : "+ res);
                     ArticleC.ModifierQuantiteArticle(l.ElementAt(i).IDARTICLE, res);
                 }
                 ClasseurDeviC.Livraison(idc);
                 Afficher_Msg_Confirmation("La livraison est bien Confirmé");
             }
             else
             {
                 Afficher_Msg_Erreur("Erreur Stock insuffisant pour le(s) article(s) : " + stockInsuff);
             }
         }
         else
         {
             Afficher_Msg_Erreur("Vous devez selectionner un Classeur");
         }
     }
     catch (Exception ex)
     {
         Afficher_Msg_Erreur("Vous devez selectionner un Classeur");
     }
 }
コード例 #3
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (!TBId.Text.Equals(""))
            {
                int idsuivi = SuiviBonProdC.GetIdFromIdBon(TBId.Text);
                BPourcentage.Value      += 5;
                LabelVisionneVal.Content = BPourcentage.Value + " %";
                if (idsuivi == 0)
                {
                    if (SuiviBonProdC.AjouterSuiviBonProd(new SuiviBonProd(1, Int16.Parse(TBId.Text), BPourcentage.Value + "")) == 1)
                    {
                        BonProductionC.DemarrerProduction(Int16.Parse(TBId.Text));
                        Afficher_Msg_Confirmation("Demarrage de production et Enregistrement de progression");
                    }
                }
                else
                {
                    if (BPourcentage.Value != 100)
                    {
                        SuiviBonProdC.ModifierStat(idsuivi, BPourcentage.Value + "");
                        Afficher_Msg_Confirmation("Enregistrement de la progression est bien accomplit");
                    }
                    else
                    {
                        SuiviBonProdC.ModifierStat(idsuivi, BPourcentage.Value + "");
                        BonProductionC.Livraison(Int16.Parse(TBId.Text));
                        Afficher_Msg_Confirmation("Fin de production et Livraison");
                        int nbArticle = ArticleC.getQuantite(Int16.Parse(TBIdArticle.Text));
                        nbArticle += Int16.Parse(TBNbArticle.Text);
                        ArticleC.ModifierQuantiteArticle(Int16.Parse(TBIdArticle.Text), nbArticle);
                        Add.IsEnabled    = false;
                        Remove.IsEnabled = false;
                    }
                }
            }
            else
            {
                Afficher_Msg_Erreur("Vous devez selectionner un bon");
            }

            LoadAllBon();
        }