/// <summary> /// The various form actions for describe item form /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void describeItemFormAction(object sender, object data) { if (sender == null || data == null) { throw new ApplicationException("Describe Item form navigation action handler received invalid data"); } NavBox descItemNavBox = (NavBox)sender; DescribeItem descItemForm = (DescribeItem)data; NavBox.NavAction action = descItemNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: if (descItemNavBox.IsCustom) { string custDet = descItemNavBox.CustomDetail; if (custDet.Equals("DescribeMerchandisePFIReplace", StringComparison.OrdinalIgnoreCase)) { this.nextState = PFIVerifyFlowState.DescribeMerchandisePFIReplace; } } break; case NavBox.NavAction.CANCEL: this.nextState = PFIVerifyFlowState.CancelFlow; break; case NavBox.NavAction.BACK: GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back(); if (descItemNavBox.IsCustom) { string custDet = descItemNavBox.CustomDetail; if (custDet.Equals("Back", StringComparison.OrdinalIgnoreCase)) { this.nextState = PFIVerifyFlowState.DescribeMerchandise; } else if (custDet.Equals("BackPFIAdd", StringComparison.OrdinalIgnoreCase)) { this.nextState = PFIVerifyFlowState.DescribeMerchandisePFIAdd; } } else { this.nextState = PFIVerifyFlowState.PfiVerify; } break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for Describe Item"); } this.executeNextState(); }
private void ShowPawnItemDetail(DataGridViewCellMouseEventArgs e) { DataGridViewRow myRow = MerchandiseDataGridView.Rows[e.RowIndex]; if (e.ColumnIndex == 1 && e.RowIndex >= 0) { PawnLoan pawnLoan = GlobalDataAccessor.Instance.DesktopSession.CurrentPawnLoan; string icn = Utilities.GetStringValue(myRow.Cells[ICN.Index].Value, ""); int iDx = pawnLoan.Items.FindIndex(p => p.Icn == icn); if (iDx >= 0) { // Need to populate pawnLoan from GetCat5 int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(pawnLoan.Items[iDx].CategoryCode); DescribedMerchandise dmPawnItem = new DescribedMerchandise(iCategoryMask); Item pawnItem = pawnLoan.Items[iDx]; Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true); pawnLoan.Items.RemoveAt(iDx); pawnLoan.Items.Insert(iDx, pawnItem); // End GetCat5 populate //Add the current loan as the active pawn loan GlobalDataAccessor.Instance.DesktopSession.PawnLoans.Insert(0, pawnLoan); // Placeholder for ReadOnly DescribedItem.cs DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, iDx) { SelectedProKnowMatch = pawnLoan.Items[iDx].SelectedProKnowMatch }; myForm.ShowDialog(this); } } }
private void dataGridViewMdse_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex == 0) { try { string errorMsg; int storeId = Utilities.GetIntegerValue(_storeNumber, 0); PawnLoan custPawnLoan; if (customDataGridViewTransactions.CurrentRow != null) { int ticketNumber = Utilities.GetIntegerValue(customDataGridViewTransactions.CurrentRow.Cells[12].Value); //Send the control back if the ticket number is not valid if (!(ticketNumber > 0)) { return; } string errorCode; bool retValue = HoldsProcedures.GetPawnLoanHolds(storeId, ticketNumber, "0", out custPawnLoan, out errorCode, out errorMsg); if (retValue) { var activePawnLoan = GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan; if (custPawnLoan != null) { //Go to describe item read only view if (custPawnLoan.Items[e.RowIndex].CategoryMask < 1) { // Need to populate pawnLoan from GetCat5 int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask (custPawnLoan.Items[e.RowIndex].CategoryCode); var dmPawnItem = new DescribedMerchandise(iCategoryMask); Item pawnItem = custPawnLoan.Items[e.RowIndex]; Item.PawnItemMerge(ref pawnItem, dmPawnItem.SelectedPawnItem, true); pawnItem.CategoryMask = iCategoryMask; custPawnLoan.Items.RemoveAt(e.RowIndex); custPawnLoan.Items.Insert(e.RowIndex, pawnItem); // End GetCat5 populate } GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan = custPawnLoan; // Call Describe Item Page DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, e.RowIndex) { SelectedProKnowMatch = custPawnLoan.Items[e.RowIndex].SelectedProKnowMatch }; myForm.ShowDialog(this); GlobalDataAccessor.Instance.DesktopSession.ActivePawnLoan = activePawnLoan; } } } } catch (Exception ex) { BasicExceptionHandler.Instance.AddException("Error trying to view details of selected item", new ApplicationException(ex.Message)); this.NavControlBox.Action = NavBox.NavAction.CANCEL; } } }
public ShowForm DescribeItemBlock( Form parentForm, NavBox.NavBoxActionFired fxn, DesktopSession desktopSession) { var descItemFrm = new DescribeItem(desktopSession, AuditDesktopSession.Instance.DescribeItemContext, AuditDesktopSession.Instance.DescribeItemPawnItemIndex); ShowForm describeItemBlk = this.createShowFormBlock( ValidFormBlockTypes.None, parentForm, descItemFrm, descItemFrm.NavControlBox, fxn); return(describeItemBlk); }
private void ShowBuyDetail(DataGridViewCellMouseEventArgs e) { DataGridViewRow myRow = MerchandiseDataGridView.Rows[e.RowIndex]; int itemTicketNumber = GlobalDataAccessor.Instance.DesktopSession.TicketLookedUp; if (e.ColumnIndex == 1 && e.RowIndex >= 0) { var purchases = GlobalDataAccessor.Instance.DesktopSession.Purchases; string icn = Utilities.GetStringValue(myRow.Cells[ICN.Index].Value, ""); var purchaseItems = purchases.SelectMany(purchaseVo => purchaseVo.Items).ToList(); int iDx = purchaseItems.FindIndex(item => item.Icn == icn); if (iDx >= 0) { // Need to populate pawnLoan from GetCat5 int iCategoryMask = GlobalDataAccessor.Instance.DesktopSession.CategoryXML.GetCategoryMask(purchaseItems[iDx].CategoryCode); DescribedMerchandise dmPurchaseItem = new DescribedMerchandise(iCategoryMask); Item purchaseItem = purchaseItems[iDx]; Item.PawnItemMerge(ref purchaseItem, dmPurchaseItem.SelectedPawnItem, true); purchaseItems.RemoveAt(iDx); purchaseItems.Insert(iDx, purchaseItem); PurchaseVO activePurchase = purchases.Find(p => p.TicketNumber == itemTicketNumber); activePurchase.Items = purchaseItems; GlobalDataAccessor.Instance.DesktopSession.ActivePurchase = activePurchase; DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, iDx, true) { SelectedProKnowMatch = purchaseItems[iDx].SelectedProKnowMatch }; myForm.ShowDialog(this); } } }
private void itemSearchFormNavAction(object sender, object data) { NavBox itemSearchNavBox = (NavBox)sender; ItemSearch itemSearchForm = (ItemSearch)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: if (itemSearchNavBox.IsCustom) { string custDet = itemSearchNavBox.CustomDetail; if (custDet.Equals("GetCategory") || custDet.Equals("TemporaryICN")) { itemSearchForm.Hide(); this.nextState = SaleFlowState.DescribeMerchandise; } else if (custDet.Equals("ViewItemDetails")) { //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); DescribedMerchandise 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 DescribeItem myForm = new DescribeItem(GlobalDataAccessor.Instance.DesktopSession, CurrentContext.READ_ONLY, 0) { SelectedProKnowMatch = ((CustomerProductDataVO)GlobalDataAccessor.Instance.DesktopSession.ActiveRetail).Items[0].SelectedProKnowMatch }; myForm.ShowDialog(itemSearchForm); } else if (custDet.Equals("LookupCustomer")) { itemSearchForm.Hide(); if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null && !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber)) { this.nextState = SaleFlowState.ManagePawnApplication; } else { this.nextState = SaleFlowState.LookupCustomer; } } else if (custDet.Equals("Reload")) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop(); this.nextState = SaleFlowState.ItemSearch; } else if (custDet.Equals("ProcessTender")) { GlobalDataAccessor.Instance.DesktopSession.HistorySession.Desktop(); this.nextState = SaleFlowState.TenderIn; } } else { //Default happy path next state this.parentForm = itemSearchForm; this.nextState = SaleFlowState.ProcessTender; } break; case NavBox.NavAction.CANCEL: this.nextState = SaleFlowState.CancelFlow; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for ItemSearch"); } this.executeNextState(); }