Example #1
0
        /// <summary>
        /// The CreateHomePage
        /// </summary>
        /// <returns>The <see cref="HomePageViewModel"/></returns>
        public static HomePageViewModel CreateHomePage()
        {
            HomePageViewModel HPModel = new HomePageViewModel();

            List <Club> clubs = SQLUtilities.GetAllClubs(String.Empty).ToList();

            HPModel.Clubs = new ObservableCollection <Club>(clubs.Take(4));

            List <News> news = SQLUtilities.GetAllNews(String.Empty).ToList();

            HPModel.News = new ObservableCollection <News>(news.Take(5));

            List <Event> events = SQLUtilities.GetAllEvents(String.Empty).ToList();

            HPModel.UpcomingEvents = new ObservableCollection <Event>(events.Take(4));

            return(HPModel);
        }
Example #2
0
        public static string GetDataFromServer()
        {
            int counter = 0;

            DataSet ds = new DataSet();

            List <Event> events = SQLUtilities.GetAllEvents();

            ds = SQLUtilities.ToDataSet(events);


            // After pulling the events its builds it out into a table
            string resp = string.Empty;

            for (int i = 1; i <= ds.Tables[0].Rows.Count; i++)
            {
                string strComment = string.Empty;
                if (ds.Tables != null)
                {
                    if (ds.Tables[0] != null)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows.Count >= i - 1)
                            {
                                if (ds.Tables[0].Rows[i - 1][0] != DBNull.Value)
                                {
                                    strComment = ds.Tables[0].Rows[i - 1][0].ToString();
                                }
                            }
                        }
                    }
                }
            }
            return(resp);
        }
Example #3
0
        /// <summary>
        /// The AllEvents
        /// </summary>
        /// <param name="sortOrder">The sortOrder<see cref="string"/></param>
        /// <param name="currentFilter">The currentFilter<see cref="string"/></param>
        /// <param name="searchString">The searchString<see cref="string"/></param>
        /// <param name="page">The page<see cref="int?"/></param>
        /// <returns>The <see cref="ActionResult"/></returns>
        public ActionResult AllEvents(string sortOrder, string currentFilter, string searchString, int?page)
        {
            ViewBag.NavTag = "Events";

            // Gets the categories for the filters
            MintContext db = new MintContext();

            ViewData["Categories"] = SQLUtilities.GetCategories();

            // Searching
            string search = null;

            if (Request.QueryString["search"] != null)
            {
                search = Request.QueryString["search"];
            }

            // Categories
            int?Category = null;

            if (Request.QueryString["category"] == "0")
            {
                Category = null;
            }
            else if (Request.QueryString["category"] != null)
            {
                Category = Convert.ToInt32(Request.QueryString["category"]);
            }

            //Free Stuff/Food
            bool?FreeFood  = null;
            bool?FreeStuff = null;

            if (Request.QueryString["freefood"] != null)
            {
                FreeFood = true;
            }
            if (Request.QueryString["freestuff"] != null)
            {
                FreeStuff = true;
            }

            // Date
            string Date = null;

            if (Request.QueryString["Date"] != null)
            {
                Date = Request.QueryString["Date"].ToString();
            }
            bool?Weekend = null;

            if (Request.QueryString["Weekend"] != null)
            {
                Weekend = true;
            }

            // Paging info
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            int pageSize   = 9;
            int pageNumber = (page ?? 1);

            // Gets all the events for the page
            var events = SQLUtilities.GetAllEvents(search, Category, FreeFood, FreeStuff, Date, Weekend);

            //Sets the viewbag info
            ViewBag.SearchTerm = search;
            ViewBag.Category   = Category;
            ViewBag.Date       = Date;
            ViewBag.FreeStuff  = FreeStuff == null ? "" : "checked";
            ViewBag.FreeFood   = FreeFood == null ? "" : "checked";
            ViewBag.Weekend    = Weekend == null ? "" : "checked";

            // Returns the view
            return(View(events.ToPagedList(pageNumber, pageSize)));
        }