public ActionResult Create(evenement e) { ise.createEvenement(e); TempData.Clear(); return(RedirectToAction("Index", "Evenement")); }
// GET: Evenement/Edit/5 public ActionResult Edit(int id) { List <evenement> events = eventService.GetMany().ToList(); SelectList dropList = new SelectList(events, "id_Evenement", "name"); ViewBag.dropList = dropList; evenement item = new evenement(); item = eventService.GetById(id); EvenementModels t = new EvenementModels() { id_Evenement = item.id_Evenement, description = item.description, adresse = item.adresse, name = item.name, image_link = item.image_link, nbrPlaces = item.nbrPlaces, latitude = item.latitude, longitude = item.longitude, date = item.date, organizer_idUser = item.organizer_idUser, participants = item.participants, tournaments = item.tournaments, type = item.type, user = item.user }; return(View(t)); }
// GET: evenement/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } evenement evenement = db.Proj_evenementen.Find(id); if (evenement == null) { return(HttpNotFound()); } var test = db.proj_inschrijvingen.Where(x => x.evenement_id == evenement.id).Count(); if (test <= 0) { ViewBag.aantalIngeschreven = 0; } else { ViewBag.aantalIngeschreven = db.proj_inschrijvingen.Where(x => x.evenement_id == evenement.id) .Sum(x => x.aantal_personen); } return(View(evenement)); }
public Modifier_event(evenement eve, gestion_Clubs gesC, BDD_evenement bDDE) { InitializeComponent(); E = eve; gestC = gesC; BDDE = bDDE; }
/// <summary> /// Simule une liste de { cours , date } à partir d'une date donnée pour une nombre de jours données /// En suivant le modèle d'un Mouvement brownien /// </summary> /// <param name="dateDebut"></param> /// <param name="nombre_date"></param> /// <param name="valeur_debut"></param> /// <param name="volatilite"></param> /// <returns></returns> static public List <evenement> mouvementBrownien(DateTime dateDebut, int nombre_date, double valeur_debut, double volatilite) { List <evenement> retour = new List <evenement>(); //On ajoute un nombre prédéfinie de valeur à simuler DateTime dateFin = AddBusinessDays(dateDebut, nombre_date + 1); // on génère la liste des dates ouvrées entre début(exclus) et fin (non exclus) List <DateTime> listedate = listeDate(dateDebut, dateFin); int nb_date = listedate.Count; int cpt = 0; //On va simuler des lois normale, //On simule les valeurs obtenues du mouvement brownien double[] val = new double[nb_date + 1]; val[0] = valeur_debut; for (int i = 1; i < nb_date; i++) { val[i] = val[i - 1] + normale(0, volatilite); } //On créer nos événements while (cpt < nb_date) { evenement event1 = new evenement(val[cpt], listedate[cpt]); retour.Add(event1); cpt++; } return(retour); }
/// <summary> /// Cette fonction permet de récuperer une liste d'évenement dans la BDD en l'associant à des instances de la classe : evenement /// </summary> /// <returns>Liste d'événements</returns> public List <evenement> ReadEvent() { List <evenement> Liste = new List <evenement>(); club club; type_club typec; evenement evenement; using (connection) { connection.Open(); string requete = "SELECT * FROM evenement JOIN club ON evenement.E_fk_club = club.C_id JOIN type_club ON club.C_fk_type = type_club.T_id"; MySqlCommand cmd = new MySqlCommand(requete, connection); using (MySqlDataReader datareader = cmd.ExecuteReader()) { while (datareader.Read()) { typec = new type_club(Convert.ToInt32(datareader["T_id"]), (string)datareader["T_libelle"]); club = new club((string)datareader["C_id"], (string)datareader["C_url"], (string)datareader["C_adresse"], (string)datareader["C_codepostal"], (string)datareader["C_ville"], (string)datareader["C_email"], Convert.ToInt32(datareader["C_tel"]), typec); club.id_club = Convert.ToInt32(datareader["C_id"]); evenement = new evenement((string)datareader["E_nom"], (DateTime)datareader["E_datedeb"], (DateTime)datareader["E_datefin"], club); evenement.id_evenement = Convert.ToInt32(datareader["E_id"]); Liste.Add(evenement); } } } return(Liste); }
public void deleteEventById(int id) { evenement p = ut.EventRepository.GetById(id); ut.EventRepository.Delete(p); ut.commit(); }
public void update(int ID_event) { evenement p = ut.EventRepository.GetById(ID_event); ut.EventRepository.Update(p); ut.commit(); }
// GET: Event/Delete/5 public ActionResult Delete(evenement aa) { //a.deleteEv(p); //var hs = a.getAllEvents(); //return RedirectToAction("Index", hs); return(View()); }
/// <summary> /// Cette fonction permet de récuperer une liste d'évenement dans la BDD en l'associant à des instances de la classe : evenement /// </summary> /// <returns>Liste d'événements</returns> public List <evenement> ReadEvent() { List <evenement> Liste = new List <evenement>(); club club; type_club typec; evenement evenement; using (connection) { connection.Open(); string requete = "SELECT * from evenement join club on evenement.id_club=club.id_club join type_club on club.id_type_club=type_club.id_type_club"; MySqlCommand cmd = new MySqlCommand(requete, connection); using (MySqlDataReader datareader = cmd.ExecuteReader()) { while (datareader.Read()) { typec = new type_club(Convert.ToInt32(datareader["id_type_club"]), (string)datareader["libelle"]); club = new club((string)datareader["Titre_club"], (string)datareader["url_club"], (string)datareader["Adresse_club"], (string)datareader["Code_Postal_club"], (string)datareader["Ville_club"], (string)datareader["mail_club"], Convert.ToInt32(datareader["telephone_club"]), typec); club.id_club = Convert.ToInt32(datareader["id_club"]); evenement = new evenement((string)datareader["Titre_evenement"], (DateTime)datareader["debut_evenement"], (DateTime)datareader["fin_evenement"], club); evenement.id_evenement = Convert.ToInt32(datareader["id_evenement"]); Liste.Add(evenement); } } } return(Liste); }
// GET: Event/Edit/5 public ActionResult Edit(int id) { evenement h = a.getEventById(id); a.deleteEventById(id); return(View()); }
// GET: Evenement/Delete/5 public ActionResult Delete(int id) { evenement item = new evenement(); item = eventService.GetById(id); EvenementModels t = new EvenementModels() { id_Evenement = item.id_Evenement, description = item.description, adresse = item.adresse, name = item.name, image_link = item.image_link, nbrPlaces = item.nbrPlaces, latitude = item.latitude, longitude = item.longitude, date = item.date, organizer_idUser = item.organizer_idUser, participants = item.participants, tournaments = item.tournaments, type = item.type, user = item.user }; return(View(t)); }
public static List <evenement> calculTauxExchange(Data.DataExchangeRate exchange, DateTime debut, DateTime fin) { List <evenement> retour = new List <evenement>(); List <DateTime> listedate = listeDate(debut, fin); int nb_date = listedate.Count; int cpt = 0; double val1; double val2; double val; String nomCol1 = exchange.Columns[0]; String nomCol2 = exchange.Columns[1]; while (cpt < nb_date) { val1 = (double)exchange.Ds.Tables[0].Rows[cpt][nomCol1]; val2 = (double)exchange.Ds.Tables[0].Rows[cpt][nomCol2]; if (val1 != 0) { val = val2 / val1; } else { val = val2; } evenement event1 = new evenement(val, listedate[cpt]); retour.Add(event1); cpt++; } return(retour); }
public ActionResult DeleteConfirmed(int id) { evenement evenement = db.evenements.Find(id); db.evenements.Remove(evenement); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Evenement/Edit/5 public ActionResult Edit(int id) { evenement e = ge.FindById(id); var list = gu.FindByCondition(t => t is CampChef); ViewBag.users = new SelectList(list, "id", "FullName"); return(View(e)); }
public ActionResult Create(EvenementModels item, HttpPostedFileBase idFile) { try { if (ModelState.IsValid) { List <evenement> evenements = eventService.GetMany().ToList(); SelectList dropList = new SelectList(evenements, "id_Evenement", "name"); ViewBag.dropList = dropList; string uniqueName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(idFile.FileName); var uploadUrl = Server.MapPath("~/Content/img"); idFile.SaveAs(Path.Combine(uploadUrl, uniqueName)); item.image_link = "img\\" + uniqueName; evenement t = new evenement() { id_Evenement = item.id_Evenement, description = item.description, adresse = item.adresse, name = item.name, image_link = item.image_link, nbrPlaces = item.nbrPlaces, latitude = item.latitude, longitude = item.longitude, date = item.date, organizer_idUser = User.Identity.GetUserId(), type = item.type }; eventService.Add(t); return(RedirectToAction("Index")); } else { return(View()); } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } throw raise; } }
public ActionResult Edit(int id, evenement h) { if (ModelState.IsValid) { a.addEvent(h); } return(RedirectToAction("Index")); }
public ActionResult Delete(int id, evenement Eve) { evenement E = new evenement(); E = ES.GetById(id); ES.Delete(E); ES.Commit(); return(RedirectToAction("Index")); }
public void Supprimer_Evenement(evenement evenement) { using (connection) { connection.Open(); string requete = "DELETE FROM `evenement` WHERE `evenement`.`E_id` =@id"; MySqlCommand cmd = new MySqlCommand(requete, connection); cmd.Parameters.AddWithValue("@id", evenement.id_evenement); cmd.ExecuteNonQuery(); } }
public ActionResult Edit([Bind(Include = "id,naam,beschrijving,datum")] evenement evenement) { if (ModelState.IsValid) { db.Entry(evenement).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(evenement)); }
// GET: Event/Details/5 public ActionResult Details(int id) { evenement d = a.getEventById(id); if (d == null) { return(HttpNotFound()); } return(View(d)); }
public ActionResult Delete(int id, FormCollection collection) { evenement a = ise.GetById(id); ise.Delete(a); var hs = ise.GetAll(); TempData.Clear(); TempData["deleted"] = "1"; return(RedirectToAction("List", hs)); }
public ActionResult Edit(evenement e) { if (ModelState.IsValid) { ise.Update(e); TempData.Clear(); TempData["updated"] = e.Title; return(RedirectToAction("List")); } return(View(e)); }
public ActionResult Edit([Bind(Include = "id,naam,beschrijving,locatie,datum")] evenement evenement) { if (ModelState.IsValid) { db.Entry(evenement).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.locatie = new SelectList(db.Proj_gemeenten, "id", "naam", evenement.locatie); return(View(evenement)); }
public ActionResult Edit(evenement e) { if (ModelState.IsValid) { ise.updateEvenement(e); TempData.Clear(); TempData["updated"] = e.titre; return(RedirectToAction("Index")); } return(View(e)); }
public ActionResult Create([Bind(Include = "id,naam,beschrijving,datum")] evenement evenement) { if (ModelState.IsValid) { db.evenements.Add(evenement); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(evenement)); }
public ActionResult Subscribe(evenement e, int aantal) { db.proj_inschrijvingen.Add(new inschrijving { aantal_personen = aantal, evenement_id = e.id, persoon_id = User.Identity.GetUserId() }); db.SaveChangesAsync(); return(View()); }
public ActionResult Create([Bind(Include = "id,naam,beschrijving,locatie,datum,Max_inschrijvingen")] evenement evenement) { if (ModelState.IsValid) { db.Proj_evenementen.Add(evenement); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.locatie = new SelectList(db.Proj_gemeenten, "id", "naam", evenement.locatie); return(View(evenement)); }
public ActionResult Delete(int id, evenement evenement) { if (ModelState.IsValid) { evenement = Clr.GetById(id); Clr.Delete(evenement); Clr.Commit(); } return(RedirectToAction("Index")); }
public ActionResult Edit(int id, evenement evenement) { evenement c = Clr.GetById(id); c.name = evenement.name; c.dateEvent = evenement.dateEvent; c.place = evenement.place; c.numberGuests = evenement.numberGuests; Clr.Update(c); Clr.Commit(); return(RedirectToAction("Index")); }