Exemplo n.º 1
0
        private void Delete()
        {
            if (Orders.Count == 1)
            {
                Reset();
            }

            if (Orders == null || Orders.Count == 0 || Order.OrderDetailId == -1)
            {
                System.Windows.MessageBox.Show("No record selected!");
            }
            else
            {
                MessageBoxResult result = System.Windows.MessageBox.Show("Would you like to delete selected record ?", "Warning Message", MessageBoxButton.YesNoCancel);
                if (result == MessageBoxResult.Yes)
                {
                    Product = null;
                    Orders.Remove(Order);
                    Reset();
                    if (Orders.Count == 0)
                    {
                        Add();
                    }
                    OrderSummary.RefreshBillTotals();
                }
            }
        }
Exemplo n.º 2
0
 private void Reset()
 {
     if (Orders.Count >= 1)
     {
         Order   = Orders[0];
         Product = Products.Where(p => p.BarCodeId == Order.BarCodeId).SingleOrDefault();
         //Product = Products.FirstOrDefault(p => p.BarCodeId == Order.BarCodeId);
     }
     OrderSummary.RefreshBillTotals();
     NotifyPropertyChanged("Order");
 }
Exemplo n.º 3
0
        private bool Submit()
        {
            try
            {
                bool retValue;
                retValue = IsValidOrder();
                if (!retValue)
                {
                    return(false);
                }
                if (Order != null)
                {
                    if (Order.OrderDetailId == -1)
                    {
                        var ord = Orders.Where(p => p.BarCodeId == Order.BarCodeId).FirstOrDefault();
                        if (ord != null)
                        {
                            ord.Quantity = ord.Quantity + Order.Quantity;
                            //ord.Total = ord.Quantity * ord.Price;
                        }
                        else
                        {
                            Order.OrderDetailId = Orders.Count + 1;

                            Orders.Add(Order);
                        }
                    }
                    if (OrderSummary.DiscountAuto)
                    {
                        Order.Total = Order.Quantity * Order.Price;
                    }
                    else
                    {
                        Order.Total = Order.Quantity * Order.MRP;
                    }
                }

                NotifyPropertyChanged("Order");
                NotifyPropertyChanged("Orders");
                Add();
                OrderSummary.RefreshBillTotals();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error Occured: " + ex.Message + " " + ex.Source + " " + ex.StackTrace);
            }
            return(true);
        }