public void prenotaReplica(object sender, EventArgs e) { Button regeneratedbutton = (Button)sender; string id = regeneratedbutton.ID; ReplicaDAO oReplicaDAO = new ReplicaDAO(); Response.Redirect("reservation.aspx?idReplica=" + id); }
protected void PresentaEventoSelezionato(string codice) { Replica oReplica = new Replica(); ReplicaDAO oReplicaDAO = new ReplicaDAO(); oReplica = oReplicaDAO.GetReplicaById(codice); TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); TableCell tc3 = new TableCell(); TableCell tc4 = new TableCell(); TableCell tc5 = new TableCell(); TableCell tc6 = new TableCell(); TableCell tc7 = new TableCell(); TableCell tc8 = new TableCell(); TableCell tc9 = new TableCell(); //Button bt1 = new Button(); //bt1.Text = "PRENOTA"; //bt1.CssClass = "btn btn-primary"; //bt1.ID = oReplica.codReplica; //bt1.Click += new EventHandler(prenotaReplica); tc1.Text = oReplica.codReplica; tc2.Text = oReplica.codEvento; tc3.Text = (oReplica.dataEOra).ToString(); tc4.Text = oReplica.codLocale; tc5.Text = oReplica.nomeEvento; tc6.Text = oReplica.nomeLocale; tc7.Text = oReplica.luogo; tc8.Text = (oReplica.posti).ToString(); //tc9.Controls.Add(bt1); TableRow tr = new TableRow(); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); tr.Cells.Add(tc4); tr.Cells.Add(tc5); tr.Cells.Add(tc6); tr.Cells.Add(tc7); tr.Cells.Add(tc8); //tr.Cells.Add(tc9); TBLEvento.Rows.Add(tr); }
public void effettuaPrenotazione(object sender, EventArgs e) { //Button regeneratedbutton = (Button)sender; //string id = regeneratedbutton.ID; //ReplicaDAO oReplicaDAO = new ReplicaDAO(); //Response.Redirect("reservation.aspx?idReplica=" + id); string codiceReplica = Request.QueryString["idReplica"]; PrenotazioneDAO oPrenotazioneDAO = new PrenotazioneDAO(); int postiGiaPrenotati = oPrenotazioneDAO.PostiPrenotatiPerReplica(codiceReplica); ReplicaDAO oReplicaDAO = new ReplicaDAO(); int postiDisponibiliPerReplica = oReplicaDAO.PostiDisponibiliPerReplica(codiceReplica); int postiLiberi = postiDisponibiliPerReplica - postiGiaPrenotati; int postiRichiestiPerPrenotazione = Convert.ToInt32(TXTpostiDaRiservare.Text); Prenotazione oPrenotazione = new Prenotazione(); oPrenotazione.codReplica = codiceReplica; oPrenotazione.codUtente = (string)Session["codUtente"]; oPrenotazione.quantita = postiRichiestiPerPrenotazione; oPrenotazioneDAO.InsertPrenotazione(oPrenotazione); }
protected void GeneraTabella(string c1, string c2, string c3) { List <Replica> listaRepliche = new List <Replica>(); ReplicaDAO oReplicaDAO = new ReplicaDAO(); if (c2 != "" && c3 != "" && c1 != "") { listaRepliche = oReplicaDAO.GetReplicheByIdEvento(c1, c2, c3); } else if (c3 == "") { listaRepliche = oReplicaDAO.GetReplicheByIdEvento(c1, c2); } else { listaRepliche = oReplicaDAO.GetReplicheByIdEvento(c1); } foreach (Replica r in listaRepliche) { TableCell tc1 = new TableCell(); TableCell tc2 = new TableCell(); TableCell tc3 = new TableCell(); TableCell tc4 = new TableCell(); TableCell tc5 = new TableCell(); TableCell tc6 = new TableCell(); TableCell tc7 = new TableCell(); TableCell tc8 = new TableCell(); TableCell tc9 = new TableCell(); Button bt1 = new Button(); bt1.Text = "PRENOTA"; bt1.CssClass = "btn btn-primary"; bt1.ID = r.codReplica; bt1.Click += new EventHandler(prenotaReplica); tc1.Text = r.codReplica; tc2.Text = r.codEvento; tc3.Text = (r.dataEOra).ToString(); tc4.Text = r.codLocale; tc5.Text = r.nomeEvento; tc6.Text = r.nomeLocale; tc7.Text = r.luogo; tc8.Text = (r.posti).ToString(); tc9.Controls.Add(bt1); TableRow tr = new TableRow(); tr.Cells.Add(tc1); tr.Cells.Add(tc2); tr.Cells.Add(tc3); tr.Cells.Add(tc4); tr.Cells.Add(tc5); tr.Cells.Add(tc6); tr.Cells.Add(tc7); tr.Cells.Add(tc8); tr.Cells.Add(tc9); TBLListaRepliche.Rows.Add(tr); } }