public Consultation(Guid codeConsultation,Facture facture, Veterinaire veto, Animal animal,DateTime dateConsultation, eConsultationEtat etat, string commentaire,bool archive) { CodeConsultation = codeConsultation; Archive = archive; Commentaire = commentaire; DateConsultation = dateConsultation; Etat = etat; Facture = facture; Veto = veto; Animal = animal; }
public DossierMedicalForm(Animal animal = null) { InitializeComponent(); if (null != animal) { this.txtAnimal.Text = animal.NomAnimal; this.txtProprietaire.Text = animal.Client.NomClient; this.txtEcran.Text = animal.Antecedents; } }
/// <summary> /// Ajoute un rendez vous /// </summary> /// <param name="veto"></param> /// <param name="animal"></param> /// <param name="dateRdv"></param> /// <returns>un objet agenda</returns> /// <exception cref="Exception"></exception> public Agenda AjouterAgenda(Veterinaire veto, Animal animal, DateTime dateRdv) { try { Agenda agenda = AgendaStore.Instance.Ajouter(veto, animal, dateRdv); return agenda; } catch (Exception e) { throw e; } }
/// <summary> /// Constructeur Agenda /// </summary> /// <param name="veto"></param> /// <param name="animal"></param> /// <param name="dateRdv"></param> /// <exception cref="Exception"></exception> public Agenda(Veterinaire veto,Animal animal, DateTime dateRdv) { try { Veto = veto; Animal = animal; DateRdv = dateRdv; } catch (Exception e) { throw new Exception("Cet agenda ne peut être cree avec ces valeurs\n" + e.Message, e); } }
/// <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; }
/// <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; }
/// <summary> /// Ajoute un rendez vous /// </summary> /// <param name="veto"></param> /// <param name="animal"></param> /// <param name="dateRdv"></param> /// <returns></returns> /// <exception cref="Exception"></exception> public Agenda Ajouter(Veterinaire veto, Animal animal, DateTime dateRdv) { try { if( default(Agenda) != Agendas.Find( ag => ag.DateRdv == dateRdv && ag.Veto == veto)) throw new Exception("Ce veterinaire a deja un rendez vous a cette date!!!"); if (default(Agenda) != Agendas.Find(ag => ag.DateRdv == dateRdv && ag.Animal == animal)) throw new Exception("Cet animal a deja un rendez vous a cette date!!!"); Agenda agenda = new Agenda(veto, animal, dateRdv); Database.Instance.insert(agenda); this.Agendas.Add(agenda); return agenda; } catch (Exception e) { throw e; } }
/// <summary> /// Construit un Formulaire de creation ou de modification d'un animal /// </summary> /// <param name="animal"></param> public AnimalForm(Animal animal = null) { InitializeComponent(); this.cbbClient.DisplayMember = "NomClient"; this.cbbClient.DataSource = ClientController.Instance.Clients; this.cbbSexe.DisplayMember = "Sexe"; this.cbbSexe.DataSource = new string[]{ "M", "F", "H" }; this.cbbEspece.DisplayMember = "Nom"; this.cbbEspece.DataSource = RaceController.Instance.Races; if (null != animal) { this.txtCode.Text = animal.CodeAnimal.ToString(); this.txtNom.Text = animal.NomAnimal; this.txtCouleur.Text = animal.Couleur; this.txtTatouage.Text = animal.Tatouage; //TODO gerer le cas ou pas de tatouage this.cbbClient.SelectedItem = animal.Client; this.cbbClient.Enabled = false; this.cbbSexe.SelectedItem = animal.Sexe; this.cbbEspece.SelectedItem = animal.Race; this.btnValider.Click += (object sender, EventArgs e) => { _valider(animal); }; } else { this.btnValider.Click += (object sender, EventArgs e) => { _valider(); }; } this.btnAnnuler.Click += (object sender, EventArgs e) => { this.Close(); }; this.btnDossierMedical.Click += (object sender, EventArgs e) => { DossierMedicalForm form = new DossierMedicalForm(animal); form.Show(); }; }
/// <summary> /// modifie un rendez vous /// </summary> /// <param name="agenda"></param> /// <param name="veto"></param> /// <param name="animal"></param> /// <param name="dateRdv"></param> /// <exception cref="Exception"></exception> public void Modifier(Agenda agenda, Veterinaire veto, Animal animal, DateTime dateRdv) { try { agenda.Veto = veto; agenda.DateRdv = dateRdv; agenda.Animal = animal; Database.Instance.update(agenda); } catch (Exception e) { throw e; } }
/// <summary> /// Valide et modifie un animal /// Declenche l'evenement de validation /// </summary> /// <param name="animal"></param> /// <exception cref="Exception"></exception> private void _valider(Animal animal) { try { AnimalController.Instance.ModifierAnimal(animal, txtNom.Text, (Animal.eSexe)cbbSexe.Text[0], txtCouleur.Text, (Race)cbbEspece.SelectedItem, txtTatouage.Text, " ", (Client)cbbClient.SelectedItem, false); if (null != evtValider) evtValider.Invoke(animal); this.Close(); } catch (Exception e) { Alert.Show(e.Message); } }
public Consultation AjouterConsultation(Facture facture, Veterinaire veto, Animal animal, DateTime dateConsultation, Consultation.eConsultationEtat etat, string commentaire, bool archive) { return ConsultationStore.Instance.Ajouter(facture, veto, animal, dateConsultation, etat, commentaire, archive); }
/// <summary> /// archive un animal /// </summary> /// <param name="animal"></param> /// <returns>vrai ou faux</returns> /// <exception cref="Exception"></exception> public bool SupprimerAnimal(Animal animal) { try { if (AnimalStore.Instance.Supprimer(animal)) { _animaux.Remove(animal); return true; } } catch (Exception e) { throw e; } return false; }
/// <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; } }
/// <summary> /// archive l'animal /// </summary> /// <param name="animal"></param> /// <returns>boolean</returns> /// <exception cref="Exception"></exception> public bool Supprimer(Animal animal) { //@todo get facture. //@todo archiver animaux du client animal.Archive = true; try { Database.Instance.update(animal); } catch (Exception e) { throw new Exception("Erreur sur Archivage.\n" + e.Message, e); } return true; }
/// <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); } }
public Consultation Ajouter(Facture facture, Veterinaire veto,Animal animal, DateTime dateConsultation, Consultation.eConsultationEtat etat, string commentaire, bool archive) { Consultation consultation = new Consultation(Guid.NewGuid(), facture, veto,animal, dateConsultation, etat, commentaire, archive); Database.Instance.insert(consultation); return consultation; }