Пример #1
0
        public ActionResult Streams(string streamSearch)
        {
            #region
            StreamAction objStream = new StreamAction();
            IList<ssStream> streamData = new List<ssStream>();
            IList<ssStream> tmpStreamList = null;

            string searchOthers = "";
            string searchZip = "";
            string[] criteriaArr = streamSearch.Trim().Split(',');

            foreach (string str in criteriaArr)
            {
                if (this.checkCriteria(str))
                {
                    searchZip = str;
                }
                else
                {
                    searchOthers = searchOthers + " " + str;
                }
            }
            searchOthers = searchOthers.Trim();

            if (searchZip.Length > 0)
            {
                tmpStreamList = objStream.GetAllStreamByZip(searchZip);
                foreach (ssStream ssData in tmpStreamList)
                {
                    streamData.Add(ssData);
                }
            }

            if (searchOthers.Length > 0)
            {
                tmpStreamList = objStream.GetAllStreamsByTitle(searchOthers);
                foreach (ssStream ssData in tmpStreamList)
                {
                    streamData.Add(ssData);
                }

                tmpStreamList = objStream.GetAllStreamsByDescription(searchOthers);
                foreach (ssStream ssData in tmpStreamList)
                {
                    streamData.Add(ssData);
                }

                tmpStreamList = objStream.GetStreamByCrossStreet(searchOthers);
                foreach (ssStream ssData in tmpStreamList)
                {
                    streamData.Add(ssData);
                }

                tmpStreamList = objStream.GetStreamByCity(searchOthers);
                foreach (ssStream ssData in tmpStreamList)
                {
                    streamData.Add(ssData);
                }
            }
            streamData = streamData.Distinct().ToList();
            ViewData["SearchStream"] = streamData;

            IList<ssStream> latestStreams = new List<ssStream>();
            latestStreams = objStream.GetLatestStreams();
            ViewData["LatestStreams"] = latestStreams;

            IList<ssStream> mostPopularStreams = new List<ssStream>();
            mostPopularStreams = objStream.GetMostPopularStreams();
            ViewData["MostPopular"] = mostPopularStreams;

            ViewData["SearchTerm"] = streamSearch;
            return View();
            #endregion
        }