protected void Reserver_Click(object sender, EventArgs e) { Client client = (Client)Session["Client"]; int idhebergement = Convert.ToInt32(((Button)sender).CommandArgument); DaoReservation daoReservation = new DaoReservation(); List <Hebergement> mesReservations = daoReservation.GetReservation(client.IdClient, 1); if (mesReservations != null) { bool existe = false; foreach (Hebergement item in mesReservations) { if (item.IdHebergement == idhebergement) { existe = true; /*have*/ break; //have kitkat } } if (!existe) { daoReservation.createReservation(client.IdClient, idhebergement, 2); } } else { daoReservation.createReservation(client.IdClient, idhebergement, 2); } Response.Redirect("/EspaceClient/Reservation.aspx"); }
protected void btnDelete_Click(object sender, EventArgs e) { Client client = (Client)Session["Client"]; int idhebergement = Convert.ToInt32(((Button)sender).CommandArgument); DaoReservation daoReservation = new DaoReservation(); List <Hebergement> mesReservations = daoReservation.GetReservation(client.IdClient, 1); foreach (Hebergement item in mesReservations) { if (item.IdHebergement == idhebergement) { daoReservation.DelReservation(client.IdClient, idhebergement); Response.Redirect("../EspaceClient/Reservation.aspx"); /*have*/ break; //have kitkat } } }
private List <Hebergement> loadReservation(int idclient) { DaoReservation daoReservation = new DaoReservation(); return(daoReservation.GetReservation(idclient, 1)); }