Example #1
0
        private void Accueil_Load(object sender, EventArgs e)
        {
            devisManager devisManage = new devisManager();
            List<devis> listeDevis = devisManage.listeDevis();

            foreach (devis unDevis in listeDevis)
            {
                clientManager clientManage = new clientManager();
                client unClient = clientManage.getUnclient(unDevis.getId());

                string texte = unDevis.getId() + " - " + unDevis.getDate() + " - " + unClient.getNom() + " " + unClient.getPrenom();
                int valeur = unDevis.getId();
                item unItem = new item(texte, valeur);

                comboListeDevis.Items.Add(unItem);
            }
        }
Example #2
0
        private void buttonEditer_Click(object sender, EventArgs e)
        {
            if (comboSelectVehicule.SelectedItem == null || listPiece.Items.Count <= 0)
            {
                MessageBox.Show("Veuillez remplir tous les champs");
            }
            else
            {
                //On créé un nouveau devis avec la date et l'immatriculation
                String laDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                String immat = comboSelectVehicule.SelectedItem.ToString();

                devis unDevis = new devis(0, laDate, immat);
                devisManager devisManage = new devisManager();

                //Id du dernier devis.
                long dernierId = devisManage.editeDevis(unDevis);

                foreach (ListViewItem unItem in listPiece.Items)
                {
                    //On récupere la quantité
                    int quantite = Convert.ToInt32(unItem.SubItems[1].Text);
                    //On créer une piece pour avoir l'id
                    piecesManager pieceManage = new piecesManager();
                    piece unePiece = pieceManage.unePiece(unItem.SubItems[0].Text.ToString());

                    repareManager repareManage = new repareManager();
                    repareManage.ajouteRepare((int)dernierId, unePiece.getId(), quantite);
                }
                MessageBox.Show("Le devis à été édité.");

                feuilleDevis feuilleDevis = new feuilleDevis((int)dernierId);
                this.Close();
                feuilleDevis.ShowDialog();
            }
        }
Example #3
0
        private void feuilleDevis_Load(object sender, EventArgs e)
        {
            //On recupère les infos client
            clientManager clientManage = new clientManager();
            client leClient = clientManage.getUnclient(idDevis);

            //On récupère la date
            devisManager devisManage = new devisManager();
            DateTime laDate = devisManage.getDate(idDevis);

            //On récupere l'immatriculation
            vehiculesManager vehiculeManage = new vehiculesManager();
            string immat = vehiculeManage.getImmat(idDevis);

            //On récupère la TVA
            tvaManager tvaManage = new tvaManager();
            tva laTva = tvaManage.uneTva();

            //On affiche les informartion du client
            labelNomClient.Text = leClient.getNom();
            labelPrenomClient.Text = leClient.getPrenom();
            labelAdresse1.Text = leClient.getAdr1();
            labelAdresse2.Text = leClient.getAdr2();
            labelCP.Text = leClient.getCP().ToString();
            labelVille.Text = leClient.getVille();

            //On affiche la date
            labelDate.Text = laDate.ToString();

            //on affiche l'immatriculation
            labelImmat.Text = immat;

            //On affiche la tva
            labelTauxTva.Text = laTva.getTaux().ToString() + "%";

            //On affiche la liste des pieces
            repareManager repareManage = new repareManager();
            List<repare> listeRepare = repareManage.getListeRepare(idDevis);
            foreach (repare uneReparation in listeRepare)
            {
                piecesManager pieceManage = new piecesManager();
                int idPiece = uneReparation.getPieceId();
                piece unePiece = pieceManage.getPiece(idPiece);

                double prixTTC = (float)unePiece.getPrixHT() * (1 + (float)laTva.getTaux() / 100);
                prixTTC = Math.Round(prixTTC, 2);

                double totalTTC = prixTTC * uneReparation.getQuantite();

                ListViewItem item = new ListViewItem(unePiece.getId().ToString());
                item.SubItems.Add(unePiece.getLibelle());
                item.SubItems.Add(uneReparation.getQuantite().ToString());
                item.SubItems.Add(unePiece.getPrixHT().ToString());
                item.SubItems.Add(prixTTC.ToString());
                item.SubItems.Add(totalTTC.ToString());

                listViewPiece.Items.Add(item);
            }

            labelTotalTTC.Text = calculTotalTTC().ToString() + " €";
        }