Пример #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            _newLineItemModal = new POLineItemModal();
            _newLineItemModal.Closed += new EventHandler(modal_Closed);
            _newLineItemModal.cmbProducts.IsEnabled = true;
            _newLineItemModal.btnAddProduct.IsEnabled = true;
            POLineItemViewModel vmLineItem = _newLineItemModal.DataContext as POLineItemViewModel;
            vmLineItem.ModalTitle = "Add Product to Purchase Order: Ref No. " + _vm.OrderId;
            vmLineItem.ClearAndSetup.Execute(null);
            vmLineItem.IsNew = true;
            vmLineItem.LineItemType = LineItemType.Unit;
            vmLineItem.IsAdd = true;
            vmLineItem.IsEnabled = true;

            _newLineItemModal.ShowDialog();
        }
Пример #2
0
        private void hlEdit_Click(object sender, RoutedEventArgs e)
        {
            Hyperlink hl = sender as Hyperlink;
            string[] tag = hl.Tag.ToString().Split(',');
            Guid ParentProductid = Guid.Parse(hl.Tag.ToString());
            _newLineItemModal = new POLineItemModal();
            _newLineItemModal.Closed += new EventHandler(modal_Closed);
            _newLineItemModal.cmbProducts.IsEnabled = false;
            _newLineItemModal.btnAddProduct.IsEnabled = false;

            LineItemType lit = LineItemType.Unit;///int.Parse(tag[1].ToString());
            var lineItemList = _vm.LineItems.Where(n => n.ProductId == ParentProductid);
            var lineItem = lineItemList.First(p => p.ProductId == ParentProductid);
            POLineItemViewModel vmLineItem = _newLineItemModal.DataContext as POLineItemViewModel;
            vmLineItem.ModalTitle = "Edit Product of Purchase Order: Ref No. " + _vm.OrderId;
            vmLineItem.ClearAndSetup.Execute(null);

            vmLineItem.LoadForEdit(lineItem.ProductId, lineItem.UnitPrice,
                lineItem.LineItemVatValue, lineItem.TotalPrice,
                lineItem.VatAmount, lineItem.SequenceNo, lineItemList.Min(m => m.Qty));
            vmLineItem.LineItemType = lit;

            _newLineItemModal.ShowDialog();

        }