Beispiel #1
1
        public void Modifier(Facture facture ,Client client, DateTime dateFacture, Facture.eFactureEtats etat, decimal totalFacture, DateTime rappelEnvoye, bool archive)
        {
            facture.Archive = archive;
            facture.Client = client;
            facture.DateFacture = dateFacture;
            facture.Etat = etat;
            facture.RappelEnvoye = rappelEnvoye;
            facture.TotalFacture = totalFacture;

            Database.Instance.update(facture);
        }
 public bool SupprimerClient(Client client)
 {
     if (ClientStore.Instance.Supprimer(client))
     {
         _clients.Remove(client);
         return true;
     }
     return false;
 }
Beispiel #3
0
 public Facture(Guid numFacture,Client client,DateTime dateFacture,eFactureEtats etat, decimal totalFacture,DateTime rappelEnvoye,bool archive)
 {
     NumFacture =  numFacture;
     Client = client;
     DateFacture = dateFacture;
     Etat = etat;
     TotalFacture = totalFacture;
     RappelEnvoye = rappelEnvoye;
     Archive = archive;
 }
 /// <summary>
 /// creer via le store un object animal et l'ajoute dans la bindinglist
 /// </summary>
 /// <param name="nomAnimal"></param>
 /// <param name="sexe"></param>
 /// <param name="antecedant"></param>
 /// <param name="archive"></param>
 /// <param name="client"></param>
 /// <param name="couleur"></param>
 /// <param name="race"></param>
 /// <param name="tatouage"></param>
 /// <returns>un object animal</returns>
 /// <exception cref="Exception"></exception>
 public Animal AjouterAnimal(string nomAnimal, Animal.eSexe sexe, string couleur, Race race,
      string tatouage, string antecedant, bool archive, Client client)
 {
     try
     {
         Animal a = AnimalStore.Instance.Ajouter(nomAnimal, sexe, couleur, race, tatouage, antecedant, archive, client);
         _animaux.Add(a);
         return a;
     }
     catch (Exception e)
     {
         throw e;
     }
     return null;
 }
Beispiel #5
0
 /// <summary>
 /// Creer un animal
 /// </summary>
 /// <param name="nomAnimal"></param>
 /// <param name="sexe"></param>
 /// <param name="couleur"></param>
 /// <param name="race"></param>
 /// <param name="tatouage"></param>
 /// <param name="antecedant"></param>
 /// <param name="archive"></param>
 /// <param name="client"></param>
 /// <returns></returns>
 /// <exception cref="Exception"></exception>
 public Animal Ajouter(string nomAnimal, Animal.eSexe sexe, string couleur, Race race,
      string tatouage, string antecedant, bool archive, Client client)
 {
     Animal animal = new Animal(Guid.NewGuid(), nomAnimal, sexe, couleur, race, tatouage, antecedant, archive, client);
     try
     {
         Database.Instance.insert(animal);
         this.Animaux.Add(animal);
     }
     catch (Exception e)
     {
         throw new Exception("Erreur sur Ajout.\n" + e.Message, e);
     }
     return animal;
 }
Beispiel #6
0
 /// <summary>
 /// Ajouter un client dans le store et persiste dans la base
 /// </summary>
 /// <param name="nomClient"></param>
 /// <param name="prenomClient"></param>
 /// <param name="adresse1"></param>
 /// <param name="adresse2"></param>
 /// <param name="codePostal"></param>
 /// <param name="ville"></param>
 /// <param name="numTel"></param>
 /// <param name="assurance"></param>
 /// <param name="email"></param>
 /// <param name="remarque"></param>
 /// <param name="archive"></param>
 /// <returns>Null si l'insertion n'a pas ete effectuee</returns>
 /// <exception cref="Exception">erreur sur insertion en DB</exception>
 public Client Ajouter( string nomClient, string prenomClient, string adresse1, string adresse2, string codePostal,
     string ville, string numTel, string assurance, string email, string remarque, Boolean archive)
 {
     Client client = new Client(Guid.NewGuid(), nomClient, prenomClient, adresse1, adresse2, codePostal,
      ville, numTel, assurance, email, remarque, archive);
     try
     {
         if (Database.Instance.insert(client))
         {
             this.Clients.Add(client);
             return client;
         }
     }
     catch (Exception e)
     {
         throw new Exception("Erreur sur modification et persistance du client en base de données", e);
     }
     return null;
 }
