private void cmdAddProduct_Click(object sender, RoutedEventArgs e) { try { if (cmbSalesmen.SelectedItem != null) { if (cmbSalesmen.SelectedIndex != 0) { _modal = new ITNLineItemModal(); _modal.Closed += new EventHandler(modal_Closed); _modal.Title = "Add Product to Issue"; //_modal.cmbProduct.IsEnabled = true; ITNLineItemViewModel vmItem = _modal.DataContext as ITNLineItemViewModel; vmItem.ClearAndSetup.Execute(null); vmItem.SalesmanId = _vm.SelectedSaleMan.CostCentre; _modal.ShowDialog(); } else MessageBox.Show("Please Select a valid sales man"); } else MessageBox.Show("Please select a sales man"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void hlEdit_Click(object sender, RoutedEventArgs e) { _modal = new ITNLineItemModal(); _modal.Closed += new EventHandler(modal_Closed); _modal.Title = "Edit Product"; // _modal.cmbProduct.IsEnabled = false; Hyperlink hl = sender as Hyperlink; ITNLineItemViewModel vmItem = _modal.DataContext as ITNLineItemViewModel; Guid product = (Guid)hl.Tag; var lineItem = _vm.LineItems.First(n => n.ProductId == product); vmItem.ClearAndSetup.Execute(null); vmItem.LoadForEdit(lineItem.ProductId, lineItem.Qty, _vm.GetProductSerials(lineItem.ProductId)); _vm.IsEdit = true; _modal.ShowDialog(); }