public ActionResult Echantillon(int id_rdv) { ViewBag.Employe = (Employe)Session["Employe"]; if (ViewBag.Employe != null) { ProduitDAO produitManager = new ProduitDAO(); EchantillonDonneDAO echantillonDonneManager = new EchantillonDonneDAO(); RendezVousDAO rendezVousManager = new RendezVousDAO(); RendezVous rendezVous = rendezVousManager.Read(id_rdv, false); List <EchantillonDonne> mesEchantillonsDonnes = echantillonDonneManager.ReadAllFromRendezVous(id_rdv); List <Produit> mesFamilles = produitManager.ReadFamille(); ViewBag.Famille = mesFamilles; ViewBag.EchantillonDonne = mesEchantillonsDonnes; ViewBag.RendezVous = rendezVous; return(View()); } else { return(RedirectToAction("Index", "Home")); } }
public void DeleteDoubleID(string table, int id1, int id2) { if (table.Equals("echantillon_donne")) { EchantillonDonneDAO echantillonDonneManager = new EchantillonDonneDAO(); echantillonDonneManager.Delete(id1, id2); } }
public void ModifyED(int quantite) { EchantillonDonneDAO echantillonDonneManager = new EchantillonDonneDAO(); EchantillonDonne echantillonDonne = new EchantillonDonne(); echantillonDonne.Quantite = quantite; echantillonDonneManager.Update(echantillonDonne); }
public string ReadDoubleID(string table, int id1, int id2) { string response = ""; if (table.Equals("echantillon_donne")) { EchantillonDonneDAO echantillonDonneManager = new EchantillonDonneDAO(); EchantillonDonne echantillonDonne = echantillonDonneManager.Read(id1, id2); JavaScriptSerializer serializer = new JavaScriptSerializer(); if (echantillonDonne == null) { response = "null"; } else { response = serializer.Serialize(echantillonDonne); } } return(response); }
public string AddModifyED(string nom, int concentration, int id_rdv, int quantite, string addOrModify) { string response = ""; EchantillonDonneDAO echantillonDonneManager = new EchantillonDonneDAO(); RendezVousDAO rendezVousManager = new RendezVousDAO(); EchantillonDAO echantillonManager = new EchantillonDAO(); ProduitDAO produitDAO = new ProduitDAO(); int echantillonLu = echantillonManager.Read_IdEchantillon_FromNomConcentration(nom, concentration); EchantillonDonne echantillonDonne = new EchantillonDonne(); echantillonDonne.RendezVous = rendezVousManager.Read(id_rdv, true); echantillonDonne.Echantillon = echantillonManager.Read(echantillonLu, true); echantillonDonne.Quantite = quantite; echantillonDonne.Produit = produitDAO.ReadFromNom(nom, true); if (addOrModify.Equals("add")) // ADD { if (echantillonDonneManager.Read(echantillonDonne.Echantillon.Id_echantillon, echantillonDonne.RendezVous.Id_rdv) == null) { echantillonDonneManager.Create(echantillonDonne); response = "Add done !"; } else { response = "Allready exist !"; } } else // MODIFY { echantillonDonneManager.Update(echantillonDonne); response = "Modify done !"; } return(response); }