Beispiel #7
0
 /// <summary>
 /// Construteur Animal
 /// </summary>
 /// <param name="codeAnimal"></param>
 /// <param name="nomAnimal"></param>
 /// <param name="sexe"></param>
 /// <param name="couleur"></param>
 /// <param name="race"></param>
 /// <param name="tatouage"></param>
 /// <param name="antecedents"></param>
 /// <param name="archive"></param>
 /// <param name="client"></param>
 /// <exception cref="Exception"></exception>
 public Animal(Guid codeAnimal, string nomAnimal, eSexe sexe, string couleur, Race race,
      string tatouage, string antecedents, Boolean archive, Client client)
 {
     try
     {
         CodeAnimal = codeAnimal;
         NomAnimal = nomAnimal;
         Sexe = sexe;
         Couleur = couleur;
         Race = race;
         Tatouage = tatouage;
         Antecedents = antecedents;
         Archive = archive;
         Client = client;
     }
     catch (Exception e)
     {
         throw new Exception("Cet animal ne peut être cree avec ces valeurs\n" + e.Message, e);
     }
 }
Beispiel #8
0
 public Facture Ajouter(Client client, DateTime dateFacture, Facture.eFactureEtats etat, decimal totalFacture, DateTime rappelEnvoye, bool archive)
 {
     Facture facture = new Facture(Guid.NewGuid(), client, dateFacture, etat, totalFacture, rappelEnvoye, archive);
     Database.Instance.insert(facture);
     return facture;
 }
Beispiel #9
0
 /// <summary>
 /// Construit un Formulaire de creation d'un animal pour un client
 /// </summary>
 /// <param name="animal"></param>
 public AnimalForm(Client client)
     : this()
 {
     this.cbbClient.SelectedItem = client;
     this.cbbClient.Enabled = false;
 }
 public static void ModifierFacture(Facture facture, Client client, DateTime dateFacture, Facture.eFactureEtats etat, decimal totalFacture, DateTime rappelEnvoye, bool archive)
 {
     FactureStore.Instance.Modifier(facture, client, dateFacture, etat, totalFacture, rappelEnvoye, archive);
 }
 public static Facture AjouterFacture(Guid numFacture, Client client, DateTime dateFacture, Facture.eFactureEtats etat, decimal totalFacture, DateTime rappelEnvoye, bool archive)
 {
     return FactureStore.Instance.Ajouter(client, dateFacture, etat, totalFacture, rappelEnvoye, archive);
 }
