Ejemplo n.º 1
0
        public void LoadOrderlines()
        {
            if (SelectedOrder != null && SelectedOrder.OrderId > 0)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(delegate
                {
                    try
                    {
                        ShowLoading(StringResources.captionInformation, StringResources.msgLoading);

                        var _oOrderlineList = Factory.Resolve <IBaseDataDS>().GetOrderlinesForOrder(SelectedOrder);

                        HideLoading();

                        //display to UI
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            OrderlineList     = _oOrderlineList;
                            SelectedOrderline = OrderlineList.FirstOrDefault();
                        }));
                    }
                    catch (Exception ex)
                    {
                        HideLoading();
                        ShowMessageBox(StringResources.captionError, ex.ToString(), MessageBoxButton.OK);
                    }
                });
            }
        }
Ejemplo n.º 2
0
        public void DeleteOrderlineFromList(OrderlineEntity newEntity)
        {
            OrderlineEntity oldEntity = OrderlineList.FirstOrDefault <OrderlineEntity>(p => p.OrderlineId == newEntity.OrderlineId);

            if (oldEntity != null)
            {
                OrderlineList.Remove(oldEntity);
            }

            OrderlineList = new List <OrderlineEntity>(_orderlineList);
        }
Ejemplo n.º 3
0
        public void AddOrUpdateOrderlineToList(OrderlineEntity newEntity)
        {
            if (OrderlineList == null)
            {
                OrderlineList = new List <OrderlineEntity>();
            }

            OrderlineEntity oldEntity = OrderlineList.FirstOrDefault <OrderlineEntity>(p => p.OrderlineId == newEntity.OrderlineId);

            if (oldEntity == null)
            {
                OrderlineList.Insert(0, newEntity);
            }
            else
            {
                int index = OrderlineList.IndexOf(oldEntity);
                OrderlineList.Remove(oldEntity);
                OrderlineList.Insert(index, newEntity);
            }

            OrderlineList = new List <OrderlineEntity>(_orderlineList);

            SelectedOrderline = newEntity;
        }