Exemplo n.º 1
0
        private void DisplaySalesTransaction()
        {
            using (var context = new ERPContext())
            {
                var salesTransactionFromDatabase =
                    context.SalesTransactions
                    .Include("SalesTransactionLines")
                    .Include("SalesTransactionLines.Item")
                    .Include("SalesTransactionLines.Warehouse")
                    .SingleOrDefault(
                        transaction => transaction.SalesTransactionID.Equals(_salesTransactionID));

                if (salesTransactionFromDatabase == null)
                {
                    MessageBox.Show("Sales transaction could not be found.", "Invalid ID", MessageBoxButton.OK);
                    return;
                }

                foreach (var line in salesTransactionFromDatabase.SalesTransactionLines)
                {
                    SalesTransactionLines.Add(new SalesTransactionLineVM {
                        Model = line
                    });
                }

                SalesTransactionDate       = salesTransactionFromDatabase.Date;
                SalesTransactionGrossTotal = salesTransactionFromDatabase.GrossTotal;
                SalesTransactionDiscount   = salesTransactionFromDatabase.Discount;
                SalesTransactionNetTotal   = salesTransactionFromDatabase.Total;
            }
        }
Exemplo n.º 2
0
 private void ClearSalesTransaction()
 {
     SalesTransactionID         = null;
     SalesTransactionDate       = DateTime.MinValue;
     SalesTransactionGrossTotal = 0;
     SalesTransactionDiscount   = 0;
     SalesTransactionNetTotal   = 0;
     SalesTransactionLines.Clear();
 }