예제 #1
0
        public static void removeAnimal(int id, DB_ENTITIES _db)
        {
            Animaux myAnimal = _db.Animaux.Find(id);
            var     rappels  = _db.Rappel;

            foreach (Rappel rappel in rappels)
            {
                if (rappel.Animaux_idAnimaux == myAnimal.idAnimaux)
                {
                    Utils.removeRappel(rappel.idRappel, _db);
                }
            }
            var ordonnances = _db.Ordonnance;

            foreach (Ordonnance ordonnance in ordonnances)
            {
                if (ordonnance.Animaux_idAnimaux == myAnimal.idAnimaux)
                {
                    Utils.removeOrdonnance(ordonnance.idOrdonnance, _db);
                }
            }
            myAnimal.Soins = null;
            myAnimal.Race  = null;
            _db.Animaux.Remove(myAnimal);
            _db.SaveChanges();
        }
예제 #2
0
 public Rappels_Form(Animaux animal)
 {
     _db = new DB_ENTITIES();
     InitializeComponent();
     datePicker.MinDate = DateTime.Now;
     this.animal        = animal;
 }
예제 #3
0
 public Facture(List <Soins> soins, Animaux animal, Clients client)
 {
     InitializeComponent();
     soins.ForEach(s => this.soinsList.Items.Add(s.Description));
     this.animalName.Text = animal.Nom;
     this.nameClient.Text = client.Nom;
 }
예제 #4
0
        private void pdfExportButton_Click(object sender, EventArgs e)
        {
            DateTime today  = DateTime.Today;
            Clients  client = _db.Clients.Find(idClientSelected);
            Animaux  animal = _db.Animaux.Find(idAnimalSelected);

            using (SaveFileDialog sfd = new SaveFileDialog()
            {
                Filter = "PDF file|*.pdf", ValidateNames = true
            })
            {
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    Document doc = new Document(PageSize.A4.Rotate());
                    try
                    {
                        PdfWriter.GetInstance(doc, new FileStream(sfd.FileName, FileMode.Create));
                        doc.Open();
                        doc.Add(new Paragraph("Ordonnance du " + today.ToString("dd/MM/yyyy")));
                        doc.Add(new Paragraph("Concernant l'animal " + animal.Nom + " appartenant à " + client.Nom + "."));
                        doc.Add(new Paragraph(prescription));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    finally
                    {
                        doc.Close();
                    }
                }
            }
            MessageBox.Show("Ordonnance a bien été généré");
            this.Hide();
        }
예제 #5
0
        private void allAnimalsClient_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int     id                 = int.Parse(this.allAnimalsClient.SelectedItems[0].Text);
            Animaux toShow             = _db.Animaux.Find(id);
            FicheAnimalInterface sheet = new FicheAnimalInterface(toShow);

            sheet.Show();
        }
예제 #6
0
        private void allAnimauxList_DoubleClick(object sender, EventArgs e)
        {
            int     id               = int.Parse(this.allAnimauxList.SelectedItems[0].SubItems[0].Text.Split('.')[0]);
            Animaux toShow           = _db.Animaux.Find(id);
            FicheAnimalInterface fai = new FicheAnimalInterface(toShow);

            fai.Show();
        }
예제 #7
0
 public Maladies_Form(Animaux animal)
 {
     InitializeComponent();
     this.animal             = animal;
     dateTimePicker1.MaxDate = DateTime.Now;
     _db  = new DB_ENTITIES();
     date = DateTime.Now;
     completeMaladie();
     animal = _db.Animaux.Find(1);
 }
예제 #8
0
 public FicheAnimalInterface(Animaux animal)
 {
     _db = new DB_ENTITIES();
     InitializeComponent();
     this.animal = animal;
     InitializeIntels();
     listOfDiseases.FullRowSelect = true;
     listReminders.FullRowSelect  = true;
     completeMaladieList();
     completeRemindersList();
 }
예제 #9
0
 private void edit_Click(object sender, EventArgs e)
 {
     if (allAnimauxList.SelectedItems.Count > 0)
     {
         selectedLine = allAnimauxList.SelectedItems[0].Text;
         int     id             = int.Parse(selectedLine.Split('.')[0]);
         Animaux selectedAnimal = getAnimaux(id);
         InscriptionAnimalInterface modifyAnimal = new InscriptionAnimalInterface(selectedAnimal, this, null);
         modifyAnimal.Show();
     }
 }
예제 #10
0
        private void inscription_Click(object sender, EventArgs e)
        {
            Animaux an = new Animaux();

            an.Nom              = textBox1.Text;
            an.Poids            = (int)numericUpDown1.Value;
            an.Caractéristiques = richTextBox1.Text;
            an.DateNaissance    = dateTimePicker1.Value;
            if (client != null)
            {
                an.Clients_idClients = client.idClients;
            }
            if (femelle.Checked)
            {
                an.Sexe = "F";
            }
            else
            {
                an.Sexe = "M";
            }
            if (animal == null)
            {
                _db.Animaux.Add(an);
            }
            else
            {
                animal.Nom              = an.Nom;
                animal.DateNaissance    = an.DateNaissance;
                animal.Sexe             = an.Sexe;
                animal.Poids            = an.Poids;
                animal.Caractéristiques = an.Caractéristiques;
            }
            _db.SaveChanges();
            var animaux = _db.Animaux;
            int max     = 0;

            foreach (Animaux ani in animaux)
            {
                max = ani.idAnimaux;
            }
            List <Race> mesRaces = new List <Race>();

            mesRaces.Add(raceSelected);
            Animaux animal2 = _db.Animaux.Find(max);

            animal2.Race = mesRaces;
            _db.SaveChanges();
            inscriptionGood(an);
        }
예제 #11
0
 public InscriptionAnimalInterface(Animaux animalSelected, AnimauxInterface animalInterface, Clients client)
 {
     InitializeComponent();
     isModification          = false;
     this.client             = client;
     dateTimePicker1.MaxDate = DateTime.Now;
     this.animalList         = animalInterface;
     animal   = animalSelected;
     this._db = new DB_ENTITIES();
     isMan    = true;
     dateNais = DateTime.Now;
     idAnimal = 0;
     if (animal != null)
     {
         idAnimal = animal.idAnimaux;
         initializeInput();
         isModification = true;
     }
     init();
 }
예제 #12
0
        private void inscriptionGood(Animaux myAnimal)
        {
            var animaux = _db.Animaux;

            foreach (Animaux animal in animaux)
            {
                if (animal.Nom.Equals(myAnimal.Nom) && animal.Poids.Equals(myAnimal.Poids) &&
                    animal.DateNaissance.Equals(myAnimal.DateNaissance) && animal.Caractéristiques == myAnimal.Caractéristiques)
                {
                    MessageBox.Show("Animal inscrit");
                    this.animal = animal;
                    this.Hide();
                    FicheAnimalInterface animalInsert = new FicheAnimalInterface(myAnimal);
                    animalInsert.Show();
                    if (animalList != null)
                    {
                        animalList.InitializeAnimauxInterface("");
                    }
                }
                resetAllInput();
            }
        }
예제 #13
0
 private void modifierToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     int     id       = int.Parse(this.allAnimalsClient.SelectedItems[0].Text);
     Animaux myAnimal = _db.Animaux.Find(id);
     InscriptionAnimalInterface toShow = new  InscriptionAnimalInterface(myAnimal, null, client);
 }