Example #1
0
        private void SearchByUPC()
        {
            var dList = model.GetDistributorDataByUPC(Search);

            if (dList != null && dList.Count > 0)
            {
                DisplayData dd = new DisplayData();
                dd.UPC = Search;
                dList.ToList().ForEach(d =>
                {
                    d.Updated = false;
                    dd.DistData.Add(d);
                    d.DataUpdated += dd.DataUpdated;
                });

                var mpList = model.GetMarketDataByUPC(Search);
                if (mpList != null && mpList.Count > 0)
                {
                    mpList.ToList().ForEach(m =>
                    {
                        m.Updated = false;
                        dd.MarketplaceData.Add(m);
                        m.DataUpdated += dd.DataUpdated;
                    });
                }
                dd.Updated += () =>
                {
                    updated = true;
                    CommandManager.InvalidateRequerySuggested();
                };
                DistributorDataList.Add(dd);
            }
        }
Example #2
0
        private bool SearchByTitle()
        {
            string upc   = string.Empty;
            var    mList = model.GetMarketDataByTitle(Search, out upc);

            if (mList == null || mList.Count == 0)
            {
                return(false);
            }

            DisplayData dd = new DisplayData();

            dd.UPC = upc;
            mList.ToList().ForEach(m =>
            {
                m.Updated = false;
                dd.MarketplaceData.Add(m);
                m.DataUpdated += dd.DataUpdated;
            });

            var dList = model.GetDistributorDataByUPC(upc);

            if (dList != null && dList.Count > 0)
            {
                dList.ToList().ForEach(d =>
                {
                    d.Updated = false;
                    dd.DistData.Add(d);
                    d.DataUpdated += dd.DataUpdated;
                });
            }

            dd.Updated += () =>
            {
                updated = true;
                CommandManager.InvalidateRequerySuggested();
            };
            DistributorDataList.Add(dd);

            return(true);
        }