private void OnQtyButtonClicked(int rowHandle) { LineItemViewModel lineItem = this.ViewModel.Items[rowHandle]; // If it is not for pickup at the current store, the button should be disabled and thus no form should be shown. // If there's no remaining items to pick up, the button should be disable if (!lineItem.IsPickupAtStore(ApplicationSettings.Terminal.StoreId) || lineItem.QuantityRemaining == 0) { return; } using (frmInputNumpad inputDialog = new frmInputNumpad()) { inputDialog.EntryTypes = NumpadEntryTypes.IntegerPositive; inputDialog.PromptText = LSRetailPosis.ApplicationLocalizer.Language.Translate(56396); // "Pickup quantity" inputDialog.Text = LSRetailPosis.ApplicationLocalizer.Language.Translate(99656); // Item details page int qty; POSFormsManager.ShowPOSForm(inputDialog); if (inputDialog.DialogResult != DialogResult.Cancel) { if (int.TryParse(inputDialog.InputText, out qty)) { // Update the row source and repaint if (qty <= lineItem.QuantityRemaining) { this.ViewModel.SetPickupQuantity(lineItem.ItemId, lineItem.LineId, qty); this.ViewModel.CommitChanges(); this.gridView.RefreshRow(rowHandle); } } } } }
private ObjectState GetButtonState(int rowHandle, string column) { int pressedRowHandle = GridControl.InvalidRowHandle; int highlightedRowHandle = GridControl.InvalidRowHandle; bool shouldDisable = false; LineItemViewModel row = this.ViewModel.Items[rowHandle]; switch (column) { case COLQTY: pressedRowHandle = QtyPressedRowHandle; highlightedRowHandle = QtyHighlightedRowHandle; shouldDisable = (row.QuantityRemaining == 0) || !row.IsPickupAtStore(ApplicationSettings.Terminal.StoreId); break; default: break; } if (shouldDisable) { return(ObjectState.Disabled); } else if (rowHandle == pressedRowHandle) { return(ObjectState.Pressed); } else { // Show hot if row is highlighted or cell is focused if (rowHandle == highlightedRowHandle || (gridItems.IsFocused && (gridView.FocusedColumn.FieldName == column) && (gridView.FocusedRowHandle == rowHandle))) { return(ObjectState.Hot); } else { return(ObjectState.Normal); } } }