コード例 #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();
            }
        }
コード例 #2
0
ファイル: BALCommande.cs プロジェクト: NET-DSEN-C/Project
        public static int addCommande(DAL.Commande c)
        {
            int             res;
            OleDbConnection cn = new OleDbConnection();

            cn             = Global.seConnecter(Global.cs);
            Object[,] attr =
            {
                { "@NumCmd",    c.NumCmd    },
                { "@DateCmd",   c.DateCmd   },
                { "@NumClient", c.NumClient },
            };
            res = Global.ExecuterOleDBActionNomsParams(@"insert into commande values" +
                                                       " (@NumCmd,@DateCmd,@NumClient)", cn, attr);
            Global.seDeconnecter(cn);
            return(0);
        }