Exemplo n.º 1
0
        private void lnkEdit_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 SOLineItemModal();
            _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 && n.OrderLineItemType != OrderLineItemType.Discount);
            var lineItem = lineItemList.First(p => p.ProductId == ParentProductid);
            SOLineItemViewModel vmLineItem = _newLineItemModal.DataContext as SOLineItemViewModel;
            vmLineItem.ModalCrumbs = _messageResolver.GetText("sl.createOrder.lineitemmodal.edit.title");/* "Edit Product Quantity";*/
            vmLineItem.RunClearAndSetup();
            vmLineItem.SelectedOutletId = _vm.SelectedOutlet.Id;

            vmLineItem.LoadForEdit(lineItem.ProductId,
                lineItem.UnitPrice,
                lineItem.LineItemUnitVatValue,
                lineItem.TotalPrice,
                lineItem.TotalLineItemVatAmount,
                lineItem.SequenceNo,
                lineItemList.Where(n => n.OrderLineItemType != OrderLineItemType.Discount).Min(m => m.Qty)
                );
            vmLineItem.LineItemType = lit;
            _newLineItemModal.ShowDialog();
        }
Exemplo n.º 2
0
        void AddNewLineItem()
        {
            _newLineItemModal = new SOLineItemModal();
            _newLineItemModal.Closed += new EventHandler(modal_Closed);
            _newLineItemModal.cmbProducts.IsEnabled = true;
            _newLineItemModal.btnAddProduct.IsEnabled = true;
            SOLineItemViewModel vmLineItem = _newLineItemModal.DataContext as SOLineItemViewModel;
            vmLineItem.Salesman = _vm.SelectedSalesman;
            vmLineItem.SelectedOutletId = _vm.SelectedOutlet.Id;
            vmLineItem.ModalCrumbs = _messageResolver.GetText("sl.order.addlineitem.modal.title")/*"Add Product to Order on Behalf of"*/
                + (vmLineItem.Salesman.Id == Guid.Empty ? "Salesman" : vmLineItem.Salesman.Username);
            vmLineItem.RunClearAndSetup();
            vmLineItem.IsNew = true;
            vmLineItem.IsAdd = true;
            vmLineItem.IsEnabled = true;

            _newLineItemModal.ShowDialog();
        }