protected void Page_Load(object sender, EventArgs e) { var list = eventBal.Admin_GetAllEvents(); EventListView.DataSource = list; EventListView.DataBind(); }
protected void Delete_Command(object sender, CommandEventArgs e) { int Id = int.Parse((string)e.CommandArgument); var result = eventBal.RemoveEvent(Id); if (result.IsSuccess == true) { Page.ClientScript.RegisterStartupScript(GetType(), "Scripts", "<script>alert('" + result.Message + "');</script>"); var list = eventBal.Admin_GetAllEvents(); EventListView.DataSource = list; EventListView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Global.CurrentPerson == null || Global.CurrentPerson.accountType != Account.Guest) { //Global.CurrentPerson = null; //Response.Redirect("Login.aspx"); // Login - for expo purposes, we are just grabbing a random guest from the DB LoginRandomGuest(); } DataTable upcomingEventsTable = new DataTable(); List <Models.Event> upcomingEvents = new List <Models.Event>(); using (OracleConnection objConn = new OracleConnection(Global.ConnectionString)) { // Set up the upcomingEvents command var upcomingEventsCommand = new OracleCommand("TICKETS_QUERIES.getUpcomingEvents", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; upcomingEventsCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); try { // Execute the queries and auto map the results to models objConn.Open(); var upcomingEventsAdapter = new OracleDataAdapter(upcomingEventsCommand); upcomingEventsAdapter.Fill(upcomingEventsTable); upcomingEvents = Mapper.DynamicMap <IDataReader, List <Models.Event> >(upcomingEventsTable.CreateDataReader()); } catch (Exception) { Response.Redirect("../Default.aspx"); } objConn.Close(); } // Fill list dropdowns with data from the database if (upcomingEvents.Count > 0) { EventListView.DataSource = upcomingEvents; } EventListView.DataBind(); }