Пример #1
0
        private void Load()
        {
            _vm = this.DataContext as EditSalesmanOrderViewModel;
            _vm.RunClearAndSetup();
            string _orderId = NavigationService.Source.OriginalString.ParseQueryString("orderid");
            if (!string.IsNullOrEmpty( _orderId))
            {
                _vm.OrderIdLookup = new Guid(_orderId);
            }
            string _loadForViewing = NavigationService.Source.OriginalString.ParseQueryString("loadforviewing");
            if (!string.IsNullOrWhiteSpace(_loadForViewing))
            {
                
                _vm.LoadForViewing = Convert.ToBoolean(_loadForViewing); //always true anyway.
                _vm.PostConfirmVisible = true;
                _vm.LoadForEditing = false;
                _vm.CancelButtonContent = _messageResolver.GetText("sl.createOrder.back");
                _vm.ConfirmNavigatingAway = false;
                lblPageHeader.Content = "";
                btnCancelOrder.Visibility = Visibility.Collapsed;
            }
            else
            {
                _vm.LoadForEditing = true;
                _vm.LoadForViewing = false;
                _vm.PostConfirmVisible = false;
                _vm.CancelButtonContent = _messageResolver.GetText("sl.createOrder.cancel");
                _vm.ConfirmNavigatingAway = true;
                lblPageHeader.Content = _messageResolver.GetText("sl.createOrder.title.new");
            }

            _vm.LoadOrderCommand.Execute(null);

            if (_vm.LoadForEditing)
            {
                if (_vm.LineItems.Count > 0)
                {
                    dtDateRequired.IsEnabled = false;
                    cmbSalesman.IsEnabled = false;
                    cmbRoutes.IsEnabled = false;
                    cmbOutlets.IsEnabled = false;
                }

                if (_vm.OrderIdLookup == Guid.Empty)
                    btnGoHome.Visibility = Visibility.Collapsed;
            }
            else if (_vm.LoadForViewing)
            {
                lblPageHeader.Content = _messageResolver.GetText("sl.createOrder.title.edit.part1")/*"Viewing Order"*/+ " "
                    + _vm.OrderId + " "
                    + _messageResolver.GetText("sl.createOrder.title.edit.part2");/*"Details";*/
            }
        }
Пример #2
0
 //used in confirm and approve which is not is use currently
 void _distMsgBx_PreApproval_Closed(object sender, EventArgs e)
 {
     this.Cursor = Cursors.Wait;
     _distMsgBxVm = _distMsgBx.DataContext as DistributrMessageBoxViewModel;
     _vm = this.DataContext as EditSalesmanOrderViewModel;
     _distMsgBxVm.DialogResult = true;
     switch (_distMsgBxVm.Command)
     {
         case DistributrMessageBoxViewModel.CommandToExcecute.NewButtonClickedCommand://create back orders and approve them
             this.Cursor = Cursors.Wait;
             _vm.CreateBackOrderAndApproveCommand.Execute(null);
             this.Cursor = Cursors.Arrow;
             CompletedActionOptions("Order " + _vm.OrderId + " on behalf of " +
                                              _vm.SelectedSalesman.Username +
                                              "\nwas successfully confirmed after creation of backorder.");
             break;
         case DistributrMessageBoxViewModel.CommandToExcecute.HomeButtonClickedCommand://go back to page
             _distMsgBxVm.DialogResult = false;
             this.Cursor = Cursors.Arrow;
             break;
         case DistributrMessageBoxViewModel.CommandToExcecute.CancelButtonClickedCommand://go back to page
             _distMsgBxVm.DialogResult = false;
             this.Cursor = Cursors.Arrow;
             break;
     }
     if (!_distMsgBxVm.DialogResult) return;
     this.Cursor = Cursors.Arrow;
 }
Пример #3
0
        private void btnGoHome_Click(object sender, RoutedEventArgs e)
        {
            if (
                       MessageBox.Show(/*"Are you sure you want to cancel this order?"*/
                       _messageResolver.GetText("sl.createOrder.cancel.messagebox"),
                       _messageResolver.GetText("sl.createOrder.navigateAway.messagebox.prompt.caption")/*"Distributr: Confirm Navigating Away"*/
                       , MessageBoxButton.OKCancel)
                       == MessageBoxResult.OK)
            {
                _vm.ConfirmNavigatingAway = false;
                if (_vm == null)
                    _vm = DataContext as EditSalesmanOrderViewModel;
                _vm.CancelCommand.Execute(null);
                _vm.CancelOrderCommand.Execute(null);

                _vm.ConfirmNavigatingAway = false;
                NavigationService.Navigate(new Uri("/views/salesmanorders/listsalesmanorders.xaml?PendingApprovals", UriKind.Relative));
            }
        }
Пример #4
0
 private void btnSaveOrder_Click(object sender, RoutedEventArgs e)
 {
     OtherUtilities.StrBackUrl = "/views/salesmanorders/listsalesmanorders.xaml?Incomplete";
     _vm.ConfirmNavigatingAway = false;
     if (_vm == null)
         _vm = this.DataContext as EditSalesmanOrderViewModel;
     if (_vm.IsValid())
     {
         this.Cursor = Cursors.Wait;
         _vm.SaveToContinue();
         this.Cursor = Cursors.Arrow;
         CompletedActionOptions(_messageResolver.GetText("sl.createOrder.postconfirm.messagebox.text1") /*"Order"*/
                                + " " + _vm.OrderId + " "
                                + _messageResolver.GetText("sl.createOrder.postconfirm.messagebox.text2") /*"on behalf of"*/
                                + " " + _vm.SelectedSalesman.Username + " "
                                + _messageResolver.GetText("sl.createOrder.save.messagebox.text3") /*"was successfully saved."*/
             );
     }
 }