public AnalyzePrice GetPrice(Plant plant, AnalyzeWork work) { var workPrices = Prices.Where(p => p.Work == work).ToList(); while (plant != null) { var result = workPrices.FirstOrDefault(p => p.Plant == plant); if (result != null) { return result; } else { plant = plant.Parent; } } return null; }
public AnalyzeWorkItem(AnalyzeWork work, bool isPresent) : this() { Work = work; IsPresent = isPresent; }
private void afterDeserialization(StreamingContext context) { Work = Cache.Instance.AnalyzeWorks[workId]; }
private void afterDeserialization(StreamingContext context) { PriceList = Cache.Instance.PriceLists[priceListId]; if (Cache.Instance is ClientCache) { PriceList.Prices.Add(this); } Plant = plantId.HasValue ? Cache.Instance.Plants[plantId.Value] : null; Work = Cache.Instance.AnalyzeWorks[workId]; }