コード例 #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
        }
コード例 #2
0
        public ActionResult Streams()
        {
            #region
            CommonMethods objCmnMethods = new CommonMethods();
            string strIpAddress = System.Web.HttpContext.Current.Request.UserHostAddress;
            if (strIpAddress == "127.0.0.1")
                strIpAddress = "61.246.241.162";

            string ipLocation = objCmnMethods.IP2AddressAPI(strIpAddress);
            string zipCodeSearch = string.Empty;
            string[] currentAddress;
            if (!string.IsNullOrEmpty(ipLocation))
            {
                //IPaddressAPI
                currentAddress = ipLocation.Split(',');

                if (string.IsNullOrEmpty(currentAddress[7].Replace("\"", "").ToString()))
                    zipCodeSearch = "85027";
                else
                    zipCodeSearch = currentAddress[7].Replace("\"", "").ToString();
            }
            else
            {
                //MaxMind
                ipLocation = objCmnMethods.IP2AddressMaxMind();
                currentAddress = ipLocation.Split('\'');

                if (string.IsNullOrEmpty(currentAddress[15].ToString()))
                    zipCodeSearch = "85027";
                else
                    zipCodeSearch = currentAddress[15].ToString();
            }

            StreamAction objStream = new StreamAction();
            IList<ssStream> streamData = new List<ssStream>();
            streamData = objStream.GetAllStreamByZip(zipCodeSearch);

            if (streamData.Count() < 1)
                streamData = objStream.GetLatestStreams();

            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"] = "Nearby Feeds";
            return View();
            #endregion
        }