/// <summary> /// Action class for LookupVendorResults /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void lookupVendResultsFormNavAction(object sender, object data) { if (sender == null || data == null) { throw new ApplicationException("Lookup Vendor form navigation action handler received invalid data"); } NavBox lookupVendResNavBox = (NavBox)sender; NavBox.NavAction action = lookupVendResNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } ItemSearch itemSearchFrm = new ItemSearch(); Form currForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(itemSearchFrm); if (currForm.GetType() == typeof(ItemSearch)) { currForm.Hide(); } TenderIn tenderInFrm = new TenderIn(); currForm = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Lookup(tenderInFrm); if (currForm.GetType() == typeof(TenderIn)) { currForm.Hide(); } switch (action) { case NavBox.NavAction.SUBMIT: if (lookupVendResNavBox.IsCustom) { string custDet = lookupVendResNavBox.CustomDetail; //Look for add customer if (custDet.Equals("CreateVendor")) { this.nextState = SaleFlowState.AddVendor; } } break; case NavBox.NavAction.BACK: GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); this.nextState = SaleFlowState.LookupCustomer; break; case NavBox.NavAction.CANCEL: this.nextState = SaleFlowState.CancelFlow; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for LookupVendorResults"); } this.executeNextState(); }
private void TenderInFormAction(object sender, object data) { if (sender == null || data == null) { throw new ApplicationException("Tender In form navigation action handler received invalid data"); } NavBox tenderNavBox = (NavBox)sender; TenderIn tenderForm = (TenderIn)data; NavBox.NavAction action = tenderNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: if (tenderNavBox.IsCustom) { string custDet = tenderNavBox.CustomDetail; if (custDet.Equals("ProcessTender")) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop(); if (GlobalDataAccessor.Instance.DesktopSession.ActiveRetail.LoanStatus == ProductStatus.LAY) { GlobalDataAccessor.Instance.DesktopSession.showProcessTender(ProcessTenderProcedures.ProcessTenderMode.LAYAWAY); } else { var pCntrl = ProcessTenderController.Instance; //Perform the process tender process bool success = pCntrl.ExecuteProcessTender(ProcessTenderProcedures.ProcessTenderMode.RETAILSALE); if (success) { ReceiptConfirmation rcptConf = new ReceiptConfirmation(); rcptConf.ShowDialog(); } else { this.nextState = SaleFlowState.CancelFlow; } } this.nextState = SaleFlowState.CancelFlow; } else if (custDet.Equals("LookupCustomer")) { this.tenderInComplete = true; this.nextState = SaleFlowState.LookupCustomer; } else { this.nextState = SaleFlowState.CancelFlow; } } else { GlobalDataAccessor.Instance.DesktopSession.CompleteSale = false; GlobalDataAccessor.Instance.DesktopSession.CompleteLayaway = false; this.nextState = SaleFlowState.ItemSearch; } break; case NavBox.NavAction.HIDEANDSHOW: tenderForm.Hide(); if (tenderNavBox.IsCustom) { string custDet = tenderNavBox.CustomDetail; this.nextState = custDet.Equals("LookupCustomer") ? SaleFlowState.LookupCustomer : SaleFlowState.CancelFlow; } break; case NavBox.NavAction.CANCEL: this.nextState = SaleFlowState.CancelFlow; break; default: throw new ApplicationException("" + action + " is not a valid state for Tender In"); } this.executeNextState(); }