コード例 #1
0
        private void Stat_annee_Load(object sender, EventArgs e)
        {
            panel1.Visible       = false;
            panel2.Visible       = false;
            panel3.Visible       = false;
            panel4.Visible       = false;
            panel5.Visible       = false;
            panel6.Visible       = false;
            panel7.Visible       = false;
            panel8.Visible       = false;
            panel9.Visible       = false;
            annee.Visible        = false;
            chart_vente.Visible  = false;
            comboBoxYear.Visible = false;
            search.Visible       = false;
            label1.Visible       = false;
            label2.Visible       = false;
            label3.Visible       = false;
            label4.Visible       = false;
            //label5.Visible = false;
            nb.Visible    = false;
            gain.Visible  = false;
            perte.Visible = false;
            //achat.Visible = false;
            des.Visible = false;

            VenteServiceWCFClient vente = new VenteServiceWCFClient();

            foreach (VenteService.Vente v in vente.listeVente())
            {
                if (!comboBoxYear.Items.Contains(Convert.ToDateTime(v.date_ajout).Year))
                {
                    comboBoxYear.Items.Add(Convert.ToDateTime(v.date_ajout).Year);
                    comboBoxYear2.Items.Add(Convert.ToDateTime(v.date_ajout).Year);
                }
            }


            foreach (VenteService.Vente ve in vente.listeVente())
            {
                chart_vente.Series["ventes"].Points.AddXY(ve.date_ajout.Value.Year, da.QuantiteYear(ve.date_ajout.Value.Year));
            }

            CommandeServiceWCFClient com = new CommandeServiceWCFClient();

            chart_commande.Series["commandes"].Points.AddXY("Confirmés", com.commandeConfirme().Count());
            chart_commande.Series["commandes"].Points.AddXY("En Retard", com.commandeEnRetard().Count());
            chart_commande.Series["commandes"].Points.AddXY("En Cours", com.commandeEnCours().Count());
        }
コード例 #2
0
        private void search2_Click(object sender, EventArgs e)
        {
            CommandeServiceWCFClient commande = new CommandeServiceWCFClient();
            //List<CommandeService.Commande>
            var com = commande.commandeConfirme().Concat(commande.commandeEnCours()).ToList();

            com = com.Concat(commande.commandeEnRetard()).ToList();
            var     nb = 0;
            int     s  = 0;
            decimal p  = 0;

            if (comboBoxYear2.Text != "")
            {
                foreach (var c in com)
                {
                    if (Convert.ToDateTime(c.date_commande).Year == Convert.ToInt32(comboBoxYear2.Text))
                    {//var pr = new List<ProduitService.Produit>();
                        s += commande.GetProduitsOfCommande(c.id_commande).Count();
                        p += commande.prixCommande(c.id_commande);
                        nb++;
                    }
                }
            }
            else
            {
                MessageBox.Show("Veuillez Choisir une année !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            decimal m = 0;

            if (nb != 0)
            {
                m = p / nb;
            }

            nb_com.Text      = Convert.ToString(nb);
            nb_commande.Text = Convert.ToString(s);
            prix.Text        = Convert.ToString(m.ToString("0.00"));
            prix_total.Text  = Convert.ToString(p);
        }