Пример #1
0
        private void OrderData_DataUpdated(object sender, string property)
        {
            var data = sender as OrderData;

            if (data.SuppressEvent == false)
            {
                model.UpdateOrder(data, property);
            }
            else
            {
                data.SuppressEvent = false;
            }
            if (shibBySearch == false)
            {
                if (!string.IsNullOrEmpty(Search) && SelectedState == States[(int)OrderStates.Open])
                {
                    return;
                }
            }
            var removals = OrderDataList.Where(od => od.SelectedStatus != SelectedState.StateName).ToList();

            if (removals != null)
            {
                var list = OrdersToList(allOrdersArray);
                removals.ForEach(r => {
                    r.DataUpdated -= OrderData_DataUpdated;
                    list.Remove(r);
                });
                RemoveEvents();
                allOrdersArray = CreateAllOrders(list);
                AddEvents();
                SetOrderCount();
                OrderDataList = allOrdersArray[CurrentPage];
            }
        }
Пример #2
0
        private void OrderData_DataUpdated(object sender, string property)
        {
            var data = sender as OrderData;

            if (data.SuppressEvent == false)
            {
                model.UpdateOrder(data, property);
            }
            else
            {
                data.SuppressEvent = false;
            }
            if (shibBySearch == false)
            {
                if (!string.IsNullOrEmpty(Search) && SelectedState == States[(int)OrderStates.Open])
                {
                    return;
                }
            }
            var removals = OrderDataList.Where(od => od.SelectedStatus != SelectedState.StateName).ToList();

            if (removals != null)
            {
                removals.ForEach(r => {
                    r.DataUpdated -= OrderData_DataUpdated;
                    OrderDataList.Remove(r);
                });
            }
        }
Пример #3
0
        private void performLocalSearch(bool shipBy)
        {
            List <OrderData> list = null;

            if (shipBy == true)
            {
                PopulateOrders(0);
                SetOrderCount();

                list = OrdersToList(allOrdersArray);
                var shp = list.Where(od => od.OrdInfo.PromissedDay.Equals(DtShipBy.ToShortDateString())).ToList();
                if (SelectedDistributorShipBy != null)
                {
                    shp = shp.Where(od => od.OrdInfo.DistributorID == SelectedDistributorShipBy.DistributorID).ToList();
                }
                RemoveEvents();

                allOrdersArray = CreateAllOrders(shp);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();

                return;
            }

            list = OrdersToList(allOrdersArray);
            if (list == null)
            {
                return;
            }
            var upc = list.Where(od => od.OrdInfo.UPC.Equals(Search)).ToList();

            if (upc != null && upc.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(upc);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var sku = list.Where(od => od.OrdInfo.SKU.Equals(Search)).ToList();

            if (sku != null && sku.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(sku);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var ordId = list.Where(od => od.OrdInfo.OrderID.Equals(Search)).ToList();

            if (ordId != null && ordId.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(ordId);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var email = OrderDataList.Where(od => od.CustInfo.Email.Equals(Search)).ToList();

            if (email != null && email.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(email);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var name = OrderDataList.Where(od => od.CustInfo.Name.ToUpper().Contains(Search.ToUpper())).ToList();

            if (name != null && name.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(name);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var title = OrderDataList.Where(od => od.OrdInfo.Title.ToUpper().Contains(Search.ToUpper())).ToList();

            if (title != null && title.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(title);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var asin = OrderDataList.Where(od => od.OrdInfo.ASIN.Equals(Search)).ToList();

            if (asin != null && asin.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(asin);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }

            var zipCD = OrderDataList.Where(od => od.CustInfo.ZipCode.ToUpper().Contains(Search.ToUpper())).ToList();

            if (zipCD != null && zipCD.Count() > 0)
            {
                RemoveEvents();
                allOrdersArray = CreateAllOrders(zipCD);
                CurrentPage    = 0;
                OrderDataList  = allOrdersArray[CurrentPage];
                AddEvents();
                return;
            }
        }
Пример #4
0
        private void performLocalSearch(bool shipBy)
        {
            if (shipBy == true)
            {
                PopulateOrders(0);
                OrderCount = OrderDataList.Count().ToString();

                var shp = OrderDataList.Where(od => od.OrdInfo.PromissedDay.Equals(DtShipBy.ToShortDateString())).ToList();

                if (OrderDataList != null)
                {
                    OrderDataList.ToList().ForEach(o =>
                    {
                        o.DataUpdated -= OrderData_DataUpdated;
                    });
                    OrderDataList.Clear();
                }

                if (shp != null && shp.Count > 0)
                {
                    shp.ForEach(s =>
                    {
                        s.DataUpdated += OrderData_DataUpdated;
                        OrderDataList.Add(s);
                    });
                }
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var upc = OrderDataList.Where(od => od.OrdInfo.UPC.Equals(Search)).ToList();

            if (upc != null && upc.Count() > 0)
            {
                OrderDataList.Clear();
                upc.ForEach(u =>
                {
                    OrderDataList.Add(u);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var sku = OrderDataList.Where(od => od.OrdInfo.SKU.Equals(Search)).ToList();

            if (sku != null && sku.Count() > 0)
            {
                OrderDataList.Clear();
                sku.ForEach(s =>
                {
                    OrderDataList.Add(s);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var ordId = OrderDataList.Where(od => od.OrdInfo.OrderID.Equals(Search)).ToList();

            if (ordId != null && ordId.Count() > 0)
            {
                OrderDataList.Clear();
                ordId.ForEach(a =>
                {
                    OrderDataList.Add(a);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var email = OrderDataList.Where(od => od.CustInfo.Email.Equals(Search)).ToList();

            if (email != null && email.Count() > 0)
            {
                OrderDataList.Clear();
                email.ForEach(e =>
                {
                    OrderDataList.Add(e);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var name = OrderDataList.Where(od => od.CustInfo.Name.ToUpper().Contains(Search.ToUpper())).ToList();

            if (name != null && name.Count() > 0)
            {
                OrderDataList.Clear();
                name.ForEach(t =>
                {
                    OrderDataList.Add(t);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var title = OrderDataList.Where(od => od.OrdInfo.Title.ToUpper().Contains(Search.ToUpper())).ToList();

            if (title != null && title.Count() > 0)
            {
                OrderDataList.Clear();
                title.ForEach(t =>
                {
                    OrderDataList.Add(t);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var asin = OrderDataList.Where(od => od.OrdInfo.ASIN.Equals(Search)).ToList();

            if (asin != null && asin.Count() > 0)
            {
                OrderDataList.Clear();
                asin.ForEach(a =>
                {
                    OrderDataList.Add(a);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }

            var zipCD = OrderDataList.Where(od => od.CustInfo.ZipCode.ToUpper().Contains(Search.ToUpper())).ToList();

            if (zipCD != null && zipCD.Count() > 0)
            {
                OrderDataList.Clear();
                zipCD.ForEach(t =>
                {
                    OrderDataList.Add(t);
                });
                OrderCount = OrderDataList.Count().ToString();
                return;
            }
        }