Ejemplo n.º 1
0
        private void inventoryQuestionsFormNavAction(object sender, object data)
        {
            NavBox             inventoryQuestionsNavBox = (NavBox)sender;
            InventoryQuestions inventoryQuestionsForm   = (InventoryQuestions)data;

            NavBox.NavAction action = inventoryQuestionsNavBox.Action;
            if (action == NavBox.NavAction.BACKANDSUBMIT)
            {
                DesktopSession.HistorySession.Back();
                action = NavBox.NavAction.SUBMIT;
            }
            switch (action)
            {
            case NavBox.NavAction.SUBMIT:
                inventoryQuestionsForm.Hide();
                this.nextState = InventoryAuditFlowState.AuditResults;
                break;

            case NavBox.NavAction.CANCEL:
                inventoryQuestionsForm.Hide();
                this.nextState = InventoryAuditFlowState.AuditManager;
                break;

            default:
                throw new ApplicationException("" + action.ToString() + " is not a valid state for InventoryQuestions");
            }

            this.executeNextState();
        }
        public ShowForm CreateInventoryQuestionsShowBlock(
            Form parentForm,
            NavBox.NavBoxActionFired fxn)
        {
            var inventoryQuestions = new InventoryQuestions();

            return(this.createShowFormBlock(
                       ValidFormBlockTypes.None,
                       parentForm,
                       inventoryQuestions,
                       inventoryQuestions.NavControlBox,
                       fxn));
        }
