Esempio n. 1
0
        public void Supprimer()
        {
            if (VenteSelectionnee != null)
            {
                if (MessageBox.Show("Supprimer l'enregistrement ?", "Confirmer", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    int Iid = VenteSelectionnee.idClient;
                    C_ClientsVoiture clTmp = new G_ClientsVoiture(chConnexion).Lire_ID(Iid);

                    //Suppression de la facture associée à la vente dans le dossier
                    string nomFichier    = clTmp.nomClient + "_" + clTmp.prenomClient + "_IDC" + Iid.ToString() + "_IDV" + VenteSelectionnee.idVoiture.ToString() + "_FactureVente.txt";
                    string nomRepertoire = @"C:\Users\Maesm\Documents\Complement_P\ISET2018_WPFBD_MVVM_concept\Factures_V";
                    string path          = nomRepertoire + "/" + nomFichier;
                    MessageBox.Show(path);
                    if (File.Exists(path))
                    {
                        MessageBox.Show("Suppression du fichier texte associé");
                        File.Delete(path);
                    }
                    else
                    {
                        MessageBox.Show("Fichier texte introuvable");
                    }
                    int          iId      = VenteSelectionnee.idOperation;
                    C_AchatVente tmpVente = new G_AchatVente(chConnexion).Lire_ID(iId);

                    //Ajout évenements au journal de modif
                    journal.AjoutSuppressionVenteJournal(VenteSelectionnee.idVoiture, Iid, clTmp.nomClient, clTmp.prenomClient, tmpVente.dateOperation.ToShortDateString(), tmpVente.prixOperation);

                    new Model.G_AchatVente(chConnexion).Supprimer(VenteSelectionnee.idOperation);
                    BcpVente.Remove(VenteSelectionnee);
                }
            }
        }
Esempio n. 2
0
 //Confirmation pour l'ajout ou la modification
 public void Confirmer()
 {
     if (nAjout == -1)
     {
         UneVente.IDOperation = new Model.G_AchatVente(chConnexion).Ajouter(UneVente.IDVoiture, UneVente.IDClient, UneVente.Prix, UneVente.Date, UneVente.IDPaiement, UneVente.Type);
         BcpVente.Add(new C_AchatVente(UneVente.IDOperation, UneVente.IDVoiture, UneVente.IDClient, UneVente.Prix, UneVente.Date, UneVente.IDPaiement, UneVente.Type));
     }
     else
     {
         new Model.G_AchatVente(chConnexion).Modifier(UneVente.IDOperation, UneVente.IDVoiture, UneVente.IDClient, UneVente.Prix, UneVente.Date, UneVente.IDPaiement, UneVente.Type);
         BcpVente[nAjout] = new C_AchatVente(UneVente.IDOperation, UneVente.IDVoiture, UneVente.IDClient, UneVente.Prix, UneVente.Date, UneVente.IDPaiement, UneVente.Type);
     }
     ActiverUneFiche = false;
 }
Esempio n. 3
0
 public void Modifier()
 {
     if (VenteSelectionnee != null)
     {
         C_AchatVente Tmp = new Model.G_AchatVente(chConnexion).Lire_ID(VenteSelectionnee.idOperation);
         UneVente             = new VM_UneVente();
         UneVente.IDOperation = Tmp.idOperation;
         UneVente.IDVoiture   = Tmp.idVoiture;
         UneVente.IDClient    = Tmp.idClient;
         UneVente.Prix        = Tmp.prixOperation;
         UneVente.Date        = Tmp.dateOperation;
         UneVente.IDPaiement  = Tmp.idPaiement;
         UneVente.Type        = Tmp.typeOperation;
         nAjout          = BcpVente.IndexOf(VenteSelectionnee);
         ActiverUneFiche = true;
     }
 }