Example #1
0
        /// <summary>
        /// NavBox OnAction Handler for View Receipt
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="data"></param>
        private void viewReceiptFormNavAction(object sender, object data)
        {
            if (sender == null || data == null)
            {
                throw new ApplicationException("Lookup receipt form navigation action handler received invalid data");
            }

            NavBox      viewReceiptNavBox = (NavBox)sender;
            ViewReceipt viewReceiptForm   = (ViewReceipt)data;

            NavBox.NavAction viewAction = viewReceiptNavBox.Action;

            switch (viewAction)
            {
            case NavBox.NavAction.CANCEL:
                this.nextState = LookupReceiptFlowState.ExitFlow;
                break;

            case NavBox.NavAction.SUBMIT:
                this.nextState = LookupReceiptFlowState.ExitFlow;
                break;
            }

            this.executeNextState();
        }
        private async void Button_Click_View_Receipt(object sender, RoutedEventArgs e)
        {
            var ViewReceipt = new ViewReceipt();
            await DialogHost.Show(ViewReceipt, "RootDialog");

            if (cashInUpdate.isUpdate)
            {
                await DialogHost.Show(new UpdateTransaction(), "RootDialog");

                cashInUpdate.isUpdate = false;

                Button_Click_View_Receipt(null, null);
            }
        }
        /// <summary>
        /// NavBox OnAction Handler for View Receipt
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="data"></param>
        private void viewReceiptFormNavAction(object sender, object data)
        {
            if (sender == null || data == null)
            {
                throw new ApplicationException("View receipt form navigation action handler received invalid data");
            }

            NavBox      viewReceiptNavBox = (NavBox)sender;
            ViewReceipt viewReceiptForm   = (ViewReceipt)data;

            NavBox.NavAction viewAction = viewReceiptNavBox.Action;
            GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
            switch (viewAction)
            {
            case NavBox.NavAction.CANCEL:

                if (viewReceiptNavBox.IsCustom)
                {
                    string custDet = viewReceiptNavBox.CustomDetail;
                    if (custDet.Equals("Back", StringComparison.OrdinalIgnoreCase))
                    {
                        return;
                    }
                    else
                    {
                        this.nextState = PawnCustInformationFlowState.CancelFlow;
                    }
                }
                else
                {
                    this.nextState = PawnCustInformationFlowState.CancelFlow;
                }
                break;

            case NavBox.NavAction.SUBMIT:
                //this.nextState = PawnCustInformationFlowState.ViewReceipt;
                //The products and services page needs to be reloaded
                //so another back to remove it from session
                GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                this.nextState = PawnCustInformationFlowState.ViewPawnCustomerProductDetails;
                break;
            }

            this.executeNextState();
        }
        /// <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);
        }