Exemplo n.º 1
0
        public PurchaseTransactionControl(PurchaseTransactionViewModel viewModel,
                                          IProductCategoryService productCategoryService)
        {
            _viewModel = viewModel;

            InitializeComponent();

            // Create the user control that will hold all of our TransactionLineItem controls.
            // Quick and dirty sizing due to time constraints.
            _transactionLineItemsListControl        = new TransactionLineItemsListControl();
            _transactionLineItemsListControl.Anchor =
                AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            _transactionLineItemsListControl.Left   = 10;
            _transactionLineItemsListControl.Top    = 20;
            _transactionLineItemsListControl.Width  = grpTransaction.Width - 21;
            _transactionLineItemsListControl.Height = grpTransaction.Height - 31;
            _transactionLineItemsListControl.TransactionLineItemListChanged += TransactionLineItemsListControl_TransactionLineItemListChanged;

            grpTransaction.Controls.Add(_transactionLineItemsListControl);

            // Add all of our categories to the dropdown
            productCategoryService.All.ForEach(c => cboSearchProductCategories.Items.Add(c));
            // Create a blank ProductCategory so we have an item we can select to DE-select filtering by Categories.
            cboSearchProductCategories.Items.Insert(0, new ProductCategory()
            {
                Name = ""
            });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets up the form and Shows the subtotal, tax, and grand total due for the transaction.
        /// </summary>
        /// <param name="viewModel"></param>
        public PayTransactionView(PurchaseTransactionViewModel viewModel)
        {
            _viewModel = viewModel;

            InitializeComponent();

            var subtotal = _viewModel.TransactionSubTotal;

            lblSubtotal.Text = $"{subtotal:C2}";
            var tax = _viewModel.TransactionTax;

            lblTax.Text = $"{tax:C2}";
            var grandTotal = _viewModel.TransactionGrandTotal;

            lblGrandTotal.Text = $"{grandTotal:C2}";
        }