Example #1
0
        private void buttimp_Click(object sender, EventArgs e)
        {
            List <Impression> items = new List <Impression>();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                COMPTOIR p = dataGridView1.Rows[i].DataBoundItem as COMPTOIR;
                items.Add
                (
                    new Impression
                    (
                        p.Code,
                        p.Designation,
                        p.Quantite,
                        p.Prix,
                        p.TVA,

                        p.TOTAL
                    )



                );
            }
            Form f = new Commande("Impression.rdlc", items);

            f.Show();
        }
Example #2
0
 public Comptoir(COMPTOIR comptoir, Action callback) : this(callback)
 {
     this.oldcommande     = comptoir;
     textCODE.Text        = comptoir.Code;
     textDESIGNATION.Text = comptoir.Designation;
     textQUANTITE.Text    = comptoir.Quantite.ToString();
     textPRIX.Text        = comptoir.Prix.ToString();
     textTVA.Text         = comptoir.TVA.ToString();
     textTOTAL.Text       = comptoir.TOTAL.ToString();
 }
Example #3
0
        public void add(COMPTOIR comptoir)
        {
            var index = comptoirs.IndexOf(comptoir);

            //if (index >= 0)
            //    throw new DuplicateNameException("This comptoir reference already exists !");

            comptoirs.Add(comptoir);
            save();
        }
Example #4
0
        public void Set(COMPTOIR oldCOMPTOIR, COMPTOIR newCOMPTOIR)
        {
            var oldIndex = comptoirs.IndexOf(oldCOMPTOIR);
            var newIndex = comptoirs.IndexOf(newCOMPTOIR);

            if (oldIndex < 0)
            {
                throw new KeyNotFoundException("The comptoir doesn't exists !");
            }
            //if (newIndex >= 0 && oldIndex != newIndex)
            //    throw new DuplicateNameException("This comptoir reference already exists !");
            comptoirs[oldIndex] = newCOMPTOIR;
            save();
        }
Example #5
0
        private void buttajout_Click(object sender, EventArgs e)
        {
            COMPTOIR comptoir = new COMPTOIR
                                (

                textCODE.Text,
                textDESIGNATION.Text,
                int.Parse(textQUANTITE.Text),
                float.Parse(textTVA.Text),
                double.Parse(textPRIX.Text),

                double.Parse(textTOTAL.Text)
                //DateTime.Now.ToString(dateTimePicker2.Text)



                                );
            VENTEBLO comptoirBLO = new VENTEBLO(ConfigurationManager.AppSettings["Dbfolder"]);

            comptoirBLO.Commande(comptoir);

            MessageBox.Show(
                "save done",
                "confirmation",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information

                );
            if (callback != null)
            {
                callback();
            }
            textCODE.Clear();
            textDESIGNATION.Clear();
            textQUANTITE.Clear();
            textPRIX.Clear();
            textTOTAL.Clear();
            textTVA.Clear();
            //dateTimePicker2.Contain;
            textCODE.Focus();
        }
Example #6
0
        private void buttajout_Click(object sender, EventArgs e)
        {
            try
            {
                checkForm();
                COMPTOIR newcommande = new COMPTOIR
                                       (

                    textCODE.Text,
                    textDESIGNATION.Text,
                    int.Parse(textQUANTITE.Text),
                    float.Parse(textTVA.Text),
                    double.Parse(textPRIX.Text),

                    double.Parse(textTOTAL.Text)
                    //DateTime.Now.ToString(dateTimePicker2.Text)



                                       );



                VENTEBLO comptoirBLO = new VENTEBLO(ConfigurationManager.AppSettings["dbfolder"]);

                if (this.oldcommande == null)
                {
                    comptoirBLO.Commande(newcommande);
                }
                else
                {
                    comptoirBLO.Editcommande(oldcommande, newcommande);
                }

                MessageBox.Show
                (
                    "Save done !",
                    "Confirmation",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                );
            }


            catch (TypingException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Typing error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (DuplicateNameException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Duplicate error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (KeyNotFoundException ex)
            {
                MessageBox.Show
                (
                    ex.Message,
                    "Not found error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning
                );
            }
            catch (Exception ex)
            {
                ex.WriteToFile();
                MessageBox.Show
                (
                    "An error occurred! Please try again later.",
                    "Erreur",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );
            }
            if (callback != null)
            {
                callback();
            }
            textCODE.Clear();
            textDESIGNATION.Clear();
            textQUANTITE.Clear();
            textPRIX.Clear();
            textTOTAL.Clear();
            textTVA.Clear();
            //dateTimePicker2.Contain;
            textCODE.Focus();
            loadata();
        }
Example #7
0
 public void remove(COMPTOIR comptoir)
 {
     comptoirs.Remove(comptoir);//base sur comptoir.equals redefini
     save();
 }
Example #8
0
 public void DeleteCommande(COMPTOIR comptoir)
 {
     REPO.remove(comptoir);
 }
Example #9
0
 public void Commande(COMPTOIR comptoir)
 {
     REPO.add(comptoir);
 }
Example #10
0
 public void Editcommande(VENTEBLO oldcommande, COMPTOIR newcommande)
 {
     //  throw new NotImplementedException();
 }
Example #11
0
 public void Editcommande(COMPTOIR oldcommande, COMPTOIR newcommande)
 {
     REPO.Set(oldcommande, newcommande);
 }