コード例 #1
0
        private void CreateNewOrderLineExecute()
        {
            OrderLine orderLine = new OrderLine {
                Order = this.order
            };
            OrderLineViewModel viewModel = new OrderLineViewModel(orderLine, this.repositorys);

            this.ShowOrderLine(viewModel);
        }
コード例 #2
0
        private void CreateNewOrderLineExecute()
        {
            OrderLine category = new OrderLine {
                Order = order, Quantity = 1
            };

            OrderLineViewModel viewModel = new OrderLineViewModel(category, this.repository);

            this.ShowOrderLine(viewModel);
        }
コード例 #3
0
        private void OnOrderLineRemoved(object sender, OrderLineEventArgs e)
        {
            OrderLineViewModel viewModel = this.GetOnlySelectedViewModel();

            if (viewModel != null)
            {
                if (viewModel.Line == e.Line)
                {
                    this.AllLines.Remove(viewModel);
                }
            }
        }
コード例 #4
0
        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.");
            }
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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.");
            }
        }
コード例 #7
0
        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");
            }
        }