示例#1
0
        protected void UpdateQuantity(SaleItemViewModel item, int value)
        {
            var totalQuantity = TotalQuantity;

            item.Quantity += value;

            NotifyOfPropertyChange(() => CanCheckout);
            NotifyOfPropertyChange(() => TotalQuantity);
            NotifyOfPropertyChange(() => Total);
            NotifyOfPropertyChange(() => TotalText);

            if (totalQuantity == 0 && value > 0)
            {
                EventAggregator.Publish(new TransactionStarted {
                    Source = this
                });
            }

            if (TotalQuantity == 0)
            {
                EventAggregator.Publish(new TransactionStopped {
                    Source = this
                });
            }
        }
示例#2
0
        protected void UpdateQuantity(SaleItemViewModel item, int value)
        {
            var canComplete = CanComplete;

            item.Quantity += value;

            NotifyOfPropertyChange(() => CanComplete);
            NotifyOfPropertyChange(() => TotalQuantity);
            NotifyOfPropertyChange(() => Total);
            NotifyOfPropertyChange(() => TotalText);

            if (!canComplete && CanComplete)
            {
                EventAggregator.Publish(new TransactionStarted {
                    Source = this
                });
            }

            if (canComplete && !CanComplete)
            {
                EventAggregator.Publish(new TransactionStopped {
                    Source = this
                });
            }
        }
示例#3
0
 public void RemoveItem(SaleItemViewModel item)
 {
     UpdateQuantity(item, -1);
 }
示例#4
0
 public void AddItem(SaleItemViewModel item)
 {
     UpdateQuantity(item, 1);
 }
示例#5
0
        protected void UpdateQuantity(SaleItemViewModel item, int value)
        {
            var totalQuantity = TotalQuantity;

            item.Quantity += value;

            NotifyOfPropertyChange(() => CanCheckout);
            NotifyOfPropertyChange(() => TotalQuantity);
            NotifyOfPropertyChange(() => Total);
            NotifyOfPropertyChange(() => TotalText);

            if (totalQuantity == 0 && value > 0)
                EventAggregator.Publish(new TransactionStarted { Source = this });

            if (TotalQuantity == 0)
                EventAggregator.Publish(new TransactionStopped { Source = this });
        }
示例#6
0
 public void RemoveItem(SaleItemViewModel item)
 {
     UpdateQuantity(item, -1);
 }
示例#7
0
 public void AddItem(SaleItemViewModel item)
 {
     UpdateQuantity(item, 1);
 }
示例#8
0
        protected void UpdateQuantity(SaleItemViewModel item, int value)
        {
            var canComplete = CanComplete;

            item.Quantity += value;

            NotifyOfPropertyChange(() => CanComplete);
            NotifyOfPropertyChange(() => TotalQuantity);
            NotifyOfPropertyChange(() => Total);
            NotifyOfPropertyChange(() => TotalText);

            if (!canComplete && CanComplete)
                EventAggregator.Publish(new TransactionStarted { Source = this });

            if (canComplete && !CanComplete)
                EventAggregator.Publish(new TransactionStopped { Source = this });
        }