Example #1
0
        private void ValiderLigneCmd_Click(object sender, EventArgs e)
        {
            DAL.Commande cmd = new DAL.Commande(RefCmdTextBoxAjoutCmd.Text, Int32.Parse(idclient.Text), DateAjoutCmd.Value.ToString());
            if (BALCommande.checkCmd(cmd.NumCmd))
            {
                for (int i = 0; i < nbrLigCmd; i++)
                {
                    BALLignecmd.deleteLigCmd(cmd.NumCmd);
                }
                BALCommande.deleteCmd(cmd.NumCmd);
            }


            BALCommande.addCommande(cmd);

            if (LignesCmdGrid.Rows.Count > 0)
            {
                for (int i = 0; i < LignesCmdGrid.Rows.Count; i++)
                {
                    DAL.Lignecmd l = new DAL.Lignecmd(
                        LignesCmdGrid.Rows[i].Cells[0].Value.ToString(),
                        RefCmdTextBoxAjoutCmd.Text,
                        Int32.Parse(LignesCmdGrid.Rows[i].Cells[2].Value.ToString()),
                        float.Parse(LignesCmdGrid.Rows[i].Cells[3].Value.ToString())
                        );
                    BALLignecmd.addLigneCmd(l);
                }
                BALCommande.remplirListeCommande(cmddgv);
                this.Close();
            }
        }
Example #2
0
        public static int addLigneCmd(DAL.Lignecmd lc)
        {
            int             res;
            OleDbConnection cn = new OleDbConnection();

            cn             = Global.seConnecter(Global.cs);
            Object[,] attr =
            {
                { "@CodeProduit", lc.CodeProduit },
                { "@NumcCmd",     lc.NumCmd      },
                { "@Qte",         lc.Qte         },
                { "@Prix",        lc.Prix        }
            };
            res = Global.ExecuterOleDBActionNomsParams(@"insert into ligcmd (CodeProduit,NumCmd,Qte,Prix) values " + " (@CodeProduit, @NumCmd,@Qte,@Prix)", cn, attr);
            Global.seDeconnecter(cn);
            return(0);
        }