/// <summary> /// Method to get list of seeds by zip /// </summary> /// <param name="radius"></param> /// <param name="zip"></param> /// <returns></returns> public IList<Seed> GetAllSeedsByZip(string radius, string zip) { #region Business Logic IList<Seed> seedData = new List<Seed>(); try { CommonMethods commMethods = new CommonMethods(); DataTable allZipCodes = commMethods.GetZipListByRadiusNew(radius, zip); //string abc = commMethods.GetZipByRadius(radius, 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(); //seedData = repoObj.List<Location>(x => x.zipcode.Equals(zip) && (x.status.Equals(SystemStatements.STATUS_NEW) || x.status.Equals(SystemStatements.STATUS_GROWING))).ToList(); // IList<Location> locationList = repoObj.List<Location>(x => x.zipcode.Equals(zip)).ToList(); foreach (Location l in FilterZip) { if (l.Seeds != null && l.Seeds.Count > 0) { seedData.Add(l.Seeds.FirstOrDefault()); } //foreach (Seed s in l.Seeds) //{ //if (s.status.Equals(SystemStatements.STATUS_NEW) || s.status.Equals(SystemStatements.STATUS_GROWING)) //{ // }ss //} } } catch (Exception ex) { WriteError(ex); } return seedData; #endregion }