Beispiel #12
0
 /// <summary>
 /// Modifie un client dans le store et persiste dans la base
 /// </summary>
 /// <param name="client"></param>
 /// <param name="nomClient"></param>
 /// <param name="prenomClient"></param>
 /// <param name="adresse1"></param>
 /// <param name="adresse2"></param>
 /// <param name="codePostal"></param>
 /// <param name="ville"></param>
 /// <param name="numTel"></param>
 /// <param name="assurance"></param>
 /// <param name="email"></param>
 /// <param name="remarque"></param>
 /// <param name="archive"></param>
 /// <exception cref="Exception">erreur sur insertion en DB</exception>
 public void Modifier(Client client, string nomClient, string prenomClient, string adresse1, string adresse2, string codePostal,
     string ville, string numTel, string assurance, string email, string remarque, Boolean archive)
 {
     client.NomClient = nomClient;
     client.PrenomClient = prenomClient;
     client.Adresse1 = adresse1;
     client.Adresse2 = adresse2;
     client.Archive = archive;
     client.Assurance = assurance;
     client.CodePostal = codePostal;
     client.Email = email;
     client.NumTel = numTel;
     client.Remarque = remarque;
     client.Ville = ville;
     try
     {
         Database.Instance.update(client);
     }
     catch (Exception e)
     {
         throw new Exception("Erreur sur modification et persistance du client en base de données",e);
     }
 }
 public BindingList<Animal> getAnimalPourClient(Client client)
 {
     return new BindingList<Animal>(AnimalController.Instance.Animaux.ToList<Animal>().FindAll(
         (Animal a) =>
         {
             return a.Client.Equals(client);
         }
     ));
 }
 /// <summary>
 /// Modifier animal
 /// </summary>
 /// <param name="animal"></param>
 /// <param name="nomAnimal"></param>
 /// <param name="sexe"></param>
 /// <param name="couleur"></param>
 /// <param name="race"></param>
 /// <param name="tatouage"></param>
 /// <param name="antecedents"></param>
 /// <param name="client"></param>
 /// <param name="archive"></param>
 /// <exception cref="Exception"></exception>
 public void ModifierAnimal(Animal animal, string nomAnimal, Animal.eSexe sexe, string couleur, Race race,
      string tatouage, string antecedents, Client client, bool archive = false)
 {
     try
     {
         AnimalStore.Instance.Modifier(animal, nomAnimal, sexe, couleur, race, tatouage, antecedents, archive, client);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Beispiel #15
0
 /// <summary>
 /// Modifie l'animal
 /// </summary>
 /// <param name="animal"></param>
 /// <param name="nomAnimal"></param>
 /// <param name="sexe"></param>
 /// <param name="couleur"></param>
 /// <param name="race"></param>
 /// <param name="tatouage"></param>
 /// <param name="antecedents"></param>
 /// <param name="archive"></param>
 /// <param name="client"></param>
 /// <exception cref="Exception"></exception>
 public void Modifier(Animal animal, string nomAnimal, Animal.eSexe sexe, string couleur, Race race,
      string tatouage, string antecedents, bool archive, Client client)
 {
     animal.Antecedents = antecedents;
     animal.Archive = archive;
     animal.Client = client;
     animal.Couleur = couleur;
     animal.NomAnimal = nomAnimal;
     animal.Sexe = sexe;
     animal.Tatouage = tatouage;
     animal.Race = race;
     try
     {
         Database.Instance.update(animal);
     }
     catch (Exception e)
     {
         throw new Exception("Erreur sur Modification.\n" + e.Message,e);
     }
 }
Beispiel #16
0
 /// <summary>
 /// archive le client
 /// </summary>
 /// <param name="client"></param>
 /// <returns>boolean</returns>
 public bool Supprimer(Client client)
 {
     //@todo get facture.
     //@todo archiver animaux du client
     client.Archive = true;
     try
     {
         Database.Instance.update(client);
         foreach(Animal animal in AnimalStore.Instance.Animaux.FindAll(a => a.Client.Equals(client)))
         {
             AnimalStore.Instance.Supprimer(animal);
         }
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
Beispiel #17
0
 /// <summary>
 /// Affiche la liste des animùaux du client selectionne
 /// </summary>
 /// <param name="client"></param>
 private void _displayAnimaux(Client client)
 {
     this.ListAnimaux = AnimalController.Instance.getAnimalPourClient(client) ;
     this.dgvAnimaux.DataSource = this.ListAnimaux;
     _evalAnimalAction();
 }
 public void ModifierClient(Client client, string nomClient, string prenomClient, string adresse1, string adresse2, string codePostal,
     string ville, string numTel, string assurance, string email, string remarque, Boolean archive)
 {
     ClientStore.Instance.Modifier(client, nomClient, prenomClient, adresse1, adresse2, codePostal,
      ville, numTel, assurance, email, remarque, archive);
 }