Ejemplo n.º 1
0
        public static void ConfirmerChargement_Commande(int CodeCommande, int CodeChauffeur, int CodeCamion)
        {
            try
            {
                string CodeTour    = DateTime.Now.Year + "" + CodeCommande;
                int    CodeTournee = int.Parse(CodeTour);

                ExecuteQuery("insert into Tournee values(@CodeTournee, @DateTournee)", new SqlParameter[] { new SqlParameter("@DateTournee", DateTime.Now), new SqlParameter("@CodeTournee", CodeTournee) });
                SqlParameter[] parametre = new SqlParameter[]
                {
                    new SqlParameter("@CodeChauf", CodeChauffeur),
                    new SqlParameter("@CodeCamion", CodeCamion),
                    new SqlParameter("@CodeTournee", CodeTournee)
                };

                ExecuteQuery("update Commande set numTournee = @CodeTournee where Codecommande = @CodeComm", new SqlParameter[]
                {
                    new SqlParameter("CodeTournee", CodeTournee),
                    new SqlParameter("@CodeComm", CodeCommande)
                });

                ExecuteQuery("insert into Chargement(CodeChauf, CodeCamion, CodeTournee) values(@CodeChauf, @CodeCamion, @CodeTournee)", parametre);

                int CodeChargement = int.Parse(ExecuteScalar("select IDENT_CURRENT('Chargement')").ToString());

                DataSet Data_Set = getBonChargement(CodeChargement);

                BonDeChargement reportCommande = new BonDeChargement();
                reportCommande.SetDataSource(Data_Set);

                Report_Viewer_Form frm = new Report_Viewer_Form();
                frm.Text = "Bon De Chargement N°: " + CodeChargement + " pour la commande N°: " + CodeCommande;
                frm.crystalReportViewer1.ReportSource = reportCommande;
                frm.Show();
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "Un Erreur est survenue", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void printBonChargemenet()
        {
            int CodeChargement = int.Parse(SqlServer_Classes.ExecuteScalar("select IDENT_CURRENT('Chargement')").ToString());

            var App = Application.OpenForms["Form1"] as Form1;

            Command_UC ucComm = (Command_UC)App.panelContainer.Controls[0];

            DataSet Data_Set = SqlServer_Classes.getBonChargement(CodeChargement);

            BonDeChargement reportCommande = new BonDeChargement();

            reportCommande.SetDataSource(Data_Set);

            ReportViewer_UC viewer_UC = new ReportViewer_UC();

            viewer_UC.Dock = DockStyle.Fill;
            viewer_UC.crystalReportViewer1.ReportSource = reportCommande;
            viewer_UC.Refresh();

            App.panelContainer.Controls.Clear();
            App.panelContainer.Controls.Add(viewer_UC);
        }