public bool ExecuteAction(string actionName)
        {
            try
            {
                ShellInteractionService.ShowProgress();

                try
                {
                    ActionCatalog.Execute(actionName, WorkItem, this, null);
                    return(true);
                }
                finally
                {
                    ShellInteractionService.HideProgress();
                }
            }
            catch (Imi.SupplyChain.UX.ValidationException ex)
            {
                return(false);
            }
            catch (Exception ex)
            {
                ShellInteractionService.ShowMessageBox(StringResources.ActionException_Text, ex.Message, ex.ToString(), Infrastructure.MessageBoxButton.Ok, Infrastructure.MessageBoxImage.Error);
            }

            return(false);
        }
 public void PackStationOverviewPackRowEventHandler(object sender, EventArgs eventArgs)
 {
     if (eventArgs is Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs)
     {
         ActionCatalog.Execute(WorkItem.Items.FindByType <PackStationActions>().LastOrDefault().PackStationOverviewRunPackRowForPackStation, WorkItem, this, eventArgs as Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs);
     }
 }
 private void ExecuteActions()
 {
     WorkItem.Items.AddNew <ModuleActions>();
     ActionCatalog.Execute(ActionNames.ShowCustomerQueueManagementView, WorkItem, this, null);
     ActionCatalog.Execute(ActionNames.ShowOfficerQueueView, WorkItem, this, null);
     ActionCatalog.Execute(ActionNames.ServiceCustomerAction, WorkItem, this, null);
     ActionCatalog.Execute(ActionNames.ShowAddVisitorToQueueCommand, WorkItem, this, null);
     ActionCatalog.Execute(ActionNames.ShowFindCustomerCommand, WorkItem, this, null);
 }
        private void ServiceCustomer(QueueEntry entry)
        {
            ICurrentQueueEntryService currentEntryService = WorkItem.Services.Get <ICurrentQueueEntryService>();

            currentEntryService.CurrentEntry = entry;
            AssignCustomerToServicing(entry);
            GetOrCreateEntryWorkItem(entry).Activate();
            ActionCatalog.Execute(ActionNames.ActivateOfficerQueueView, WorkItem, this, null);
        }
        public override void OnPackStationOverviewRunUndoPacking(WorkItem context, object caller, object target)
        {
            WorkItem wi = GetModuleWorkItem(context);

            if (wi.Items.FindByType <RunUndoPackingAction>().Count == 0)
            {
                wi.Items.AddNew <RunUndoPackingAction>();
            }

            RunUndoPackingActionParameters actionParameters = null;
            PackStationOverviewViewToRunUndoPackingActionTranslator translator = null;

            if (context.Items.FindByType <PackStationOverviewViewToRunUndoPackingActionTranslator>().Count > 0)
            {
                translator = context.Items.FindByType <PackStationOverviewViewToRunUndoPackingActionTranslator>().Last();
            }
            else
            {
                translator = context.Items.AddNew <PackStationOverviewViewToRunUndoPackingActionTranslator>();
            }

            PackStationOverviewPresenter overviewPresenter = null;

            if (context.Items.FindByType <PackStationOverviewPresenter>().Count > 0)
            {
                overviewPresenter = context.Items.FindByType <PackStationOverviewPresenter>().Last();
            }
            if (overviewPresenter == null)
            {
                return;
            }

            actionParameters = translator.Translate(overviewPresenter.ToLoadCarrierId);
            actionParameters.IsItemSelected          = true;
            actionParameters.IsMultipleItemsSelected = false;

            IPackStationOverviewView view = context.SmartParts.FindByType <PackStationOverviewView>().Last();

            try
            {
                ActionCatalog.Execute(ActionNames.RunUndoPacking, context, caller, actionParameters);

                // Check if view should be closed.
                bool ignoreClosing = ((context.Items.Get("IgnoreClose") != null) &&
                                      ((bool)(context.Items.Get("IgnoreClose"))));

                overviewPresenter.ClearAllButPackedBy();
            }
            catch (Imi.SupplyChain.UX.ValidationException ex)
            {
                view.HandleValidationResult(ValidationHelper.ConvertToResult((Imi.SupplyChain.UX.ValidationException)ex));
            }
        }
