private void CreateNewOrderLineExecute() { OrderLine orderLine = new OrderLine { Order = this.order }; OrderLineViewModel viewModel = new OrderLineViewModel(orderLine, this.repositorys); this.ShowOrderLine(viewModel); }
private void CreateNewOrderLineExecute() { OrderLine category = new OrderLine { Order = order, Quantity = 1 }; OrderLineViewModel viewModel = new OrderLineViewModel(category, this.repository); this.ShowOrderLine(viewModel); }
private void OnOrderLineRemoved(object sender, OrderLineEventArgs e) { OrderLineViewModel viewModel = this.GetOnlySelectedViewModel(); if (viewModel != null) { if (viewModel.Line == e.Line) { this.AllLines.Remove(viewModel); } } }
private void EditOrderLineExecute() { OrderLineViewModel viewModel = this.GetOnlySelectedViewModel(); if (viewModel != null) { this.ShowOrderLine(viewModel); this.repository.SaveToDatabase(); } else { MessageBox.Show("Please select only one order line."); } }
private void ShowOrderLine(OrderLineViewModel viewModel) { WorkspaceWindow window = new WorkspaceWindow(); window.Width = 400; window.Title = viewModel.DisplayName; viewModel.CloseAction = b => window.DialogResult = b; OrderLineView view = new OrderLineView(); view.DataContext = viewModel; window.Content = view; window.ShowDialog(); }
private void DeleteOrderLineExecute() { OrderLineViewModel viewModel = this.GetOnlySelectedViewModel(); if (viewModel != null) { if (MessageBox.Show("Do you really want to delete the selected line?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { this.repository.RemoveLine(viewModel.Line); this.repository.SaveToDatabase(); } } else { MessageBox.Show("Please select only one line."); } }
private void EditOrderLineExecute() { try { OrderLineViewModel viewModel = this.AllOrderLines.SingleOrDefault(vm => vm.IsSelected); if (viewModel != null) { this.ShowOrderLine(viewModel); } else { MessageBox.Show("Please select one order line"); } } catch { MessageBox.Show("Please select only one order line"); } }