Exemplo n.º 1
0
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            ShowForm ProductServicesBlk = CommonAppBlocks.Instance.CreateProductServicesBlock(this.parentForm, this.productServicesFormNavAction);

            if (!ProductServicesBlk.execute())
            {
                throw new ApplicationException("Cannot execute Product Services block");
            }
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }

            LookupReceiptFlowState curState = (LookupReceiptFlowState)inputData;

            switch (curState)
            {
            case LookupReceiptFlowState.LookupReceipt:
                ShowForm lookupReceiptBlk =
                    CommonAppBlocks.Instance.CreateLookupReceiptBlock(
                        this.parentForm, this.lookupReceiptFormNavAction);
                if (!lookupReceiptBlk.execute())
                {
                    throw new ApplicationException("Cannot execute lookup receipt block");
                }
                break;

            case LookupReceiptFlowState.ViewReceipt:
                ShowForm viewReceiptBlk =
                    CommonAppBlocks.Instance.CreateViewReceiptBlock(
                        this.parentForm, this.viewReceiptFormNavAction);
                if (!viewReceiptBlk.execute())
                {
                    throw new ApplicationException("Cannot execute view receipt block");
                }

                break;

            case LookupReceiptFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case LookupReceiptFlowState.Error:
                break;

            case LookupReceiptFlowState.ExitFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            default:
                throw new ApplicationException("Invalid flow state for LookupReceiptFlowExecutor");
            }

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Main execution function for RetailReturnFlowexecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            LayawayReturnFlowState inputState = (LayawayReturnFlowState)inputData;

            switch (inputState)
            {
            case LayawayReturnFlowState.LayawaySearch:
                ShowForm buyReturnFrmBlk = CommonAppBlocks.Instance.LayawaySearchFormBlock(this.parentForm, this.layawaySearchFormNavAction);
                if (!buyReturnFrmBlk.execute())
                {
                    throw new ApplicationException("Cannot show layaway search form");
                }
                break;

            case LayawayReturnFlowState.LayawayRefund:
                ShowForm buyReturnItemBlk = CommonAppBlocks.Instance.LayawayRefundFormBlock(this.parentForm, this.layRefundFormNavAction);
                if (!buyReturnItemBlk.execute())
                {
                    throw new ApplicationException("Cannot show layaway refund form");
                }

                break;

            case LayawayReturnFlowState.TenderOut:
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup("TenderOut"))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.VisibleForm("TenderOut");
                }
                else
                {
                    ShowForm tenderBlk = CommonAppBlocks.Instance.TenderOutExistingRefundShowBlock(this.parentForm, this.TenderOutFormAction);
                    if (!tenderBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Tender Out Block");
                    }
                }
                break;

            case LayawayReturnFlowState.CancelFlow:
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();
                GlobalDataAccessor.Instance.DesktopSession.ClearSessionData();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;
            }


            return(true);
        }
        /// <summary>
        /// Main execution function for SecurityFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            SecurityFlowState inputState = (SecurityFlowState)inputData;

            switch (inputState)
            {
            case SecurityFlowState.SelectEmployee:
                ShowForm selEmployeeBlk = CommonAppBlocks.Instance.SelectEmployeeFormBlock(this.parentForm, this.selectEmployeeFormNavAction);
                if (!selEmployeeBlk.execute())
                {
                    throw new ApplicationException("Cannot execute SelectEmployee block");
                }

                break;

            case SecurityFlowState.SecurityProfile:
                ShowForm secProfileBlk = CommonAppBlocks.Instance.SecurityProfileFormBlock(this.parentForm, this.securityProfileFormNavAction);
                if (!secProfileBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Security Profile block");
                }
                break;

            case SecurityFlowState.AddEmployee:
                ShowForm addEmpBlk = CommonAppBlocks.Instance.AddEmployeeFormBlock(this.parentForm, this.addEmployeeFormNavAction);
                if (!addEmpBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Add Employee block");
                }
                break;


            case SecurityFlowState.Cancel:

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


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

            return(true);
        }
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            ShopCashManagementFlowState inputState = (ShopCashManagementFlowState)inputData;

            switch (inputState)
            {
            case ShopCashManagementFlowState.ViewCashDrawerAssignments:
                ShowForm viewCashDrawerFmBlk = CommonAppBlocks.Instance.CreateViewCashDrawerAssignmentsBlock(this.parentForm, this.viewCashDrawerNavFunction);
                if (!viewCashDrawerFmBlk.execute())
                {
                    throw new ApplicationException("Cannot show View Cash Drawer Assignment form");
                }
                break;

            case ShopCashManagementFlowState.ShopCashManagement:
                ShowForm shopCashFmBlk = CommonAppBlocks.Instance.CreateShopCashManagementForm(this.parentForm, this.shopCashManagementNavFunction);
                if (!shopCashFmBlk.execute())
                {
                    throw new ApplicationException("Cannot show ShopCashMgr form");
                }

                break;

            case ShopCashManagementFlowState.AddCashDrawer:
                ShowForm addCashDrawerFrmBlk = CommonAppBlocks.Instance.CreateAddCashDrawerShowBlock(this.parentForm, this.addCashDrawerNavFunction);
                if (!addCashDrawerFrmBlk.execute())
                {
                    throw new ApplicationException("Cannot show Add Cash Drawer form");
                }
                break;

            case ShopCashManagementFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;
            }


            return(true);
        }
        /// <summary>
        /// Main execution function for ReleaseFingerprintsFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            ReleaseFingerprintsFlowExecutorFlowState inputState = (ReleaseFingerprintsFlowExecutorFlowState)inputData;

            switch (inputState)
            {
            case ReleaseFingerprintsFlowExecutorFlowState.BuyLoanLookup:
                ShowForm lookupLoanBuyBlk = CommonAppBlocks.Instance.CreateLookupLoanBuyShowBlock(this.parentForm, this.lookupLoanBuyFormNavAction);
                if (!lookupLoanBuyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute BuyLoanLookup block");
                }
                break;

            case ReleaseFingerprintsFlowExecutorFlowState.ShowBuyLoanLookupResults:
                ShowForm lookupLoanBuyResultsBlk = CommonAppBlocks.Instance.CreateReleaseFingerprintsAuthorizationBlock(this.parentForm, this.lookupLoanBuyFormNavAction);
                if (!lookupLoanBuyResultsBlk.execute())
                {
                    throw new ApplicationException("Cannot execute BuyLoanLookupResults block");
                }
                break;

            case ReleaseFingerprintsFlowExecutorFlowState.Cancel:
                //Clear the customer from session
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


            default:
                throw new ApplicationException("Invalid Release Fingerprints flow state");
            }

            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Main execution function for LookupCustomerFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = LoanInquiryFlowState.LoanInquiry;
            }
            LoanInquiryFlowState inputState = (LoanInquiryFlowState)inputData;

            switch (inputState)
            {
            case LoanInquiryFlowState.LoanInquiry:
                ShowForm loanInquiry = CommonAppBlocks.Instance.LoanInquiryShowBlock(this.parentForm, this.inquiryFormNavAction);
                if (!loanInquiry.execute())
                {
                    throw new ApplicationException("Cannot execute LoanInquiry block");
                }

                break;

            case LoanInquiryFlowState.LoanInquiryResults:
                ////ShowForm loanInquiryResults = CommonAppBlocks.Instance.LoanInquiryResultsShowBlock(this.parentForm, this.inquiryResultsFormNavAction);
                //if (!loanInquiryResults.execute())
                //{
                //    throw new ApplicationException("Cannot execute LoanInquiry Results block");
                //}
                break;

            case LoanInquiryFlowState.LoanInquiryDetails:
                break;

            case LoanInquiryFlowState.Cancel:
                CommonAppBlocks.Instance.HideFlowTabController();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for PoliceHoldReleaseFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            PoliceHoldReleaseFlowState inputState = (PoliceHoldReleaseFlowState)inputData;

            switch (inputState)
            {
            case PoliceHoldReleaseFlowState.LookupCustomer:
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case PoliceHoldReleaseFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case PoliceHoldReleaseFlowState.PoliceHoldReleaseList:
                ShowForm custHoldRelListBlk = CommonAppBlocks.Instance.CreatePoliceHoldReleaseListShowBlock(this.parentForm, this.policeHoldReleaseListFormNavAction);
                if (!custHoldRelListBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Police Hold Release List block");
                }
                break;

            case PoliceHoldReleaseFlowState.PoliceHoldReleaseInfo:
                ShowForm custHoldRelInfoBlk = CommonAppBlocks.Instance.CreatePoliceHoldReleaseInfoShowBlock(this.parentForm, this.policeHoldReleaseInfoFormNavAction);
                if (!custHoldRelInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Police Hold Release Info block");
                }
                break;

            case PoliceHoldReleaseFlowState.PoliceHoldReleaseToClaimant:
                //Clear Previous Customer Srch Data DF 0028
                GlobalDataAccessor.Instance.DesktopSession.ActiveLookupCriteria = new LookupCustomerSearchData();
                ShowForm policeHoldRelToClaimantBlk = CommonAppBlocks.Instance.CreatePoliceHoldReleaseInfoShowBlock(this.parentForm, this.policeHoldReleaseInfoFormNavAction);
                if (!policeHoldRelToClaimantBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Police Hold Release Info block");
                }
                //Set the release to claimant property to true
                ((PoliceHoldRelease)policeHoldRelToClaimantBlk.ClassForm).ReleaseToClaimant = true;
                break;

            case PoliceHoldReleaseFlowState.ManageCustomer:
                CreateCustomer createCustFrm = new CreateCustomer();
                Form           currForm      = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(createCustFrm);
                if (currForm.GetType() == typeof(CreateCustomer))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    ShowForm createCustBlk = CommonAppBlocks.Instance.CreateCreateCustomerBlock(this.parentForm, this.createCustFormNavAction);
                    if (!createCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Create Customer block");
                    }
                }
                break;

            case PoliceHoldReleaseFlowState.UpdateAddress:
                UpdateAddress addrFrm        = new UpdateAddress();
                Form          currentaddForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(addrFrm);
                if (currentaddForm.GetType() == typeof(UpdateAddress))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    ShowForm updateAddrBlk = CommonAppBlocks.Instance.UpdateAddressShowFormBlock(this.parentForm, this.updateAddressFormNavAction);
                    if (!updateAddrBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Update Addess Form block");
                    }
                }

                break;

            case PoliceHoldReleaseFlowState.UpdatePhysicalDescription:

                ShowForm updatePhysDescBlk = CommonAppBlocks.Instance.UpdatePhysDescShowFormBlock(this.parentForm, this.updatePhysicalDescFormNavAction);
                if (!updatePhysDescBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Update Physical Description block");
                }


                break;

            case PoliceHoldReleaseFlowState.Cancel:
                //Clear the customer from session
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


            default:
                throw new ApplicationException("Invalid Police Hold release flow state");
            }

            return(true);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Main execution function for CustomerHoldFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            GunBookEditFlowState inputState = (GunBookEditFlowState)inputData;

            switch (inputState)
            {
            case GunBookEditFlowState.LookupCustomer:
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case GunBookEditFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case GunBookEditFlowState.DescribeMerchandise:

                ShowForm descMdseBlk = CommonAppBlocks.Instance.DescribeMerchandiseGunEditBlock(this.parentForm, this.describeMerchFormAction);
                if (!descMdseBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise block");
                }

                break;

            case GunBookEditFlowState.DescribeItem:
                ShowForm descItemBlk = CommonAppBlocks.Instance.DescribeItemBlock(this.parentForm, this.describeItemFormAction);
                if (!descItemBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item block");
                }

                break;

            case GunBookEditFlowState.DescribeItemEdit:
                ShowForm describeItemEditBlk = CommonAppBlocks.Instance.DescribeItemGunEditBlock(this.parentForm, this.describeItemFormAction);
                if (!describeItemEditBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item PFI Block");
                }
                break;

            case GunBookEditFlowState.GunBookSearch:
                ShowForm gunBookSearchBlk = CommonAppBlocks.Instance.GunBookSearchFormBlock(this.parentForm, this.gunBookSearchFormNavAction);
                if (!gunBookSearchBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Gun Book Edit Search block");
                }
                break;

            case GunBookEditFlowState.EditGunBookRecord:
                ShowForm editGunBookrecordBlk = CommonAppBlocks.Instance.GunBookEditFormBlock(this.parentForm, this.gunBookEditFormNavAction);
                if (!editGunBookrecordBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Gun Book Edit block");
                }
                break;

            case GunBookEditFlowState.CustomerReplace:
                ShowForm custReplaceBlk = CommonAppBlocks.Instance.CustomerReplaceBlock(this.parentForm, this.customerReplaceFormNavAction);
                if (!custReplaceBlk.execute())
                {
                    throw new ApplicationException("Cannot execute customer replace block");
                }
                break;


            case GunBookEditFlowState.Cancel:
                //Clear the customer from session
                CashlinxDesktopSession.Instance.ClearCustomerList();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


            default:
                throw new ApplicationException("Invalid Gun Book Edit flow state");
            }

            return(true);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            MMPIFlowState inputState = (MMPIFlowState)inputData;

            if (parentFlow != null)
            {
                parentFlowName = parentFlow.Name;
            }
            if (inputState == MMPIFlowState.DescribeItem)
            {
                //check if activepawnloan is null or activepurchase is null
                if (parentFlowName.Equals("CustomerPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase))
                {
                    IsBuyMerchandiseLookedUp lookupFxn = CommonAppBlocks.Instance.IsBuyMerchandiseLookedUpBlock;
                    lookupFxn.execute();

                    //check if customer is looked up
                    IsCustomerLookedUp lookupCustFxn = CommonAppBlocks.Instance.IsCustomerLookedUpBlock;
                    lookupCustFxn.execute();

                    if (lookupFxn.Value == false)
                    {
                        inputState = MMPIFlowState.DescribeMerchandise;
                    }
                    //both merchandise and customer looked up and its describe item flow in customer purchase
                    else if (lookupFxn.Value && lookupCustFxn.Value &&
                             GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.DESCRIBEITEMCUSTOMERPURCHASE, StringComparison.OrdinalIgnoreCase) &&
                             GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext != CurrentContext.EDIT_MMP)
                    {
                        if (GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext == CurrentContext.NEW &&
                            (GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex >= 0 || GlobalDataAccessor.Instance.DesktopSession.ActivePurchase.ProductDataComplete))
                        {
                            List <Item> items = GlobalDataAccessor.Instance.DesktopSession.ActivePurchase.Items;
                            if (!(string.IsNullOrEmpty(items[items.Count - 1].TicketDescription)))
                            {
                                inputState = MMPIFlowState.ManageMultiplePawnItems;
                            }
                        }
                    }
                }
                else if (parentFlowName.Equals("VendorPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase))
                {
                    IsBuyMerchandiseLookedUp lookupFxn = CommonAppBlocks.Instance.IsBuyMerchandiseLookedUpBlock;
                    lookupFxn.execute();

                    if (lookupFxn.Value == false)
                    {
                        inputState = MMPIFlowState.DescribeMerchandise;
                    }
                    else if (!string.IsNullOrEmpty(CashlinxDesktopSession.Instance.ActivePurchase.PurchaseOrderNumber))
                    {
                        inputState = MMPIFlowState.ManageMultiplePawnItems;
                    }
                }
                else if (parentFlowName.Equals("NewPawnLoanFlowExecutor", StringComparison.OrdinalIgnoreCase) ||
                         GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.DESCRIBEMERCHANDISE, StringComparison.OrdinalIgnoreCase))
                {
                    IsLoanMerchandiseLookedUp lookupFxn = CommonAppBlocks.Instance.IsLoanMerchandiseLookedUpBlock;
                    lookupFxn.execute();

                    if (lookupFxn.Value == false)
                    {
                        inputState = MMPIFlowState.DescribeMerchandise;
                    }
                    else if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items[0].mStore == 0)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
                        inputState = MMPIFlowState.DescribeItem;
                    }
                    else
                    {
                        //check if customer is looked up
                        IsCustomerLookedUp lookupCustFxn = CommonAppBlocks.Instance.IsCustomerLookedUpBlock;
                        lookupCustFxn.execute();

                        if (lookupFxn.Value && lookupCustFxn.Value &&
                            GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext != CurrentContext.EDIT_MMP)
                        {
                            if (GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext == CurrentContext.NEW && GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex == -1 || GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.ProductDataComplete)
                            {
                                List <Item> items = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items;
                                if (!(string.IsNullOrEmpty(items[items.Count - 1].TicketDescription)))
                                {
                                    inputState = MMPIFlowState.ManageMultiplePawnItems;
                                }
                            }
                            else if (GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext == CurrentContext.NEW &&
                                     (GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex >= 0))
                            {
                                inputState = MMPIFlowState.DescribeItem;
                            }
                        }
                    }
                }
                else
                {
                    if (GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan == null ||
                        GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items == null ||
                        GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan.Items.Count == 0)
                    {
                        inputState = MMPIFlowState.DescribeMerchandise;
                    }
                }
            }


            switch (inputState)
            {
            case MMPIFlowState.DescribeMerchandise:
                ShowForm describeMerchBlk = CommonAppBlocks.Instance.DescribeMerchandiseBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise block");
                }

                if (!(parentFlowName.Equals("CustomerPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    !(parentFlowName.Equals("VendorPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !String.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber)))
                {
                    SetTabsInForm(describeMerchBlk);
                }
                break;

            case MMPIFlowState.DescribeItem:
                ShowForm describeItemBlk = CommonAppBlocks.Instance.DescribeItemBlock(this.parentForm, this.describeItemFormAction);
                if (!describeItemBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item Block");
                }
                //show tabs only if its not new pawn loan flow that called this child flow
                if (!(parentFlowName.Equals("CustomerPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    !(parentFlowName.Equals("VendorPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !String.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber)))
                {
                    //Check if Manage multiple pawn items form is still there
                    //If it is, no need to show the tabs
                    if (!(GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup("ManageMultiplePawnItems")))
                    {
                        SetTabsInForm(describeItemBlk);
                    }
                }
                break;

            case MMPIFlowState.ManageMultiplePawnItems:
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup("ManageMultiplePawnItems"))
                {
                    //Remove the MMPI form and reload
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }

                ShowForm mmpiBlk = CommonAppBlocks.Instance.ManageMultiplePawnItemsBlock(this.parentForm, this.multiplePawnItemsFormAction);
                if (!mmpiBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Manage Multiple Pawn Items Block");
                }
                if (!(parentFlowName.Equals("CustomerPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    !(parentFlowName.Equals("VendorPurchaseFlowExecutor", StringComparison.OrdinalIgnoreCase)) &&
                    (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !String.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber)))
                {
                    SetTabsInForm(mmpiBlk);
                }
                break;

            case MMPIFlowState.CancelFlow:
                CommonAppBlocks.Instance.HideFlowTabController();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case MMPIFlowState.ExitFlowToItemHistory:
                if (parentFlow != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.ItemHistory;
                    this.parentFlow.execute();
                }
                break;

            case MMPIFlowState.ExitFlowToProductHistory:
                if (parentFlow != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.ProductHistory;
                    this.parentFlow.execute();
                }
                break;

            case MMPIFlowState.ExitFlowToViewCustomer:
                if (parentFlow != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.Customer;
                    this.parentFlow.execute();
                }
                break;

            case MMPIFlowState.ExitFlowToLookupCustomer:
                GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                if (parentFlow != null)
                {
                    this.parentFlow.execute();
                }

                break;

            case MMPIFlowState.ExitFlowToVendor:
                CashlinxDesktopSession.Instance.HistorySession.Back();
                if (parentFlow != null)
                {
                    this.parentFlow.execute();
                }
                break;

            case MMPIFlowState.ExitFlowToStats:
                if (parentFlow != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.Stats;
                    this.parentFlow.execute();
                }
                break;

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

            return(true);
        }
        /// <summary>
        /// Main execution function for ChangeRetailPriceFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            TransferInFlowState inputState = (TransferInFlowState)inputData;
            var dSession = GlobalDataAccessor.Instance.DesktopSession;

            switch (inputState)
            {
            case TransferInFlowState.ManageTransfer:
                if (dSession.ActiveTransferIn == null)
                {
                    dSession.ActiveTransferIn = new TransferVO();
                }

                dSession.TransferMethod = TransferMethod.QuickReceive;

                var  transferIn = new ManageTransferIn();
                Form currForm   = dSession.HistorySession.Lookup(transferIn);
                if (currForm.GetType() == typeof(ManageTransferIn))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm manageTransferInBlk = CommonAppBlocks.Instance.CreateManageTransferInShowBlock(this.parentForm, this.manageTransferInFormNavAction);
                    if (!manageTransferInBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Manage Transfer In Show block");
                    }
                }

                break;

            case TransferInFlowState.SelectTransferMethod:
                ShowForm selectTransferMethodBlk = CommonAppBlocks.Instance.CreateSelectTransferMethodShowBlock(this.parentForm, this.selectTransferMethodFormAction);
                if (!selectTransferMethodBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Select Transfer Method Block");
                }
                break;

            case TransferInFlowState.SelectItems:
                ShowForm selectTransferInItemsBlk = CommonAppBlocks.Instance.CreateSelectTransferInItemsShowBlock(this.parentForm, this.selectTransferInItemsFormAction);
                if (!selectTransferInItemsBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Select Transfer In Items Block");
                }
                break;

            case TransferInFlowState.RejectComments:
                ShowForm transferRejectCommentBlk = CommonAppBlocks.Instance.CreateTransferRejectCommentShowBlock(this.parentForm, this.transferRejectCommentFormAction);
                if (!transferRejectCommentBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Transfer Reject Comment Block");
                }
                break;

            case TransferInFlowState.CancelFlow:
                dSession.ClearLoggedInUser();
                dSession.Transfers = new List <TransferVO>(1)
                {
                    new TransferVO()
                };
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case TransferInFlowState.ExitFlow:
                break;

            default:
                throw new ApplicationException("Invalid change retail price flow state");
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for CustomerHoldFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            CustomerHoldFlowState inputState = (CustomerHoldFlowState)inputData;

            switch (inputState)
            {
            case CustomerHoldFlowState.LookupCustomer:
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case CustomerHoldFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case CustomerHoldFlowState.CustomerHoldList:
                ShowForm custHoldListBlk = CommonAppBlocks.Instance.CreateCustomerHoldListShowBlock(this.parentForm, this.custHoldListFormNavAction);
                if (!custHoldListBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Customer Hold List block");
                }
                break;

            case CustomerHoldFlowState.CustomerHoldInfo:
                ShowForm custHoldInfoBlk = CommonAppBlocks.Instance.CreateCustomerHoldInfoShowBlock(this.parentForm, this.custHoldInfoFormNavAction);
                if (!custHoldInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Customer Hold List block");
                }
                break;


            case CustomerHoldFlowState.Cancel:

                //Clear the customer from session
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


            default:
                throw new ApplicationException("Invalid Customer Hold flow state");
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            var inputState = NewPawnLoanFlowState.LookupCustomer;

            if (inputData == null && !GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.DESCRIBEMERCHANDISE))
            {
                if (GlobalDataAccessor.Instance.DesktopSession.TabStateClicked != FlowTabController.State.None)
                {
                    inputState = NewPawnLoanFlowState.InvokePawnCustInformationFlow;
                }
                else if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber) &&
                         GlobalDataAccessor.Instance.DesktopSession.TabStateClicked == FlowTabController.State.None)
                {
                    IsGunMerchandiseLookedUp lookupGunMdseFxn = CommonAppBlocks.Instance.IsGunMerchandiseLookedUpBlock;
                    lookupGunMdseFxn.execute();
                    inputState = lookupGunMdseFxn.Value ? NewPawnLoanFlowState.ManagePawnApplication : NewPawnLoanFlowState.InvokeMMPIChildFlow;
                }
            }
            else if (inputData != null)
            {
                inputState = (NewPawnLoanFlowState)inputData;
                if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber) &&
                    GlobalDataAccessor.Instance.DesktopSession.TabStateClicked == FlowTabController.State.None && GlobalDataAccessor.Instance.DesktopSession.StartNewPawnLoan)
                {
                    inputState = NewPawnLoanFlowState.InvokeMMPIChildFlow;
                }
            }
            //If the trigger is describe merchandise for a new pawn loan invoke mmpi flow
            if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.DESCRIBEMERCHANDISE))
            {
                if (inputState == NewPawnLoanFlowState.LookupCustomer)
                {
                    //If merchandise is already looked up then we are looking to lookup customer
                    IsLoanMerchandiseLookedUp lookupMdseFxn = CommonAppBlocks.Instance.IsLoanMerchandiseLookedUpBlock;
                    lookupMdseFxn.execute();
                    //Check if tab state is null..if it is not null then pawncustinfo flow should be invoked
                    if (GlobalDataAccessor.Instance.DesktopSession.TabStateClicked != FlowTabController.State.None)
                    {
                        inputState = NewPawnLoanFlowState.InvokePawnCustInformationFlow;
                    }
                    else if (lookupMdseFxn.Value && (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer == null || string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber)))
                    {
                        inputState = NewPawnLoanFlowState.LookupCustomer;
                    }
                    else
                    {
                        IsGunMerchandiseLookedUp lookupGunMdseFxn = CommonAppBlocks.Instance.IsGunMerchandiseLookedUpBlock;
                        lookupGunMdseFxn.execute();
                        if (lookupGunMdseFxn.Value)
                        {
                            inputState = NewPawnLoanFlowState.ManagePawnApplication;
                        }
                        else
                        {
                            inputState = NewPawnLoanFlowState.InvokeMMPIChildFlow;
                        }
                    }
                }
            }
            else
            {
                //If the customer is already looked up go straight to manage pawn application
                IsCustomerLookedUp lookupFxn = CommonAppBlocks.Instance.IsCustomerLookedUpBlock;
                lookupFxn.execute();

                if (lookupFxn.Value == true && inputState == NewPawnLoanFlowState.LookupCustomer)
                {
                    inputState = NewPawnLoanFlowState.ManagePawnApplication;
                }
            }

            switch (inputState)
            {
            case NewPawnLoanFlowState.LookupCustomer:

                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case NewPawnLoanFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case NewPawnLoanFlowState.AddCustomer:
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.NEWPAWNLOAN, StringComparison.OrdinalIgnoreCase))
                {
                    ShowForm manageCustBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                    if (!manageCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Manage Pawn Application block");
                    }
                }
                else
                {
                    ShowForm createCustBlk = CommonAppBlocks.Instance.CreateCreateCustomerBlock(this.parentForm, this.createCustomerFormNavAction);
                    if (!createCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute CreateCustomer block");
                    }
                }
                break;

            case NewPawnLoanFlowState.ExistingCustomer:
                ShowForm existCustBlk = CommonAppBlocks.Instance.CreateExistingCustomerBlock(this.parentForm, this.existCustomerFormNavAction);
                if (!existCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ExistingCustomer block");
                }
                break;

            case NewPawnLoanFlowState.ManagePawnApplication:
                ShowForm managePawnAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!managePawnAppBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ManagePawnApplication block");
                }
                break;

            case NewPawnLoanFlowState.ViewCustomerInformation:
                ShowForm viewCustInfoBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View Customer Information block");
                }

                break;

            case NewPawnLoanFlowState.ViewReadOnlyCustomerInformation:
                ShowForm viewCustInfoReadOnlyBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoReadOnlyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information Read Only block");
                }
                ((ViewCustomerInformation)viewCustInfoReadOnlyBlk.ClassForm).ShowReadOnly = true;
                break;

            case NewPawnLoanFlowState.InvokeMMPIChildFlow:
                //Initiate the child workflow
                if (GlobalDataAccessor.Instance.DesktopSession.PawnLoans.Count == 0)
                {
                    GlobalDataAccessor.Instance.DesktopSession.PawnLoans.Add(new PawnLoan());
                }
                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(MMPIFUNCTIONALITYNAME,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case NewPawnLoanFlowState.InvokePawnCustInformationFlow:

                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(PAWNCUSTINFOFLOW,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case NewPawnLoanFlowState.CancelFlow:
                CommonAppBlocks.Instance.HideFlowTabController();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case NewPawnLoanFlowState.ExitFlow:
                break;

            default:
                throw new ApplicationException("Invalid new pawn loan flow state");
            }

            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Main execution function for ChangeRetailPriceFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            ChangeRetailPriceFlowState inputState = (ChangeRetailPriceFlowState)inputData;

            switch (inputState)
            {
            case ChangeRetailPriceFlowState.ItemSearch:
                if (GlobalDataAccessor.Instance.DesktopSession.ActiveRetail == null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(new SaleVO());
                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = 0;
                }
                ChangeRetailPriceSearch itemSearchFrm = new ChangeRetailPriceSearch(GlobalDataAccessor.Instance.DesktopSession);
                Form currForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(itemSearchFrm);
                if (currForm.GetType() == typeof(ChangeRetailPriceSearch))
                {
                    currForm.Show();
                }
                else
                {
                    ShowForm itemSearchBlk = CommonAppBlocks.Instance.CreateChangeRetailPriceSearchShowBlock(this.parentForm, this.itemSearchFormNavAction);
                    if (!itemSearchBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Change Retail Price Search block");
                    }
                }

                break;

            case ChangeRetailPriceFlowState.DescribeItem:
                //Show describe item form as show dialog
                int  iItemIdx      = GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex;
                int  iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx].CategoryCode);
                var  dmPawnItem    = new DescribedMerchandise(iCategoryMask);
                Item pawnItem      = GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.RetailItems[iItemIdx];
                Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true);
                ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items.Insert(0, pawnItem);
                // End GetCat5 populate
                // Placeholder for ReadOnly DescribedItem.cs

                GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext = CurrentContext.CHANGE_RETAIL_PRICE;
                var describeItemBlk = CommonAppBlocks.Instance.DescribeItemChangeRetailPriceBlock(this.parentForm, this.describeItemFormAction, ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items[0].SelectedProKnowMatch);
                if (!describeItemBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item Block");
                }
                break;

            case ChangeRetailPriceFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case ChangeRetailPriceFlowState.ExitFlow:
                break;

            default:
                throw new ApplicationException("Invalid change retail price flow state");
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = FindStateByTabClicked();
            }



            PawnCustInformationFlowState inputState = (PawnCustInformationFlowState)inputData;

            switch (inputState)
            {
            case PawnCustInformationFlowState.ViewReadOnlyCustomerInformation:

                ShowForm viewCustInfoReadOnlyBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustFormNavAction);
                if (!viewCustInfoReadOnlyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information block");
                }
                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, viewCustInfoReadOnlyBlk.ClassForm, FlowTabController.State.Customer);
                SetTabsInForm();
                ((ViewCustomerInformation)viewCustInfoReadOnlyBlk.ClassForm).ShowReadOnly = true;
                break;

            case PawnCustInformationFlowState.ViewCustomerInformation:

                ShowForm viewCustInfoBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustFormNavAction);
                if (!viewCustInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information block");
                }
                LoadCustomerLoanKeys loanKeysBlk = new LoadCustomerLoanKeys();
                if (!loanKeysBlk.execute())
                {
                    throw new ApplicationException("Cannot get Loan keys for selected customer");
                }

                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, viewCustInfoBlk.ClassForm, FlowTabController.State.Customer);
                break;

            case PawnCustInformationFlowState.ViewPawnCustomerProductDetails:
                //If form already there in session then show that else open a new one
                Controller_ProductServices productServFrm = new Controller_ProductServices();
                Form currentForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(productServFrm);
                if (currentForm.GetType() == typeof(Controller_ProductServices))
                {
                    currentForm.Show();
                    currentForm.Activate();
                    CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, currentForm, FlowTabController.State.ProductsAndServices);
                    if (GlobalDataAccessor.Instance.DesktopSession.PickupProcessContinue)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.LockProductsTab           = true;
                        ((Controller_ProductServices)currentForm).NavControlBox.IsCustom     = true;
                        ((Controller_ProductServices)currentForm).NavControlBox.CustomDetail = "LoanService";
                        ((Controller_ProductServices)currentForm).NavControlBox.Action       = NavBox.NavAction.SUBMIT;
                        ((Controller_ProductServices)currentForm).ContinuePickup             = true;
                    }
                }
                else
                {
                    //Get the loan keys for the selected customer
                    //Before calling view pawn cust prod details
                    LoadCustomerLoanKeys loanKeysDataBlk = new LoadCustomerLoanKeys();
                    if (!loanKeysDataBlk.execute())
                    {
                        throw new ApplicationException("Cannot get Loan keys for selected customer");
                    }

                    ShowForm pawnCustProdDetBlk =
                        CommonAppBlocks.Instance.CreateProductServicesBlock(this.parentForm,
                                                                            this.productServicesFormNavAction);
                    if (!pawnCustProdDetBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute View Pawn Customer Product Details block");
                    }

                    CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, pawnCustProdDetBlk.ClassForm,
                                                                   FlowTabController.State.ProductsAndServices);
                }

                break;

            case PawnCustInformationFlowState.ViewPawnCustomerStats:

                ShowForm pawnCustStatsBlk = CommonAppBlocks.Instance.CreateStatsBlock(this.parentForm, this.productStatsFormNavAction);
                if (!pawnCustStatsBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View Pawn Customer Stats block");
                }
                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, pawnCustStatsBlk.ClassForm, FlowTabController.State.Stats);
                SetTabsInForm();
                break;

            case PawnCustInformationFlowState.ItemHistory:
                ShowForm itemHistBlk = CommonAppBlocks.Instance.CreateItemHistoryShowBlock(this.parentForm, this.itemHistoryFormNavAction);
                if (!itemHistBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Item History block");
                }
                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, itemHistBlk.ClassForm, FlowTabController.State.ItemHistory);
                SetTabsInForm();
                break;

            case PawnCustInformationFlowState.ProductHistory:
                ShowForm prodHistBlk = CommonAppBlocks.Instance.CreateProductHistoryShowBlock(this.parentForm, this.productHistoryFormNavAction);
                if (!prodHistBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Product History block");
                }
                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, prodHistBlk.ClassForm, FlowTabController.State.ProductHistory);
                SetTabsInForm();
                break;

            case PawnCustInformationFlowState.ViewReceipt:
                ViewReceipt receiptForm = new ViewReceipt();
                Form        recptForm   = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(receiptForm);
                if (recptForm.GetType() == typeof(ViewReceipt))
                {
                    recptForm.BringToFront();
                }
                else
                {
                    ShowForm viewReceiptBlk =
                        CommonAppBlocks.Instance.CreateViewReceiptBlock(
                            this.parentForm, this.viewReceiptFormNavAction);
                    if (!viewReceiptBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute view receipt block");
                    }
                }
                break;

            case PawnCustInformationFlowState.InvokeMMPIChildFlow:
                //Initiate the child workflow
                CommonAppBlocks.Instance.HideFlowTabController();
                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(MMPIFUNCTIONALITYNAME,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case PawnCustInformationFlowState.ManagePawnApplication:
                ShowForm managePawnAppBlock = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!managePawnAppBlock.execute())
                {
                    throw new ApplicationException("Cannot execute Manage Pawn Applicaction block");
                }
                break;

            case PawnCustInformationFlowState.ExistingCustomer:
                ShowForm existCustBlk = CommonAppBlocks.Instance.CreateExistingCustomerBlock(this.parentForm, this.existCustomerFormNavAction);
                if (!existCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ExistingCustomer block");
                }
                break;

            case PawnCustInformationFlowState.TenderIn:
                ShowForm tenderInBlk = CommonAppBlocks.Instance.TenderInShowBlock(this.parentForm, this.TenderInFormAction);
                if (!tenderInBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Tender In block");
                }


                break;


            case PawnCustInformationFlowState.CancelFlow:
                CommonAppBlocks.Instance.HideFlowTabController();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case PawnCustInformationFlowState.ExitFlow:
                if (parentFlow != null)
                {
                    this.parentFlow.execute();
                }
                break;

            default:
                throw new ApplicationException("Invalid Pawn Cust Information flow state");
            }

            return(true);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Main execution function for NewPawnLoanFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }

            PurchaseReturnFlowState inputState = (PurchaseReturnFlowState)inputData;

            switch (inputState)
            {
            case PurchaseReturnFlowState.BuyReturn:
                ShowForm buyReturnFrmBlk = CommonAppBlocks.Instance.BuyReturnFormBlock(this.parentForm, this.buyReturnFormNavAction);
                if (!buyReturnFrmBlk.execute())
                {
                    throw new ApplicationException("Cannot show Buy Return form");
                }
                break;

            case PurchaseReturnFlowState.BuyReturnItems:
                ShowForm buyReturnItemBlk = CommonAppBlocks.Instance.BuyReturnItemsFormBlock(this.parentForm, this.buyReturnItemsFormNavAction);
                if (!buyReturnItemBlk.execute())
                {
                    throw new ApplicationException("Cannot show Return Items form");
                }

                break;

            case PurchaseReturnFlowState.CancelFlow:
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();
                GlobalDataAccessor.Instance.DesktopSession.ClearSessionData();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case PurchaseReturnFlowState.ManagePawnApplication:
                ShowForm managePawnAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!managePawnAppBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ManagePawnApplication block");
                }
                break;

            case PurchaseReturnFlowState.FinalGunSubmit:
                var backgroundcheckFrm = new FirearmsBackgroundCheck();
                backgroundcheckFrm.ShowDialog(null);

                if (GlobalDataAccessor.Instance.DesktopSession.BackgroundCheckCompleted)
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop();
                    GlobalDataAccessor.Instance.DesktopSession.showProcessTender(ProcessTenderProcedures.ProcessTenderMode.RETURNBUY);
                }
                break;

            case PurchaseReturnFlowState.ShowVendor:

                ShowForm createVendBlk = CommonAppBlocks.Instance.CreateCreateVendorBlock(this.parentForm, this.createVendFormNavAction);
                if (!createVendBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Show Vendor block");
                }
                break;
            }


            return(true);
        }
        /// <summary>
        /// Main execution function for PoliceHoldReleaseFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            PoliceSeizeFlowState inputState = (PoliceSeizeFlowState)inputData;

            switch (inputState)
            {
            case PoliceSeizeFlowState.LookupCustomer:
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case PoliceSeizeFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case PoliceSeizeFlowState.PoliceHoldList:
                ShowForm loansListBlk = CommonAppBlocks.Instance.CreatePoliceHoldListShowBlock(this.parentForm, this.policeHoldListFormNavAction);
                ((PoliceHoldsList)loansListBlk.ClassForm).PoliceSeize = true;
                if (!loansListBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Loan List block");
                }

                break;

            case PoliceSeizeFlowState.PoliceSeize:
                ShowForm policeSeizeBlk = CommonAppBlocks.Instance.CreatePoliceHoldReleaseInfoShowBlock(this.parentForm, this.policeHoldReleaseInfoFormNavAction);
                //Set the police seize property to true
                ((PoliceHoldRelease)policeSeizeBlk.ClassForm).PoliceSeize = true;
                if (!policeSeizeBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Police Seize block");
                }


                break;

            case PoliceSeizeFlowState.Cancel:
                //Clear the customer from session
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;


            default:
                throw new ApplicationException("Invalid Police Seize flow state");
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for PFIVerify Flow Executor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                return(false);
            }
            PFIVerifyFlowState inputState = (PFIVerifyFlowState)inputData;

            switch (inputState)
            {
            case PFIVerifyFlowState.PfiVerify:

                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup("PFI_Verify"))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.VisibleForm("PFI_Verify");
                }
                else
                {
                    ShowForm pfiVerifyBlk = CommonAppBlocks.Instance.PFIVerifyBlock(this.parentForm, this.PFIVerifyFormNavFunction);
                    if (!pfiVerifyBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute PFI Verify block");
                    }
                }
                break;

            case PFIVerifyFlowState.DescribeMerchandise:
                ShowForm describeMerchBlk = CommonAppBlocks.Instance.DescribeMerchandiseBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise block");
                }

                break;

            case PFIVerifyFlowState.DescribeMerchandisePFIMerge:
                ShowForm describeMerchandiseBlk = CommonAppBlocks.Instance.DescribeMerchandisePFIMergeBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchandiseBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise PFI Merge block");
                }

                break;

            case PFIVerifyFlowState.DescribeMerchandisePFIAdd:
                ShowForm describeMerchandiseAddBlk = CommonAppBlocks.Instance.DescribeMerchandisePFIAddBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchandiseAddBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise PFI Add block");
                }

                break;

            case PFIVerifyFlowState.DescribeMerchandisePFIReplace:
                ShowForm describeMerchandiseReplaceBlk = CommonAppBlocks.Instance.DescribeMerchandisePFIReplaceBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchandiseReplaceBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise PFI Replace block");
                }

                break;

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

            case PFIVerifyFlowState.DescribeItemPFI:
                ShowForm describeItemPFIBlk = CommonAppBlocks.Instance.DescribeItemPFIBlock(this.parentForm, this.describeItemFormAction);
                if (!describeItemPFIBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Item PFI Block");
                }
                break;

            case PFIVerifyFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;
            }


            return(true);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Main execution function for CustomerPurchaseFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            PurchaseFlowState inputState = (PurchaseFlowState)inputData;
            //If the customer is already looked up go straight to manage pawn application
            IsCustomerLookedUp lookupFxn = CommonAppBlocks.Instance.IsCustomerLookedUpBlock;

            lookupFxn.execute();

            if (inputState == PurchaseFlowState.LookupCustomer && GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(DESCRIBEITEMTRIGGER, StringComparison.OrdinalIgnoreCase))
            {
                //If merchandise is already looked up then we are looking to lookup customer
                IsBuyMerchandiseLookedUp lookupMdseFxn = CommonAppBlocks.Instance.IsBuyMerchandiseLookedUpBlock;
                lookupMdseFxn.execute();

                inputState = lookupMdseFxn.Value ? PurchaseFlowState.LookupCustomer : PurchaseFlowState.InvokeMMPIChildFlow;
            }

            switch (inputState)
            {
            case PurchaseFlowState.LookupCustomer:
                GlobalDataAccessor.Instance.DesktopSession.DescribeItemContext = CurrentContext.NEW;
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case PurchaseFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case PurchaseFlowState.AddCustomer:
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.NEWPAWNLOAN, StringComparison.OrdinalIgnoreCase))
                {
                    ShowForm manageCustBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                    if (!manageCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Manage Pawn Application block");
                    }
                }
                else
                {
                    ShowForm createCustBlk = CommonAppBlocks.Instance.CreateCreateCustomerBlock(this.parentForm, this.createCustomerFormNavAction);
                    if (!createCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute CreateCustomer block");
                    }
                }
                break;

            case PurchaseFlowState.ExistingCustomer:
                ShowForm existCustBlk = CommonAppBlocks.Instance.CreateExistingCustomerBlock(this.parentForm, this.existCustomerFormNavAction);
                if (!existCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ExistingCustomer block");
                }
                break;

            case PurchaseFlowState.ManagePawnApplication:
                ShowForm managePawnAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!managePawnAppBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ManagePawnApplication block");
                }
                break;

            case PurchaseFlowState.ViewCustomerInformation:
                ShowForm viewCustInfoBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View Customer Information block");
                }

                break;

            case PurchaseFlowState.ViewReadOnlyCustomerInformation:
                ShowForm viewCustInfoReadOnlyBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoReadOnlyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information Read Only block");
                }
                ((ViewCustomerInformation)viewCustInfoReadOnlyBlk.ClassForm).ShowReadOnly = true;
                break;

            case PurchaseFlowState.InvokeMMPIChildFlow:
                //Initiate the child workflow
                if (GlobalDataAccessor.Instance.DesktopSession.ActivePurchase == null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Purchases.Add(new PurchaseVO());
                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = -1;
                }
                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(MMPIFUNCTIONALITYNAME,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case PurchaseFlowState.CancelFlow:
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case PurchaseFlowState.ExitFlow:
                break;

            default:
                throw new ApplicationException("Invalid customer purchase flow state");
            }

            return(true);
        }
        /// <summary>
        /// Main execution function for SaleFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = suspendedState;
            }
            SaleFlowState inputState = (SaleFlowState)inputData;

            switch (inputState)
            {
            case SaleFlowState.ItemSearch:
                if (GlobalDataAccessor.Instance.DesktopSession.ActiveRetail == null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(new SaleVO());
                    GlobalDataAccessor.Instance.DesktopSession.DescribeItemPawnItemIndex = -1;
                }
                //ItemSearch itemSearchFrm = new ItemSearch();
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.HasFormName("ItemSearch"))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.VisibleForm("ItemSearch");
                }
                else
                {
                    ShowForm itemSearchBlk = CommonAppBlocks.Instance.CreateItemSearchShowBlock(this.parentForm, this.itemSearchFormNavAction);
                    if (!itemSearchBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Item Search block");
                    }
                }

                break;

            case SaleFlowState.DescribeMerchandise:
                ShowForm describeMerchBlk = CommonAppBlocks.Instance.DescribeMerchandiseBlock(this.parentForm, this.describeMerchFormAction);
                if (!describeMerchBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Describe Merchandise block");
                }

                break;

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

            case SaleFlowState.LookupCustomer:

                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case SaleFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case SaleFlowState.LookupVendorResults:
                ShowForm lookupVendResBlk = CommonAppBlocks.Instance.CreateLookupVendorResultsBlock(this.parentForm, this.lookupVendResultsFormNavAction);
                if (!lookupVendResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupVendorResults block");
                }
                break;

            case SaleFlowState.AddCustomer:
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.NEWPAWNLOAN, StringComparison.OrdinalIgnoreCase))
                {
                    ShowForm manageCustBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                    if (!manageCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Manage Pawn Application block");
                    }
                }
                else
                {
                    ShowForm createCustBlk = CommonAppBlocks.Instance.CreateCreateCustomerBlock(this.parentForm, this.createCustomerFormNavAction);
                    if (!createCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute CreateCustomer block");
                    }
                }
                break;

            case SaleFlowState.AddVendor:

                ShowForm createVendBlk = CommonAppBlocks.Instance.CreateCreateVendorBlock(this.parentForm, this.createVendFormNavAction);
                if (!createVendBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Create Vendor block");
                }
                break;

            case SaleFlowState.ExistingCustomer:
                ShowForm existCustBlk = CommonAppBlocks.Instance.CreateExistingCustomerBlock(this.parentForm, this.existCustomerFormNavAction);
                if (!existCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ExistingCustomer block");
                }
                break;

            case SaleFlowState.ManagePawnApplication:
                ShowForm managePawnAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!managePawnAppBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ManagePawnApplication block");
                }
                break;

            case SaleFlowState.ViewCustomerInformation:
                ShowForm viewCustInfoBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View Customer Information block");
                }

                break;

            case SaleFlowState.ViewReadOnlyCustomerInformation:
                ShowForm viewCustInfoReadOnlyBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustInfoFormNavAction);
                if (!viewCustInfoReadOnlyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information Read Only block");
                }
                ((ViewCustomerInformation)viewCustInfoReadOnlyBlk.ClassForm).ShowReadOnly = true;
                break;

            case SaleFlowState.TenderIn:
                if (this.tenderInComplete)
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop();
                    if (GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.LoanStatus == ProductStatus.LAY)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.showProcessTender(ProcessTenderProcedures.ProcessTenderMode.LAYAWAY);
                    }
                    else
                    {
                        ProcessTenderController pCntrl = ProcessTenderController.Instance;
                        //Perform the process tender process
                        bool success = pCntrl.ExecuteProcessTender(ProcessTenderProcedures.ProcessTenderMode.RETAILSALE);
                        if (success)
                        {
                            ReceiptConfirmation rcptConf = new ReceiptConfirmation();
                            rcptConf.ShowDialog();
                        }
                        else
                        {
                            goto case SaleFlowState.CancelFlow;
                        }
                    }

                    goto case SaleFlowState.CancelFlow;
                }
                else
                {
                    if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup("TenderIn"))
                    {
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.VisibleForm("TenderIn");
                    }
                    else
                    {
                        ShowForm tenderInBlk = CommonAppBlocks.Instance.TenderInShowBlock(this.parentForm, this.TenderInFormAction);
                        if (!tenderInBlk.execute())
                        {
                            throw new ApplicationException("Cannot execute Tender In block");
                        }
                    }
                }

                break;

            case SaleFlowState.CancelFlow:
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();
                GlobalDataAccessor.Instance.DesktopSession.ClearLoggedInUser();
                GlobalDataAccessor.Instance.DesktopSession.ClearSessionData();
                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;

            case SaleFlowState.ExitFlow:
                break;

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

            return(true);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Main execution function for LookupCustomerFlowExecutor
        /// </summary>
        /// <param name="inputData"></param>
        /// <returns></returns>
        private object executorFxn(object inputData)
        {
            if (inputData == null)
            {
                inputData = LookupCustomerFlowState.LookupCustomer;
            }
            LookupCustomerFlowState inputState = (LookupCustomerFlowState)inputData;

            if (GlobalDataAccessor.Instance.DesktopSession.StartNewPawnLoan)
            {
                inputState = LookupCustomerFlowState.NewPawnLoanFlow;
            }

            switch (inputState)
            {
            case LookupCustomerFlowState.LookupCustomer:
                ShowForm lookupCustBlk = CommonAppBlocks.Instance.CreateLookupCustomerShowBlock(this.parentForm, this.lookupCustFormNavAction);
                if (!lookupCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomer block");
                }

                break;

            case LookupCustomerFlowState.LookupCustomerResults:
                ShowForm lookupCustResBlk = CommonAppBlocks.Instance.CreateLookupCustomerResultsBlock(this.parentForm, this.lookupCustResultsFormNavAction);
                if (!lookupCustResBlk.execute())
                {
                    throw new ApplicationException("Cannot execute LookupCustomerResults block");
                }
                break;

            case LookupCustomerFlowState.AddCustomer:
                //not sure how this trigger will be set
                if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger.Equals(Commons.TriggerTypes.MANAGEITEMRELEASE, StringComparison.OrdinalIgnoreCase))
                {
                    CreateCustomer createCustFrm = new CreateCustomer();
                    Form           currForm      = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(createCustFrm);
                    if (currForm.GetType() == typeof(CreateCustomer))
                    {
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                    }
                    else
                    {
                        ShowForm createCustBlk = CommonAppBlocks.Instance.CreateCreateCustomerBlock(this.parentForm, this.createCustFormNavAction);
                        if (!createCustBlk.execute())
                        {
                            throw new ApplicationException("Cannot execute Create Customer block");
                        }
                    }
                }
                else     //if (CashlinxDesktopSession.Instance.HistorySession.Trigger.Equals("newpawnloan", StringComparison.OrdinalIgnoreCase))
                {
                    ShowForm manageCustBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                    if (!manageCustBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Manage Pawn Application block");
                    }
                }


                break;

            case LookupCustomerFlowState.ManagePawnApplication:
                ShowForm manageCustAppBlk = CommonAppBlocks.Instance.CreateManagePawnApplicationBlock(this.parentForm, this.managePawnAppFormNavAction);
                if (!manageCustAppBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Manage Pawn Application block");
                }
                break;

            case LookupCustomerFlowState.ExistingCustomer:
                ShowForm existCustBlk = CommonAppBlocks.Instance.CreateExistingCustomerBlock(this.parentForm, this.existCustomerFormNavAction);
                if (!existCustBlk.execute())
                {
                    throw new ApplicationException("Cannot execute ExistingCustomer block");
                }
                break;


            case LookupCustomerFlowState.ViewPawnCustomerInfoReadOnly:
                ShowForm viewCustInfoReadOnlyBlk = CommonAppBlocks.Instance.ViewCustomerInfoShowBlock(this.parentForm, this.viewCustFormNavAction);
                if (!viewCustInfoReadOnlyBlk.execute())
                {
                    throw new ApplicationException("Cannot execute View customer information block");
                }
                CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, viewCustInfoReadOnlyBlk.ClassForm, FlowTabController.State.Customer);
                CommonAppBlocks.Instance.HideTabInFlowTab(FlowTabController.State.ItemHistory);
                CommonAppBlocks.Instance.HideTabInFlowTab(FlowTabController.State.ProductsAndServices);
                CommonAppBlocks.Instance.HideTabInFlowTab(FlowTabController.State.ProductHistory);
                CommonAppBlocks.Instance.HideTabInFlowTab(FlowTabController.State.Stats);
                ((ViewCustomerInformation)viewCustInfoReadOnlyBlk.ClassForm).ShowReadOnly = true;
                break;


            case LookupCustomerFlowState.UpdateAddress:
                UpdateAddress addrFrm        = new UpdateAddress();
                Form          currentaddForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(addrFrm);
                if (currentaddForm.GetType() == typeof(UpdateAddress))
                {
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    ShowForm updateAddrBlk = CommonAppBlocks.Instance.UpdateAddressShowFormBlock(this.parentForm, this.updateAddressFormNavAction);
                    if (!updateAddrBlk.execute())
                    {
                        throw new ApplicationException("Cannot execute Update Addess Form block");
                    }
                }

                break;

            case LookupCustomerFlowState.UpdatePhysicalDescription:

                ShowForm updatePhysDescBlk = CommonAppBlocks.Instance.UpdatePhysDescShowFormBlock(this.parentForm, this.updatePhysicalDescFormNavAction);
                if (!updatePhysDescBlk.execute())
                {
                    throw new ApplicationException("Cannot execute Update Physical Description block");
                }


                break;

            case LookupCustomerFlowState.PawnCustInformation:
                //Initiate the child workflow
                GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.None;
                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(PAWNCUSTINFOFLOW,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case LookupCustomerFlowState.NewPawnLoanFlow:
                //Initiate the child workflow for new pawn loan
                GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.None;
                GlobalDataAccessor.Instance.DesktopSession.AppController.invokeWorkflow(NEWPAWNLOANFLOW,
                                                                                        this.parentForm, this.endStateNotifier, this);
                break;

            case LookupCustomerFlowState.Cancel:
                CommonAppBlocks.Instance.HideFlowTabController();

                if (this.endStateNotifier != null)
                {
                    this.endStateNotifier.execute();
                }
                break;
            }

            return(true);
        }