Ejemplo n.º 3
0
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            InventoryAuditFlowState inputState = (InventoryAuditFlowState)inputData;

            Form currForm;

            switch (inputState)
            {
            case InventoryAuditFlowState.SelectAudit:
                SelectAudit selectAudit = new SelectAudit();
                currForm = DesktopSession.HistorySession.Lookup(selectAudit);
                if (currForm.GetType() == typeof(SelectAudit))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm selectAuditBlk = CommonAppBlocks.Instance.CreateSelectAuditShowBlock(this.parentForm, this.selectAuditFormNavAction);
                    if (!selectAuditBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Select Audit block");
                    }
                }

                break;

            case InventoryAuditFlowState.SelectStore:
                SelectStore selectStore = new SelectStore();
                currForm = DesktopSession.HistorySession.Lookup(selectStore);
                if (currForm.GetType() == typeof(SelectStore))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm selectStoreBlk = CommonAppBlocks.Instance.CreateSelectStoreShowBlock(this.parentForm, this.selectStoreFormNavAction);
                    if (!selectStoreBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Select Store block");
                    }
                }

                break;

            case InventoryAuditFlowState.InitiateAudit:
                InitiateAudit initiateAudit = new InitiateAudit();
                currForm = DesktopSession.HistorySession.Lookup(initiateAudit);
                if (currForm.GetType() == typeof(InitiateAudit))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm initiateAuditBlk = CommonAppBlocks.Instance.CreateInitiateAuditShowBlock(this.parentForm, this.initiateAuditFormNavAction);
                    if (!initiateAuditBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Initiate Audit block");
                    }
                }

                break;

            case InventoryAuditFlowState.AuditManager:
                AuditManager auditManager = new AuditManager();
                currForm = DesktopSession.HistorySession.Lookup(auditManager);
                if (currForm.GetType() == typeof(AuditManager))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm auditManagerBlk = CommonAppBlocks.Instance.CreateAuditManagerShowBlock(this.parentForm, this.auditManagerFormNavAction);
                    if (!auditManagerBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Audit Manager block");
                    }
                }

                break;

            case InventoryAuditFlowState.InventorySummary:
                InventorySummary inventorySummary = new InventorySummary();
                currForm = DesktopSession.HistorySession.Lookup(inventorySummary);

                ShowForm inventorySummaryBlk = CommonAppBlocks.Instance.CreateInventorySummaryShowBlock(this.parentForm, this.inventorySummaryFormNavAction);
                if (!inventorySummaryBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Inventory Summary block");
                }


                break;

            case InventoryAuditFlowState.InventoryQuestions:
                InventoryQuestions inventoryQuestions = new InventoryQuestions();
                currForm = DesktopSession.HistorySession.Lookup(inventoryQuestions);
                if (currForm.GetType() == typeof(InventoryQuestions))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm inventoryQuestionsBlk = CommonAppBlocks.Instance.CreateInventoryQuestionsShowBlock(this.parentForm, this.inventoryQuestionsFormNavAction);
                    if (!inventoryQuestionsBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Inventory Questions block");
                    }
                }

                break;

            case InventoryAuditFlowState.DownloadToTrakker:
                //DownloadToTrakker downloadToTrakker = new DownloadToTrakker();
                //currForm = DesktopSession.HistorySession.Lookup(downloadToTrakker);
                //if (currForm.GetType() == typeof(DownloadToTrakker))
                //{
                //    currForm.Show();
                //}
                //else
                //{
                ShowForm downloadToTrakkerBlk = CommonAppBlocks.Instance.CreateDownloadToTrakkerShowBlock(this.parentForm, this.downloadToTrakkerFormNavAction);
                if (!downloadToTrakkerBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Download to Trakker block");
                }
                //}

                break;

            case InventoryAuditFlowState.UploadFromTrakker:
                //UploadFromTrakker uploadFromTrakker = new UploadFromTrakker();
                //currForm = DesktopSession.HistorySession.Lookup(uploadFromTrakker);
                //if (currForm.GetType() == typeof(DownloadToTrakker))
                //{
                //    currForm.Show();
                //}
                //else
                //{
                ShowForm uploadFromTrakkerBlk = CommonAppBlocks.Instance.CreateUploadFromTrakkerShowBlock(this.parentForm, this.uploadFromTrakkerFormNavAction);
                if (!uploadFromTrakkerBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Upload from Trakker block");
                }
                //}

                break;

            case InventoryAuditFlowState.ProcessMissing:
                //ProcessMissingItems processMissingItems = new ProcessMissingItems();
                //currForm = DesktopSession.HistorySession.Lookup(processMissingItems);
                //if (currForm.GetType() == typeof(ProcessMissingItems))
                //{
                //    currForm.Show();
                //}
                //else
                //{
                ShowForm processMissingItemsBlk = CommonAppBlocks.Instance.CreateProcessMissingItemsShowBlock(this.parentForm, this.processMissingItemsFormNavAction);
                if (!processMissingItemsBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Process Missing Items block");
                }
                //}

                break;

            case InventoryAuditFlowState.ProcessUnexpected:
                //ProcessUnexpectedItems processUnexpectedItems = new ProcessUnexpectedItems();
                //currForm = DesktopSession.HistorySession.Lookup(processUnexpectedItems);
                //if (currForm.GetType() == typeof(ProcessUnexpectedItems))
                //{
                //    currForm.Show();
                //}
                //else
                //{
                ShowForm processUnexpectedItemsBlk = CommonAppBlocks.Instance.CreateProcessUnexpectedItemsShowBlock(this.parentForm, this.processUnexpectedItemsFormNavAction);
                if (!processUnexpectedItemsBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Process Unexpected Items block");
                }
                //}

                break;

            case InventoryAuditFlowState.CountCACC:
                EnterCaccItems enterCaccItems = new EnterCaccItems();
                currForm = DesktopSession.HistorySession.Lookup(enterCaccItems);
                if (currForm.GetType() == typeof(EnterCaccItems))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm enterCaccItemsBlk = CommonAppBlocks.Instance.CreateEnterCaccItemsShowBlock(this.parentForm, this.enterCaccItemsFormNavAction);
                    if (!enterCaccItemsBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Enter Cacc Items block");
                    }
                }

                break;

            case InventoryAuditFlowState.AuditResults:
                ClosedAudit closedAudit = new ClosedAudit();
                currForm = DesktopSession.HistorySession.Lookup(closedAudit);
                if (currForm.GetType() == typeof(ClosedAudit))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm closedAuditBlk = CommonAppBlocks.Instance.CreateClosedAuditShowBlock(this.parentForm, this.closedAuditFormNavAction);
                    if (!closedAuditBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Closed Audit block");
                    }
                }

                break;

            case InventoryAuditFlowState.ChargeOn:
                ShowForm describeMerchBlk = CommonAppBlocks.Instance.DescribeMerchChargeOnBlock(this.parentForm, this.describeMerchFormAction, DesktopSession);
                if (!describeMerchBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise Block");
                }
                break;

            case InventoryAuditFlowState.DescribeItem:
                ShowForm describeItemBlk = CommonAppBlocks.Instance.DescribeItemBlock(this.parentForm, this.describeItemFormAction, DesktopSession);
                if (!describeItemBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item Block");
                }
                break;

            case InventoryAuditFlowState.CancelFlow:
                AuditDesktopSession.Instance.ClearLoggedInUser();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case InventoryAuditFlowState.ExitFlow:
                AuditDesktopSession.Instance.ClearLoggedInUser();
                break;

            default:
                throw new ApplicationException("Invalid inventory audit flow state");
            }

            return(true);
        }