void DispatchPendingOrdersToPhone_Loaded(object sender, RoutedEventArgs e)
        {
            _vm = DataContext as ListSalesmanOrdersViewModel;
            _vm.SetupForDispatchCommand.Execute(null);
            reloadListOnSalesmanChanged = false;

            if (!_configService.ViewModelParameters.CurrentUserRights.CanDispatchOrder)
                btnDispatch.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 2
0
 public ListPOSSalesViewModel()
 {
     _vm = new ListSalesmanOrdersViewModel();
     LoadSalesBySearchTextCommand = new RelayCommand(DoLoadBySearchText);
     AddNewSale = new RelayCommand(DoAddNewSale);
     SelectViewerAndGoCommand = new RelayCommand(DoSelectViewerAndGo);
     Sales = new ObservableCollection<POSSaleItem>();
     using (StructureMap.IContainer cont = NestedContainer)
     {
         CanCreateSales = Using<IConfigService>(cont).ViewModelParameters.CurrentUserRights.CanManagePOSSales;
             //create and edit..
         CanReceivePayments = Using<IConfigService>(cont).ViewModelParameters.CurrentUserRights.CanManagePOSSales;
     }
 }
 private void cmbSalesmen_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (!isInitialized)
         return;
     _vm = DataContext as ListSalesmanOrdersViewModel;
     if (_vm.SelectedSalesman == null)
         return;
     if (_vm.SelectedSalesman.Id != Guid.Empty)
         reloadListOnSalesmanChanged = true;
     if (reloadListOnSalesmanChanged)
     {
         _vm.LoadSalesmansPendingOrdersForDispatchCommand.Execute(null);
         dgOrders.ItemsSource = _vm.Orders;
     }
 }
 private void chkSelectAll_Unchecked(object sender, RoutedEventArgs e)
 {
     if (!isInitialized)
         return;
     _vm = DataContext as ListSalesmanOrdersViewModel;
     _vm.UnSelectAllCommand.Execute(null);
     dgOrders.ItemsSource = _vm.Orders;
 }
        void PostDispatchMessageBox()
        {
            string msg = "";
            string ordersThatCntBeDispatched = "";
            string post_dispatch_msg = "";
            //new, home, ok, cancel, action1
            if (_vm != null)
                _vm = this.DataContext as ListSalesmanOrdersViewModel;

            post_dispatch_msg = _vm.dispatchCount + " "
                + _messageResolver.GetText("sl.dispatchOrders.dispatch.sucess.messagebox.text")/*"order(s) were dispatched successfully."*/
                + "\n\n";
            if (_vm.OrdersThatCannotBeDispatched != null)
            {
                if (_vm.OrdersThatCannotBeDispatched.Count > 0)
                {
                    msg +=
                        _messageResolver.GetText("sl.dispatchOrders.dispatch.fail.messagebox.text1")/*"The following"*/
                        + " " + ordersThatCntBeDispatched.Count() + " " +
                        _messageResolver.GetText("sl.dispatchOrders.dispatch.fail.messagebox.text2")
                        /*"orders could not be dispatched because insuficient inventory on all of the order items."*/
                        + "\n";
                    ordersThatCntBeDispatched = _vm.OrdersThatCannotBeDispatched.Aggregate(ordersThatCntBeDispatched,
                                                                                           (current, order) =>
                                                                                           current +
                                                                                           ("\t" +
                                                                                            order.DocumentReference +
                                                                                            "\n"));

                    msg += ordersThatCntBeDispatched;
                }
            }

            bool showDispatchOption = _vm.Orders.Count() > 0;

            string btnCont = _messageResolver.GetText("sl.dispatchOrders.dispatch.sucess.messagebox.option.continue")/*"Continue Dispatching Orders"*/;
            string btnApprove = _messageResolver.GetText("sl.dispatchOrders.dispatch.sucess.messagebox.option.approve")/*"Approve Orders"*/;
            string btnView = _messageResolver.GetText("sl.dispatchOrders.dispatch.sucess.messagebox.option.view")/*"View Dispatched Orders"*/;
            _distributrMessageBox = new DistributrMessageBox(showDispatchOption, true, true, false, false, btnCont,
                                                             btnApprove, btnView);
            _distributrMessageBoxViewModel = _distributrMessageBox.DataContext as DistributrMessageBoxViewModel;
            _distributrMessageBox.Closed += new EventHandler(_distributrMessageBoxRevisedPostDispatch_Closed);
            _distributrMessageBoxViewModel.MessageBoxTitle = _messageResolver.GetText("sl.dispatchOrders.dispatch.messagebox.caption")/* "Distributr: Dispatch Orders"*/;
            _distributrMessageBoxViewModel.NewButtonToolTip =
                "Continue dispatching orders";
            _distributrMessageBoxViewModel.HomeButtonTooTip =
                "Go to orders pending approval list and approve orders";
            _distributrMessageBoxViewModel.OKButtonToolTip =
                "Go to list of dispatched orders.";

            post_dispatch_msg += msg;
            _distributrMessageBoxViewModel.MessageBoxContent = post_dispatch_msg;
            _distributrMessageBox.ShowDialog();
        }
        void dispatchOptions_Closed(object sender, EventArgs e)
        {
            var dispatchOptions = sender as DispatchOptions;
            _vm = this.DataContext as ListSalesmanOrdersViewModel;
            if ((bool)dispatchOptions.DialogResult)
            {
                _vm.SelectedDispatchMode = dispatchOptions.SelectedDispatchOption;
                this.Cursor = Cursors.Wait;
                _vm.DispatchCommand.Execute(null);
                this.Cursor = Cursors.Arrow;

                if (!_vm.ProcessBackOrder)
                    PostDispatchMessageBox();
            }
        }