Example #1
0
        private async void selectordersByStatus(string Statustype, string OrderSearchDate)
        {
            DateTime _orderSearchDate;

            _orderSearchDate = Convert.ToDateTime(OrderSearchDate);

            await Task.Run(() => {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    Orders.Clear();
                })).Wait();

                IEnumerable <POS_OrderHeader> orders = null;

                if (Statustype == "Select")
                {
                    orders = GConfig.POS_Setup.OrderHeaders.OrderByDescending(n => n.dModifiedDate).Select(n => n);
                }
                else
                {
                    orders = GConfig.POS_Setup.OrderHeaders.Where(n => n.vOrderStatus == Statustype && n.dCreatedDate.Year == _orderSearchDate.Year &&
                                                                  n.dCreatedDate.Month == _orderSearchDate.Month && n.dCreatedDate.Day == _orderSearchDate.Day).OrderByDescending(n => n.dModifiedDate).Select(n => n);
                }

                foreach (var order in orders)
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() => {
                        Orders.Add(new OrderVM(order));
                    })).Wait();
                }

                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    if (SelectedOrder != null)
                    {
                        foreach (var n in _orders)
                        {
                            if (n._orderHeader == SelectedOrder._orderHeader)
                            {
                                SelectOrderCommand.Execute(n);
                                break;
                            }
                        }
                    }
                }));
            });
        }
Example #2
0
        private async void selectorders(string type)
        {
            await Task.Run(() => {
                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    Orders.Clear();
                })).Wait();

                IEnumerable <POS_OrderHeader> orders = null;

                if (type == OrderTypes.None)
                {
                    orders = GConfig.POS_Setup.OrderHeaders.OrderByDescending(n => n.dModifiedDate).Select(n => n);
                }
                else
                {
                    orders = GConfig.POS_Setup.OrderHeaders.Where(n => n.vOrderType == type).OrderByDescending(n => n.dModifiedDate).Select(n => n);
                }

                foreach (var order in orders)
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() => {
                        Orders.Add(new OrderVM(order));
                    })).Wait();
                }

                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    if (SelectedOrder != null)
                    {
                        foreach (var n in _orders)
                        {
                            if (n._orderHeader == SelectedOrder._orderHeader)
                            {
                                SelectOrderCommand.Execute(n);
                                break;
                            }
                        }
                    }
                }));
            });
        }