/// <summary> /// Action class for LookupCustomerResults /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void lookupCustResultsFormNavAction(object sender, object data) { if (sender == null || data == null) { throw new ApplicationException("Lookup customer form navigation action handler received invalid data"); } NavBox lookupCustResNavBox = (NavBox)sender; LookupCustomerResults lookupCustResForm = (LookupCustomerResults)data; NavBox.NavAction action = lookupCustResNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: if (lookupCustResNavBox.IsCustom) { string custDet = lookupCustResNavBox.CustomDetail; //Look for add customer if (custDet.Equals("CreateCustomer") || custDet.Equals("ManagePawnApplication")) { this.nextState = LookupCustomerFlowState.AddCustomer; } else if (custDet.Equals("Complete")) { GlobalDataAccessor.Instance.DesktopSession.TabStateClicked = FlowTabController.State.None; this.nextState = LookupCustomerFlowState.PawnCustInformation; } else if (custDet.Equals("ViewCustomerInformationReadOnly")) { this.nextState = LookupCustomerFlowState.ViewPawnCustomerInfoReadOnly; } } else { this.nextState = LookupCustomerFlowState.ViewPawnCustomerInfo; LoadCustomerLoanKeys loanKeysBlk = new LoadCustomerLoanKeys(); loanKeysBlk.execute(); } break; case NavBox.NavAction.BACK: GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); this.nextState = LookupCustomerFlowState.LookupCustomer; break; case NavBox.NavAction.CANCEL: this.nextState = LookupCustomerFlowState.Cancel; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for LookupCustomerResults"); } this.executeNextState(); }
/// <summary> /// Action handler for ManagePawnApplication /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void managePawnAppFormNavAction(object sender, object data) { if (sender == null || data == null) { throw new ApplicationException("Manage pawn app form navigation action handler received invalid data"); } NavBox managePawnAppNavBox = (NavBox)sender; ManagePawnApplication managePawnAppForm = (ManagePawnApplication)data; NavBox.NavAction action = managePawnAppNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: string custDet = managePawnAppNavBox.CustomDetail; if (custDet.Equals("ExistingCustomer")) { this.nextState = NewPawnLoanFlowState.ExistingCustomer; } else if (custDet.Equals("DescribeMerchandise")) { LoadCustomerLoanKeys loanKeysDataBlk = new LoadCustomerLoanKeys(); if (!loanKeysDataBlk.execute()) { //throw new ApplicationException("Cannot get Loan keys for selected customer"); MessageBox.Show("An error occurred in getting loan details for the selected customer"); this.nextState = NewPawnLoanFlowState.CancelFlow; } this.nextState = NewPawnLoanFlowState.InvokeMMPIChildFlow; } else { this.nextState = NewPawnLoanFlowState.ExitFlow; } break; case NavBox.NavAction.CANCEL: this.nextState = NewPawnLoanFlowState.CancelFlow; break; case NavBox.NavAction.BACK: GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); this.nextState = NewPawnLoanFlowState.LookupCustomerResults; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for ManagePawnApplication"); } this.executeNextState(); }
private void SetTabsInForm(ShowForm blockName) { if (GlobalDataAccessor.Instance.DesktopSession.HistorySession.FormsInTree() > 1) { if (parentFlow.Name.Equals("NewPawnLoanFlowExecutor", StringComparison.OrdinalIgnoreCase)) { CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, blockName.ClassForm, FlowTabController.State.ProductsAndServices); } else { CommonAppBlocks.Instance.ShowFlowTabController(this.parentForm, blockName.ClassForm, FlowTabController.State.Customer); } if (GlobalDataAccessor.Instance.DesktopSession.ShowOnlyHistoryTabs) { CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.Customer, false); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ProductsAndServices, false); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.Stats, false); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ItemHistory, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ProductHistory, true); } else { CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.Customer, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ProductsAndServices, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.Stats, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ItemHistory, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ProductHistory, true); } if (parentFlow.Name.Equals("NewPawnLoanFlowExecutor", StringComparison.OrdinalIgnoreCase)) { CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.Customer, true); CommonAppBlocks.Instance.SetFlowTabEnabled(FlowTabController.State.ProductsAndServices, false); //Get the loan keys for the selected customer // LoadCustomerLoanKeys loanKeysDataBlk = new LoadCustomerLoanKeys(); if (!loanKeysDataBlk.execute()) { throw new ApplicationException("Cannot get Loan keys for selected customer"); } } } }
/// <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); }