public IList<ZoneBinRelation> GetAssignedBinsList(Product product, Location location) { IList<ZoneBinRelation> result = new List<ZoneBinRelation>(); if (product == null || location == null) return result; //if ( product.ProductZones == null || product.ProductZones.Count == 0) // return result; IList<ZoneEntityRelation> tmpZoneEntity = Factory.DaoZoneEntityRelation().Select( new ZoneEntityRelation { Entity = new ClassEntity { ClassEntityID = EntityID.Product }, EntityRowID = product.ProductID } ); if (tmpZoneEntity == null || tmpZoneEntity.Count == 0) return result; IList<ZoneBinRelation> tmpZoneBin; foreach (ZoneEntityRelation ze in tmpZoneEntity) { /* if (ze.Zone.Bins == null || ze.Zone.Bins.Count == 0) continue; foreach (ZoneBinRelation b in ze.Zone.Bins.Where(f => f.Zone.Location.LocationID == location.LocationID)) result.Add(b); */ tmpZoneBin = Factory.DaoZoneBinRelation().Select(new ZoneBinRelation { Zone = ze.Zone }); if (tmpZoneBin == null || tmpZoneBin.Count == 0) continue; foreach (ZoneBinRelation b in tmpZoneBin.Where(f=> f.Zone.Location.LocationID == location.LocationID)) result.Add(b); } return result.OrderByDescending(f=>f.BinType).ToList(); }