Beispiel #6
0
        public override void OnCreateCustomsDeclarationRunCreateCustomsDeclaration(WorkItem context, object caller, object target)
        {
            WorkItem wi = GetModuleWorkItem(context);

            if (wi.Items.FindByType <RunCreateCustomsDeclarationAction>().Count == 0)
            {
                wi.Items.AddNew <RunCreateCustomsDeclarationAction>();
            }

            CreateCustomsDeclarationViewResult          viewResult       = null;
            RunCreateCustomsDeclarationActionParameters actionParameters = null;
            CreateCustomsDeclarationViewToRunCreateCustomsDeclarationActionTranslator translator = null;
            bool isItemSelected = false;

            if (context.Items.FindByType <CreateCustomsDeclarationViewToRunCreateCustomsDeclarationActionTranslator>().Count > 0)
            {
                translator = context.Items.FindByType <CreateCustomsDeclarationViewToRunCreateCustomsDeclarationActionTranslator>().Last();
            }
            else
            {
                translator = context.Items.AddNew <CreateCustomsDeclarationViewToRunCreateCustomsDeclarationActionTranslator>();
            }

            if (context.Items.FindByType <CreateCustomsDeclarationViewResult>().Count > 0)
            {
                viewResult     = context.Items.FindByType <CreateCustomsDeclarationViewResult>().Last();
                isItemSelected = true;
            }
            else
            {
                viewResult = new CreateCustomsDeclarationViewResult();

                if (context.Items.FindByType <CreateCustomsDeclarationViewParameters>().Count() > 0)
                {
                    CreateCustomsDeclarationViewParameters viewParameters = context.Items.FindByType <CreateCustomsDeclarationViewParameters>().Last();

                    viewResult.CustomsDeclarantId = viewParameters.CustomsDeclarantId;
                }
            }

            actionParameters = translator.Translate(viewResult);
            actionParameters.IsItemSelected          = isItemSelected;
            actionParameters.IsMultipleItemsSelected = false;

            ICreateCustomsDeclarationView view = context.SmartParts.FindByType <CreateCustomsDeclarationView>().Last();

            try
            {
                if (!view.Validate())
                {
                    return;
                }

                ActionCatalog.Execute(ActionNames.RunCreateCustomsDeclaration, context, caller, actionParameters);

                if (isItemSelected)
                {
                    if (context.Items.Get("CreateCustomsDeclarationResponse") != null)
                    {
                        CreateCustomsDeclarationResponse serviceResponce = (CreateCustomsDeclarationResponse)context.Items.Get("CreateCustomsDeclarationResponse");

                        if (serviceResponce.CreateCustomsDeclarationResult != null)
                        {
                            if (serviceResponce.CreateCustomsDeclarationResult.CustomsDeclarationId != null)
                            {
                                viewResult.CustomsDeclarationId = serviceResponce.CreateCustomsDeclarationResult.CustomsDeclarationId;
                            }
                        }
                    }
                }

                // Check if view should be closed.
                bool ignoreClosing = ((context.Items.Get("IgnoreClose") != null) &&
                                      ((bool)(context.Items.Get("IgnoreClose"))));

                if (!ignoreClosing)
                {
                    /* close wrapper if view was dynamically loaded */
                    object wrapper = context.Items.Get("Imi.SupplyChain.Warehouse.UX.Views.CustomsDeclaration.ICreateCustomsDeclarationView");

                    if (wrapper == null)
                    {
                        WorkspaceLocatorService.FindContainingWorkspace(context, view).Close(view);
                    }
                    else
                    {
                        WorkspaceLocatorService.FindContainingWorkspace(context, wrapper).Close(wrapper);
                    }
                }
            }
            catch (Imi.SupplyChain.UX.ValidationException ex)
            {
                view.HandleValidationResult(ValidationHelper.ConvertToResult((Imi.SupplyChain.UX.ValidationException)ex));
            }
        }
 public void PackStationOverviewStopPackingEventHandler(object sender, EventArgs eventArgs)
 {
     ActionCatalog.Execute(WorkItem.Items.FindByType <PackStationActions>().LastOrDefault().PackStationOverviewRunStopPacking, WorkItem, this, null);
 }
        public virtual void OnPackStationOverviewRunPackRowForPackStation(WorkItem context, object caller, object target)
        {
            if (target is Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs)
            {
                WorkItem wi = GetModuleWorkItem(context);

                if (wi.Items.FindByType <RunPackRowForPackStationAction>().Count == 0)
                {
                    wi.Items.AddNew <RunPackRowForPackStationAction>();
                }

                Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs args = target as Imi.SupplyChain.Warehouse.UX.Views.PickLoadCarrier.PackStationOverviewPackRowEventArgs;

                RunPackRowForPackStationActionParameters actionParameters = new RunPackRowForPackStationActionParameters();
                actionParameters.FromLoadCarrierId   = args.FromLoadCarrier;
                actionParameters.ToLoadCarrierId     = args.ToLoadCarrier;
                actionParameters.PickOrderLineNumber = args.PickOrderLineNumber;
                actionParameters.PickedQuantity      = args.QuantityToPack;
                actionParameters.IsItemSelected      = true;

                IPackStationOverviewView packStationOverviewView = context.SmartParts.FindByType <IPackStationOverviewView>().LastOrDefault();
                IPackStationFromLCView   packStationFromLcView   = context.SmartParts.FindByType <IPackStationFromLCView>().LastOrDefault();
                IPackStationToLCView     packStationToLcView     = context.SmartParts.FindByType <IPackStationToLCView>().LastOrDefault();

                try
                {
                    ActionCatalog.Execute(ActionNames.RunPackRowForPackStation, context, caller, actionParameters);

                    if (context.Items.Contains("RefreshPackStationOverview"))
                    {
                        if (((bool)context.Items["RefreshPackStationOverview"]))
                        {
                            packStationOverviewView.Refresh();
                        }
                        else
                        {
                            if (packStationFromLcView != null)
                            {
                                packStationFromLcView.Refresh();
                            }

                            if (packStationToLcView != null)
                            {
                                packStationToLcView.Refresh();
                            }
                        }
                    }
                    else
                    {
                        if (packStationFromLcView != null)
                        {
                            packStationFromLcView.Refresh();
                        }

                        if (packStationToLcView != null)
                        {
                            packStationToLcView.Refresh();
                        }
                    }
                }
                catch
                {
                    throw;
                }
            }
        }
        public override void OnPackStationToLCRunFinishPackingWorkflow(WorkItem context, object caller, object target)
        {
            WorkItem wi = GetModuleWorkItem(context);

            if (wi.Items.FindByType <RunFinishPackingWorkflowAction>().Count == 0)
            {
                wi.Items.AddNew <RunFinishPackingWorkflowAction>();
            }

            PackStationToLCViewResult viewResult = null;
            RunFinishPackingWorkflowActionParameters actionParameters = null;
            PackStationToLCViewToRunFinishPackingWorkflowActionTranslator translator = null;
            bool isItemSelected = false;

            if (context.Items.FindByType <PackStationToLCViewToRunFinishPackingWorkflowActionTranslator>().Count > 0)
            {
                translator = context.Items.FindByType <PackStationToLCViewToRunFinishPackingWorkflowActionTranslator>().Last();
            }
            else
            {
                translator = context.Items.AddNew <PackStationToLCViewToRunFinishPackingWorkflowActionTranslator>();
            }

            if (context.Items.FindByType <PackStationToLCViewResult>().Count > 0)
            {
                viewResult     = context.Items.FindByType <PackStationToLCViewResult>().Last();
                isItemSelected = true;
            }
            else
            {
                viewResult = new PackStationToLCViewResult();

                if (context.Items.FindByType <PackStationToLCViewParameters>().Count() > 0)
                {
                    PackStationToLCViewParameters viewParameters = context.Items.FindByType <PackStationToLCViewParameters>().Last();
                }
            }
            actionParameters = translator.Translate(viewResult);
            actionParameters.IsItemSelected          = isItemSelected;
            actionParameters.IsMultipleItemsSelected = false;

            if (context.Items.FindByType <PackStationOverviewViewParameters>().Count > 0)
            {
                PackStationOverviewViewParameters overviewParameters = context.Items.FindByType <PackStationOverviewViewParameters>().Last();
                IPackStationToLCView         view = context.SmartParts.FindByType <PackStationToLCView>().Last();
                PackStationOverviewPresenter overviewPresenter = context.Items.FindByType <PackStationOverviewPresenter>().Last();

                actionParameters.UserId = overviewParameters.UserId;
                try
                {
                    if (!view.Validate())
                    {
                        return;
                    }

                    ActionCatalog.Execute(ActionNames.RunFinishPackingWorkflow, context, caller, actionParameters);

                    // Check if view should be closed.
                    bool ignoreClosing = ((context.Items.Get("IgnoreClose") != null) &&
                                          ((bool)(context.Items.Get("IgnoreClose"))));

                    overviewPresenter.ToLoadCarrierId = string.Empty;
                    overviewPresenter.ClearAllButPackedBy();
                }
                catch (Imi.SupplyChain.UX.ValidationException ex)
                {
                    view.HandleValidationResult(ValidationHelper.ConvertToResult((Imi.SupplyChain.UX.ValidationException)ex));
                }
            }
        }
        public override void OnPackStationFromLcEditRunPackRowForPackStation(WorkItem context, object caller, object target)
        {
            WorkItem wi = GetModuleWorkItem(context);

            if (wi.Items.FindByType <RunPackRowForPackStationAction>().Count == 0)
            {
                wi.Items.AddNew <RunPackRowForPackStationAction>();
            }

            PackStationFromLcEditViewResult          viewResult       = null;
            RunPackRowForPackStationActionParameters actionParameters = null;
            PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator translator = null;
            bool isItemSelected = false;

            if (context.Items.FindByType <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>().Count > 0)
            {
                translator = context.Items.FindByType <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>().Last();
            }
            else
            {
                translator = context.Items.AddNew <PackStationFromLcEditViewToRunPackRowForPackStationActionTranslator>();
            }

            if (context.Items.FindByType <PackStationFromLcEditViewResult>().Count > 0)
            {
                viewResult     = context.Items.FindByType <PackStationFromLcEditViewResult>().Last();
                isItemSelected = true;
            }
            else
            {
                viewResult = new PackStationFromLcEditViewResult();

                if (context.Items.FindByType <PackStationFromLcEditViewParameters>().Count() > 0)
                {
                    PackStationFromLcEditViewParameters viewParameters = context.Items.FindByType <PackStationFromLcEditViewParameters>().Last();
                }
            }

            actionParameters = translator.Translate(viewResult);
            if (context.Items.FindByType <PackStationOverviewPresenter>().Count > 0)
            {
                if (!string.IsNullOrEmpty(context.Items.FindByType <PackStationOverviewPresenter>().Last().ToLoadCarrierId))
                {
                    actionParameters.ToLoadCarrierId = context.Items.FindByType <PackStationOverviewPresenter>().Last().ToLoadCarrierId;
                }
                else
                {
                    actionParameters.ToLoadCarrierId = string.Empty;
                }
            }
            actionParameters.IsItemSelected          = isItemSelected;
            actionParameters.IsMultipleItemsSelected = false;

            IPackStationFromLcEditView view = context.SmartParts.FindByType <PackStationFromLcEditView>().Last();

            IPackStationOverviewView packStationOverviewView = context.SmartParts.FindByType <IPackStationOverviewView>().LastOrDefault();
            IPackStationFromLCView   packStationFromLcView   = context.SmartParts.FindByType <IPackStationFromLCView>().LastOrDefault();
            IPackStationToLCView     packStationToLcView     = context.SmartParts.FindByType <IPackStationToLCView>().LastOrDefault();

            try
            {
                if (!view.Validate())
                {
                    return;
                }

                ActionCatalog.Execute(ActionNames.RunPackRowForPackStation, context, caller, actionParameters);

                // Check if view should be closed.
                bool ignoreClosing = ((context.Items.Get("IgnoreClose") != null) &&
                                      ((bool)(context.Items.Get("IgnoreClose"))));

                if (context.Items.Contains("RefreshPackStationOverview"))
                {
                    if (((bool)context.Items["RefreshPackStationOverview"]))
                    {
                        packStationOverviewView.Refresh();
                    }
                    else
                    {
                        if (packStationFromLcView != null)
                        {
                            packStationFromLcView.Refresh();
                        }

                        if (packStationToLcView != null)
                        {
                            packStationToLcView.Refresh();
                        }
                    }
                }
                else
                {
                    if (packStationFromLcView != null)
                    {
                        packStationFromLcView.Refresh();
                    }

                    if (packStationToLcView != null)
                    {
                        packStationToLcView.Refresh();
                    }
                }
            }
            catch (Imi.SupplyChain.UX.ValidationException ex)
            {
                view.HandleValidationResult(ValidationHelper.ConvertToResult((Imi.SupplyChain.UX.ValidationException)ex));
            }
        }