Пример #1
0
    //returns the selected event Id from the event database when given the event name
    protected int getEventId(String eventName)
    {
        using (DatabaseEntities1 myEntity = new DatabaseEntities1())
        {
            var id = (from eventTable in myEntity.Events

                      where eventTable.EventType == eventName
                      select eventTable.Id).SingleOrDefault();
            return id;
        }
    }
Пример #2
0
    //show the tickets the user is registered for
    protected void showRegisteredEvents()
    {
        using (DatabaseEntities1 myEntity = new DatabaseEntities1())
        {
            var showReg = from R in myEntity.RegisteredEvents

                          orderby R.Event.EventType descending
                          where Profile.FirstName == R.FirstName && Profile.LastName == R.LastName //idealy this would be the unique user id
                          select new
                          {
                              R.Event.EventType,
                              R.Event.Date
                          };
            RegisteredGridView.DataSource = showReg;
            RegisteredGridView.DataBind();
        }
    }
Пример #3
0
    //filter button
    protected void Button1_Click(object sender, EventArgs e)
    {
        //gets the dropdown values
        getDateDropdowRange();
        getPriceDropdownRange();

        // make sure user has selected all 3 dropdowns
        if (CategoryDropdown.SelectedIndex > 0 && PriceDropdown.SelectedIndex > 0 && DateDropdown.SelectedIndex > 0)
        {
            // database search query
            using (DatabaseEntities1 myEntity = new DatabaseEntities1())
            {
                //get details
                var filter = from eventTable in myEntity.Events
                             orderby eventTable.Category.CategoryType descending

                             //filter
                             where eventTable.Category.CategoryType == CategoryDropdown.SelectedValue
                                   && eventTable.Price >= lowerPriceRange && eventTable.Price <= upperPriceRange
                                   && eventTable.Date >= today && eventTable.Date <= upperDateRange && eventTable.NumOfTickets !=0

                            //custom output
                             select new
                             {
                                 eventTable.EventType,
                                 eventTable.Category.CategoryType,
                                 eventTable.Venue.Name,
                                 eventTable.Price,
                                 eventTable.Date,
                                 eventTable.Time,
                                 eventTable.Description
                             };

                //add data to the gridview
                GridView1.DataSource = filter;
                GridView1.DataBind();
            }

        }
    }
Пример #4
0
    // searches the database using the onscreen calendar
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        using (DatabaseEntities1 myEntity = new DatabaseEntities1())
        {
            var showAll = from eventTable in myEntity.Events

                          orderby eventTable.Category.CategoryType descending
                          where eventTable.Date == Calendar1.SelectedDate && eventTable.NumOfTickets != 0
                          select new
                          {
                              eventTable.EventType,
                              eventTable.Category.CategoryType,
                              eventTable.Venue.Name,
                              eventTable.Price,
                              eventTable.Date,
                              eventTable.Time,
                              eventTable.Description
                          };

            GridView1.DataSource = showAll;
            GridView1.DataBind();
        }
    }
Пример #5
0
    //Populates the gridview with everyting in the database currently
    protected void showAllResults()
    {
        using (DatabaseEntities1 myEntity = new DatabaseEntities1())
        {
            var showAll = from eventTable in myEntity.Events

                          orderby eventTable.Category.CategoryType descending
                          where eventTable.NumOfTickets !=0 // wont show event if no tickets are left
                          select new
                          {
                              eventTable.Id,
                              eventTable.EventType,
                              eventTable.Category.CategoryType,
                              eventTable.Venue.Name,
                              eventTable.Price,
                              eventTable.Date,
                              eventTable.Time,
                              eventTable.Description
                          };
            GridView1.DataSource = showAll;
            GridView1.DataBind();
        }
    }
Пример #6
0
    protected void showWon()
    {
        using (DatabaseEntities1 myEntity = new DatabaseEntities1())
        {
            var showReg = from R in myEntity.RegisteredEvents

                          orderby R.Event.EventType descending
                          where R.Won == true && R.FirstName == Profile.FirstName && R.LastName == Profile.LastName // this should be unique user id
                          select new
                          {
                              R.Event.EventType,
                              R.Event.Date
                          };
            WonGridView.DataSource = showReg;
            WonGridView.DataBind();
        }
    }