Exemple #1
0
 public static int ModifierSuiviBonProd(SuiviBonProd art)
 {
     try
     {
         Connexion con = new Connexion();
         con.OpenConnection();
         string       req = "UPDATE suivibonprod SET idbon =" + art.IDBON + ", suivi='" + art.POURCENTAGE + "' WHERE id=" + art.ID + " ";
         MySqlCommand cmd = new MySqlCommand(req, con.connexion);
         cmd.ExecuteNonQuery();
         con.CloseConnection();
         return(1);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return(0);
     }
 }
Exemple #2
0
        public static int AjouterSuiviBonProd(SuiviBonProd art)
        {
            try
            {
                Connexion con = new Connexion();
                con.OpenConnection();

                string       req = "INSERT INTO suivibonprod (idbon, suivi) VALUES (" + art.IDBON + ", '" + art.POURCENTAGE + "'); ";
                MySqlCommand cmd = new MySqlCommand(req, con.connexion);
                cmd.ExecuteNonQuery();
                con.CloseConnection();
                return(1);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + "" + e.ToString());
                return(0);
            }
        }
Exemple #3
0
        private void BTConfirmer_Click(object sender, RoutedEventArgs e)
        {
            {
                if (ChampVide())
                {
                    Afficher_Msg_Confirmation("Erreur : champ(s) vide(s)");
                }
                else
                {
                    String solId;
                    if (TBId.Text.Equals(""))
                    {
                        solId = "0";
                    }
                    else
                    {
                        solId = TBId.Text;
                    }
                    fsg_gpao.Acteurs.BonProduction articlex = new fsg_gpao.Acteurs.BonProduction(Int16.Parse(solId), Int16.Parse(TBIdArticle.Text), Int16.Parse(TBIdAtelier.Text), Int16.Parse(TBNbArticle.Text), TBDateDepart.Text, TBDateFin.Text, Int16.Parse(TBCout.Text));

                    if (ActionDemander.Equals("Démarrer"))
                    {
                        if (!TBId.Text.Equals(""))
                        {
                            DateTime localDat = DateTime.Now;
                            articlex.DATEDEPART = localDat.ToString("F");
                            int res = fsg_gpao.Connecteurs.BonProductionC.ModifierBon(articlex);
                            if (res == 1)
                            {
                                Afficher_Msg_Confirmation("Enregistrement de la date de départ est bien modifier");
                                DateTime localDate = DateTime.Now;
                                fsg_gpao.Connecteurs.JournalArticleC.ajouterJournal(new JournalArticle(this.idCourant, articlex.ID, localDate.ToString("F"), "Modification de : " + articlex.ID + " " + articlex.IDARTICLE + "", ""));
                            }
                            else
                            {
                                Afficher_Msg_Erreur("Erreur de connexion à la base de données");
                            }
                        }

                        else
                        {
                            Afficher_Msg_Erreur("Veuillez sélctionnez un Adminitrateur");
                        }
                        CacherGroupeB();
                        LoadAllBon();
                    }
                    else
                    {
                        if (ActionDemander.Equals("Livraison"))
                        {
                            if (!TBId.Text.Equals(""))
                            {
                                if (BPourcentage.Value != 100)
                                {
                                    Afficher_Msg_Erreur("la progression de production n'est pas aboutie");
                                }
                                else
                                {
                                    DateTime localDat = DateTime.Now;
                                    articlex.DATEFIN = localDat.ToString("F");

                                    int res = fsg_gpao.Connecteurs.BonProductionC.ModifierBon(articlex);
                                    if (res == 1)
                                    {
                                        Afficher_Msg_Confirmation("Enregistrement de la date de laivrison est bien modifier");
                                        DateTime localDate = DateTime.Now;
                                        fsg_gpao.Connecteurs.JournalArticleC.ajouterJournal(new JournalArticle(this.idCourant, articlex.ID, localDate.ToString("F"), "Modification de : " + articlex.ID + " " + articlex.IDARTICLE + "", ""));
                                    }
                                    else
                                    {
                                        Afficher_Msg_Erreur("Erreur de connexion à la base de données");
                                    }
                                }
                            }

                            else
                            {
                                Afficher_Msg_Erreur("Veuillez sélctionnez un Adminitrateur");
                            }
                            CacherGroupeB();
                            LoadAllBon();
                        }
                        else
                        {
                            if (ActionDemander.Equals("Progression"))
                            {
                                if (!TBId.Text.Equals(""))
                                {
                                    List <SuiviBonProd> lsbon = SuiviBonProdC.GetAllSuiviBonProd("idbon", TBId.Text);
                                    SuiviBonProd        atemp = new SuiviBonProd();
                                    if (lsbon.Count != 0)
                                    {
                                        atemp = lsbon.ElementAt(0);
                                    }

                                    int res = fsg_gpao.Connecteurs.SuiviBonProdC.ModifierSuiviBonProd(new SuiviBonProd(0, Int16.Parse(TBId.Text), BPourcentage.Value + ""));
                                    if (res == 1)
                                    {
                                        Afficher_Msg_Confirmation("Enregistrement de la progression est bien accomplit");
                                        DateTime localDate = DateTime.Now;
                                        fsg_gpao.Connecteurs.JournalArticleC.ajouterJournal(new JournalArticle(this.idCourant, articlex.ID, localDate.ToString("F"), "Modification de : " + articlex.ID + " " + articlex.IDARTICLE + "", ""));
                                    }
                                    else
                                    {
                                        Afficher_Msg_Erreur("Erreur de connexion à la base de données");
                                    }
                                }

                                else
                                {
                                    Afficher_Msg_Erreur("Veuillez sélctionnez un Adminitrateur");
                                }
                                CacherGroupeB();
                                LoadAllBon();
                            }
                        }
                    }
                }
                CacherGroupeB();
                LoadAllBon();
            }
        }