protected void Page_Load(object sender, EventArgs e) { var list = eventBal.Admin_GetAllEvents(); EventListView.DataSource = list; EventListView.DataBind(); }
public EventListView GenerateEventListView(int venueId = 0, int cityId = 0) { var eventListView = new EventListView { SelectedVenue = venueId, SelectedCity = cityId }; var concertsList = new List <Concert>(ConcertDbContext.GetConcerts().Where(a => DateTime.Compare(a.ConcertDate, DateTime.Today) >= 0)); // If Concerts have expired, roll dates forward if (concertsList.Count < 2) { if (!new ResetCode().RefreshConcerts(false)) { // If connection fails, prompt user on troubleshoot steps UpdateStatus(string.Format("ERROR connecting to {0} database server. Make sure: 1. The database server name, username and password in the web.config are correct, 2. Auditing is enabled on the Database Server, 3. Firewall rules allow access - including Azure Services, and 4. the Database server name resolves using nslookup.", WingtipTicketApp.Config.PrimaryDatabaseServer)); } } foreach (var concert in concertsList) { if (eventListView.VenuesList.All(a => a.VenueId != concert.VenueId)) { eventListView.VenuesList.Add(VenuesDbContext.GetVenueByVenueId(concert.VenueId)); } eventListView.ConcertsList.Add(concert); concert.Venue = eventListView.VenuesList.FirstOrDefault(a => a.VenueId == concert.VenueId); } return(eventListView); }
private List <EventListView> GenerateEventList(String type) { WeekStartEnd weekStartEnd = new WeekStartEnd(); weekStartEnd.WeekStart = DateTime.Now.AddDays(-(int)DateTime.Now.DayOfWeek).Date; weekStartEnd.WeekEnd = weekStartEnd.WeekStart.Date.AddDays(7).AddSeconds(-1); this.AddEventSeachHeaderAndClose(); List <UserEvent> contactList = new List <UserEvent>(); if (type.Equals("load")) { contactList = eventHelper.SearchUserEvent(weekStartEnd.WeekStart, weekStartEnd.WeekEnd); } else if (type.Equals("search")) { contactList = eventHelper.SearchUserEvent(dtp_searchstart.Value, dtp_seachend.Value); } List <EventListView> contactLists = new List <EventListView>(); foreach (UserEvent contactDetails in contactList) { EventListView contact = new EventListView(); contact.userEvent = contactDetails; contact.Name = $"ctx_"; contact.Click += new EventHandler(this.EventControlClick); //contact.deleteEvent = new EventHandler(this.removePreview); //contact.editEvent = new FormClosingEventHandler(this.generateContactPreview); contactLists.Add(contact); } return(contactLists); }
public async Task <ActionResult> Index() { ActionResult result; var eventListView = new EventListView(); var search = Request["search"]; if (string.IsNullOrEmpty(search)) { result = View(_ticketsRepository.GenerateEventListView()); } else { var searchResult = await WingtipTicketApp.SearchIndexClient.Documents.SearchAsync <ConcertSearchHit>(search, new SearchParameters(), CancellationToken.None); if (searchResult.Results.Any(r => r.Document.FullTitle == search)) { // If search result matches a single event var intConcertId = Convert.ToInt32(searchResult.Results.First(r => r.Document.FullTitle == search).Document.ConcertId); var selectedConcert = _ticketsRepository.ConcertDbContext.GetConcertById(intConcertId); var venuesList = _ticketsRepository.VenuesDbContext.GetVenues(); var selectedConcertVenue = venuesList.Find(v => v.VenueId.Equals(selectedConcert.VenueId)); selectedConcert.Venue = selectedConcertVenue; eventListView.ConcertsList.Add(selectedConcert); eventListView.VenuesList = venuesList; result = View("ViewSearchResults", eventListView); } else { // If search results contains multiple events var suggestions = await WingtipTicketApp.SearchIndexClient.Documents.SuggestAsync(search, "sg", new SuggestParameters { UseFuzzyMatching = true }, CancellationToken.None); var concertsList = new List <Concert>(_ticketsRepository.ConcertDbContext.GetConcerts()); var venuesList = _ticketsRepository.VenuesDbContext.GetVenues(); foreach (var suggestion in suggestions) { var suggestedConcert = concertsList.Find(c => c.ConcertId.Equals(Convert.ToInt32(suggestion.Document["ConcertId"]))); var suggestedConcertVenue = venuesList.Find(v => v.VenueId.Equals(suggestedConcert.VenueId)); suggestedConcert.Venue = suggestedConcertVenue; eventListView.ConcertsList.Add(suggestedConcert); } result = View("ViewSearchResults", eventListView); } } return(result); }
public void EventControlClick(object sender, EventArgs e) { EventListView eventListView = (EventListView)sender; UserEvent contact = eventListView.Tag as UserEvent; EventPreview contactPreview = new EventPreview(); contactPreview.userEvent = contact; this.pnl_eventspreview.Controls.Clear(); this.pnl_eventspreview.Controls.Add(contactPreview); }
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(); } }
public EventForm() { InitializeComponent(); InitializeDateTime(); InitializeTimezone(); InitializeClassification(); eventListView = new EventListView(db); attendeesListView = new AttendeesListView(db); recurrencePanel = new Panel(); recurrencePanel.Visible = false; eventListTab.Controls.Add(eventListView); attendeeListTab.Controls.Add(attendeesListView); }
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(); }
public EventsPage() { InitializeComponent(); BindingContext = viewModel = new EventViewModel(); EventListView.BeginRefresh(); }
void Awake() { instance = this; }
public ActionResult ViewSearchResults(EventListView eventListView) { return(View(eventListView)); }