public ListeAnimaux(Animaux a) { list.Clear(); InitializeComponent(); list.Add(button1); list.Add(button2); list.Add(button3); list.Add(button4); list.Add(button5); list.Add(button6); list.Add(button7); list.Add(button8); list.Add(button9); list.Add(button10); list.Add(button11); list.Add(button12); list.Add(button13); list.Add(button14); list.Add(button15); list.Add(button16); list.Add(button17); list.Add(button18); list.Add(button19); list.Add(button20); UpdateButton(a); }
public ActionResult EditConfirm(int id, int statutAnimal, string nom, string poids, string couleur, string tatouage, string puce, int race, int departement, string rue, string cp, string ville) { Animaux animal = db.Animaux.Find(id); animal.Nom = nom; animal.Poids = poids; animal.Couleur = couleur; animal.Tatouage = tatouage; animal.Puce = puce; animal.Race = db.Races.Find(race); animal.Departement = db.Departements.Find(departement); animal.Rue = rue; animal.CodePostal = cp; animal.Ville = ville; animal.StatutAnimal = db.StatutAnimal.Find(statutAnimal); if (Session["idConnecte"] != null) { animal.Compte = db.Comptes.Find(Session["idConnecte"]); } else { animal.Compte = db.Comptes.Find(7); } db.SaveChanges(); return(RedirectToAction("Index", "Animaux", new { id = animal.Id })); }
// Init public EcranConsultation(Agendas pAgenda) { InitializeComponent(); _monAgenda = pAgenda; _monAnimal = monMgtAnimal.AfficherUneSeul(pAgenda.CodeAnimal.Value); _monVeto = MgtVeterinaires.getOneVeto(pAgenda.CodeVeto.Value); TXT_CodeAnimal.Text = _monAnimal.CodeAnimal.Value.ToString(); TXT_Couleur.Text = _monAnimal.Couleur; TXT_Espece.Text = _monAnimal.Race.Espece; TXT_NomAnimal.Text = _monAnimal.NomAnimal; TXT_Race.Text = _monAnimal.Race.Race; TXT_Sexe.Text = _monAnimal.Sexe.ToString(); TXT_Tatouage.Text = _monAnimal.Tatouage; DATE_Acte.Text = pAgenda.DateRDV.Value.ToString(); COMBO_Veto.DataSource = MgtVeterinaires.getAllVeto(); for (int i = 0; i < COMBO_Veto.Items.Count; i++) { if (((Veterinaires)COMBO_Veto.Items[i]).CodeVeto.Value == pAgenda.CodeVeto.Value) { COMBO_Veto.SelectedIndex = i; break; } } COMBO_TypeActe.DataSource = MgtBaremes.AffichierTout().Select(x => x.TypeActe).Distinct().ToList <string>(); ChangementCOMBO(true, false); }
public static void init(TestContext context) { toRm = new Animaux { Nom = "ToRm", Poids = 18, DateNaissance = DateTime.Parse("05/01/1999"), Caractéristiques = "exemple de caracteristique", Clients_idClients = 1, Sexe = "M", }; toAdd = new Animaux { Nom = "Exemple", Poids = 18, DateNaissance = DateTime.Parse("05/01/1999"), Caractéristiques = "exemple de caracteristique", Clients_idClients = 1, Sexe = "M", }; toAdd2 = new Animaux { Nom = "Exemple2", Poids = 18, DateNaissance = DateTime.Parse("05/01/1999"), Caractéristiques = "exemple de caracteristique", Clients_idClients = 1, Sexe = "M", }; _db.Animaux.Add(toRm); _db.SaveChanges(); }
private void BTN_clients_supprimer2_Click(object sender, EventArgs e) { Animaux pcodeAnimal = (Animaux)dataGrid_clients.CurrentRow.DataBoundItem; _animal.Supprimer(pcodeAnimal.CodeAnimal.Value); dataGrid_clients.DataSource = _animal.AfficherTout().FindAll(x => x.CodeClient == pCodeClient.CodeClient.Value); }
private void dataGridViewAnimals_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Animaux animal = (Animaux)this.dataGridViewAnimals.CurrentRow.DataBoundItem; if (animal != null) { DialogAnimal DialogAnimal = new GUI.Dialog.DialogAnimal(animal); DialogAnimal.Disposed += UpdateContentEvent; DialogAnimal.buttonValidate.Click += UpdateContentEvent; DialogAnimal.ShowDialog(); } }
// Click private void BTN_Urgence_Click(object sender, EventArgs e) { Agendas monAgenda = new Agendas(); Clients monClient = (Clients)COMBO_Client.SelectedItem; Animaux monAnimal = (Animaux)COMBO_Animal.SelectedItem; Veterinaires monVeto = (Veterinaires)COMBO_Veto.SelectedItem; monAgenda.CodeAnimal = monAnimal.CodeAnimal; monAgenda.CodeVeto = monVeto.CodeVeto; monAgenda.DateRDV = DateTime.Now; MgtAgenda.Ajouter(monAgenda); ChargementDataGrid(); }
private void buttonDeleteAni_Click(object sender, EventArgs e) { if (this.dataGridViewAnimals.CurrentRow != null) { Animaux animal = (Animaux)this.dataGridViewAnimals.CurrentRow.DataBoundItem; try { AnimauxMgr.Delete(animal); LoadAnimaux(); } catch (Exception ex) { MessageBox.Show(ex.Message, GUI.Lang.FORM_DEFAULT_ERROR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ActionResult AddConfirm(string nom, string poids, string couleur, string tatouage, string puce, int race, int departement, string rue, string cp, string ville, HttpPostedFileBase upload) { Animaux animal = new Animaux(); animal.Nom = nom; animal.Poids = poids; animal.Couleur = couleur; animal.Tatouage = tatouage; animal.Puce = puce; animal.Race = db.Races.Find(race); animal.PhotoPrincipale = upload.FileName; animal.Departement = db.Departements.Find(departement); animal.Rue = rue; animal.CodePostal = cp; animal.Ville = ville; animal.StatutAnimal = db.StatutAnimal.Find(1); if (Session["idConnecte"] != null) { animal.Compte = db.Comptes.Find(Session["idConnecte"]); } else { animal.Compte = db.Comptes.Find(7); } db.Animaux.Add(animal); db.SaveChanges(); if (upload != null && upload.ContentLength > 0) { string RootFolder = @Server.MapPath("~/content/img"); string path = Path.Combine(RootFolder, upload.FileName); upload.SaveAs(path); } return(RedirectToAction("Index", "Animaux", new { id = animal.Id })); }
public void AnimauxAdd() { _db.Animaux.Add(toAdd); toAdd = new Animaux { Nom = "Exemple", Poids = 18, DateNaissance = DateTime.Parse("05/01/1999"), Caractéristiques = "exemple de caracteristique", Clients_idClients = 1, Sexe = "M", }; _db.Animaux.Add(toAdd); _db.Animaux.Add(toAdd2); _db.SaveChanges(); Assert.AreEqual(2, _db.Animaux.Where(s => s != null && s.Nom.Equals(toAdd.Nom)).Count()); Assert.AreEqual(1, _db.Animaux.Where(p => p.Nom == toAdd2.Nom).Count()); }
private void BTN_Valider_Click(object sender, EventArgs e) { Clients monClient = (Clients)COMBO_Client.SelectedItem; Animaux monAnimal = (Animaux)COMBO_Animal.SelectedItem; Veterinaires monVeto = (Veterinaires)COMBO_Veto.SelectedItem; Agendas monAgenda = new Agendas(); monAgenda.CodeAnimal = monAnimal.CodeAnimal; monAgenda.CodeVeto = monVeto.CodeVeto; try { monAgenda.DateRDV = new DateTime(DATE_RendezVous.Value.Year, DATE_RendezVous.Value.Month, DATE_RendezVous.Value.Day, (int)COMBO_Heure.SelectedValue, (int)COMBO_Minutes.SelectedValue, 0); } catch (Exception ex) { throw new Exception("Problème lors du passage de la date concernant l'ajout d'un RDV en urgence :\n" + ex.Message); } MgtAgenda.Ajouter(monAgenda); ChargementDataGrid(); }
public void UpdateButton(Animaux a) { int comptLic = 0; int comptLion = 0; int ComptM = 0; for (int i = 0; i < CarteJeu.comptAnimal; i++) { if (CarteJeu.RegistreA[i].Type == "Mouton") { list[i].BackgroundImage = TP2_DevGraphique.Properties.Resources.Dorset_Sheep_icon; ComptM++; list[i].Text = "Mouton " + ComptM.ToString(); list[i].Refresh(); } if (CarteJeu.RegistreA[i].Type == "Lion") { list[i].BackgroundImage = TP2_DevGraphique.Properties.Resources.Autumn_Lion_icon; comptLion++; list[i].Text = "Lion " + comptLion.ToString(); list[i].Refresh(); } if (CarteJeu.RegistreA[i].Type == "Licorne") { list[i].BackgroundImage = TP2_DevGraphique.Properties.Resources.UNICORN; comptLic++; list[i].Text = "Licorne " + comptLic.ToString(); list[i].Refresh(); } if (CarteJeu.RegistreA[i] == a) { list[i].BackColor = Color.Cyan; } } }
public void Modifier(Animaux unAnimal) { animauxDAL.Update(unAnimal); }
public void Ajouter(Animaux unAnimal) { animauxDAL.Add(unAnimal); }
/// <summary> /// Recharge tout le formulaire, si jamais c'était une modif, remet les valeurs de départ /// </summary> /// <param name="pCodeAnimal"></param> private void Chargment(Guid?pCodeAnimal = null) { combo_animaux_Clients.DataSource = MgtClient.GetInstance().AfficherTout(); combo_animaux_espece.DataSource = (from occurence in MgtRaces.AfficherTout() select occurence.Espece).ToList <string>(); combo_animaux_race.DataSource = (from occurence in MgtRaces.AfficherTout() where occurence.Espece == combo_animaux_espece.SelectedValue.ToString() select occurence.Race).ToList <string>(); combo_animaux_sexe.DataSource = new List <string> { "Mâle", "Femmelle", "Hérmaphrodite" }; TXT_animaux_code.Enabled = false; if (pCodeAnimal == null) { BTN_animaux_valider.Text = "Ajouter"; combo_animaux_Clients.Focus(); TXT_animaux_code.Text = null; TXT_animaux_couleur.Text = null; TXT_animaux_nom.Text = null; TXT_animaux_tatouage.Text = null; } else { BTN_animaux_valider.Text = "Modifier"; monAncienAnimal = monMgtAnimal.AfficherUneSeul(pCodeAnimal.Value); combo_animaux_espece.SelectedItem = monAncienAnimal.Race.Espece; combo_animaux_race.SelectedItem = monAncienAnimal.Race.Race; int i = -1; foreach (string occurence in combo_animaux_sexe.Items) { i++; if (occurence[0] == monAncienAnimal.Sexe.Value) { combo_animaux_sexe.SelectedIndex = i; break; } } i = -1; foreach (Clients occurence in combo_animaux_Clients.Items) { i++; if (occurence.CodeClient.Value == monAncienAnimal.CodeClient.Value) { combo_animaux_Clients.SelectedIndex = i; break; } } TXT_animaux_code.Text = monAncienAnimal.CodeAnimal.ToString(); TXT_animaux_couleur.Text = monAncienAnimal.Couleur; TXT_animaux_nom.Text = monAncienAnimal.NomAnimal; TXT_animaux_tatouage.Text = monAncienAnimal.Tatouage; monNouvelAnimal = monAncienAnimal; } }