private void btnComplete_Click(object sender, EventArgs e) { bool printFeatures = false; if (chkPrintFeaturesTag.Checked) { printFeatures = true; } Item.PfiTags = Utilities.GetIntegerValue(txtTagsToReprint.Text); try { DesktopSession.PrintTags(Item, printFeatures); this.Hide(); MessageBox.Show("Tag(s) printed successfully."); if (SenderObject == ReprintVerifySender.ChangeRetailPrice) { ChangeRetailPriceSearch itemSearchFrm = new ChangeRetailPriceSearch(DesktopSession); Form currForm = DesktopSession.HistorySession.Lookup(itemSearchFrm); if (currForm.GetType() == typeof(ChangeRetailPriceSearch)) { currForm.Show(); } } this.Close(); } catch (Exception eX) { if (FileLogger.Instance.IsLogError) { FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot re-print tag. Exception thrown: {0} {1}", eX, eX.Message); } MessageBox.Show("Failed to print tag. Please try again."); } }
private void itemSearchFormNavAction(object sender, object data) { NavBox itemSearchNavBox = (NavBox)sender; ChangeRetailPriceSearch itemSearchForm = (ChangeRetailPriceSearch)data; NavBox.NavAction action = itemSearchNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: //Default happy path next state this.parentForm = itemSearchForm; this.nextState = ChangeRetailPriceFlowState.DescribeItem; break; case NavBox.NavAction.CANCEL: this.nextState = ChangeRetailPriceFlowState.CancelFlow; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for ItemSearch"); } this.executeNextState(); }
/// <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); }