示例#1
0
        /// <summary>
        /// Method to get stream by zip
        /// </summary>
        /// <param name="zip"></param>
        /// <returns></returns>
        public IList<ssStream> GetAllStreamByZip(string zip)
        {
            #region Business Logic
            IList<ssStream> streamData = new List<ssStream>();
            try
            {
                CommonMethods commMethods = new CommonMethods();
                DataTable allZipCodes = commMethods.GetZipListByRadius("25", zip);
                IList<Location> locationList = repoObj.List<Location>().ToList();
                IList<Location> FilterZip =
                 (from u in locationList
                  join p in allZipCodes.AsEnumerable() on u.zipcode
                  equals p.Field<string>("Zip").Trim().ToUpper()
                  select u).Distinct().ToList();

                foreach (Location loc in FilterZip)
                {
                    if (loc.ssStreams != null && loc.ssStreams.Count > 0)
                    {
                        streamData.Add(loc.ssStreams.FirstOrDefault());
                    }
                }
            }
            catch (Exception ex)
            {
                WriteError(ex);
            }
            return streamData;
            #endregion
        }