public void AddMenuItem(MenuItem menuItem) { var smi = new ScreenMenuItem { MenuItemId = menuItem.Id, Name = menuItem.Name }; ScreenMenuItems.Add(smi); }
public ScreenMenuItemButton(ScreenMenuItem screenMenuItem, ICommand command, ScreenMenuCategory category) { _screenMenuItem = screenMenuItem; _command = command; _category = category; var color = screenMenuItem.ButtonColor; if (string.IsNullOrEmpty(color)) color = category != null ? category.ButtonColor : "Green"; ButtonColor = color; }
private void OnMenuItemCommandExecute(ScreenMenuItem screenMenuItem) { decimal selectedMultiplier = 1; if (!string.IsNullOrEmpty(NumeratorValue) && !_filtered) decimal.TryParse(NumeratorValue, out selectedMultiplier); if (IsQuickNumeratorVisible) NumeratorValue = QuickNumeratorValues[0]; if (IsNumeratorVisible) NumeratorValue = ""; if (selectedMultiplier > 0) { var data = new ScreenMenuItemData { ScreenMenuItem = screenMenuItem, Quantity = selectedMultiplier }; if (data.Quantity == 1 && screenMenuItem.Quantity > 1) data.Quantity = screenMenuItem.Quantity; SelectedMenuItems.Add(data); data.PublishEvent(EventTopicNames.ScreenMenuItemDataSelected); } }
private void OnFindMenuItemCommand(string obj) { var insertedData = NumeratorValue; decimal quantity = 1; if (NumeratorValue.ToLower().Contains("x")) { insertedData = NumeratorValue.Substring(NumeratorValue.ToLower().IndexOf("x") + 1); string q = NumeratorValue.Substring(0, NumeratorValue.ToLower().IndexOf("x")); decimal.TryParse(q, out quantity); } NumeratorValue = ""; if (quantity > 0) { var weightBarcodePrefix = _settingService.ProgramSettings.WeightBarcodePrefix; if (!string.IsNullOrEmpty(weightBarcodePrefix) && insertedData.StartsWith(weightBarcodePrefix)) { var itemLength = _settingService.ProgramSettings.WeightBarcodeItemLength; var quantityLength = _settingService.ProgramSettings.WeightBarcodeQuantityLength; if (itemLength > 0 && quantityLength > 0 && insertedData.Length >= itemLength + quantityLength + weightBarcodePrefix.Length) { var bc = insertedData.Substring(weightBarcodePrefix.Length, itemLength); if (!string.IsNullOrEmpty(_settingService.ProgramSettings.WeightBarcodeItemFormat)) { int integerValue; int.TryParse(bc, out integerValue); if (integerValue > 0) bc = integerValue.ToString(_settingService.ProgramSettings.WeightBarcodeItemFormat); } var qty = insertedData.Substring(weightBarcodePrefix.Length + itemLength, quantityLength); if (bc.Length > 0 && qty.Length > 0) { insertedData = bc; decimal.TryParse(qty, out quantity); } } } try { var mi = _cacheService.GetMenuItem(x => x.Barcode == insertedData); if (mi != null) { var si = new ScreenMenuItem { MenuItemId = mi.Id, Name = mi.Name }; var data = new ScreenMenuItemData { ScreenMenuItem = si, Quantity = quantity }; data.PublishEvent(EventTopicNames.ScreenMenuItemDataSelected); } } catch (Exception) { } } }
private void OnMenuItemSelected(ScreenMenuItem obj) { if (DataContext.SelectedTicket.IsLocked && !AppServices.IsUserPermittedFor(PermissionNames.AddItemsToLockedTickets)) return; decimal selectedMultiplier = 1; if (!string.IsNullOrEmpty(NumeratorValue)) decimal.TryParse(NumeratorValue, out selectedMultiplier); if (IsQuickNumeratorVisible) NumeratorValue = QuickNumeratorValues[0]; if (selectedMultiplier > 0) { if ((QuickNumeratorValues == null || selectedMultiplier.ToString() == QuickNumeratorValues[0]) && obj.Quantity > 1) selectedMultiplier = obj.Quantity; } var item = DataContext.SelectedTicket.AddNewItem(obj.MenuItemId, selectedMultiplier, obj.Gift, obj.DefaultProperties, obj.ItemPortion); if (item != null) AddedMenuItems.Add(item); if (obj.AutoSelect) InvokeOnTicketItemSelected(item); }
public ScreenMenuItemViewModel(ScreenMenuItem model) { Model = model; }
public void AddMenuItem(MenuItem menuItem) { var smi = new ScreenMenuItem { MenuItemId = menuItem.Id, Name = menuItem.Name }; ScreenMenuItems.Add(smi); }
private void FindMenuItem() { var insertedData = NumeratorValue; decimal quantity = 1; var separator = _settingService.ProgramSettings.QuantitySeparators.Split(',').FirstOrDefault(x => NumeratorValue.Contains(x)); if (!string.IsNullOrEmpty(separator)) { insertedData = NumeratorValue.Substring(NumeratorValue.IndexOf(separator, StringComparison.Ordinal) + 1); var q = NumeratorValue.Substring(0, NumeratorValue.IndexOf(separator, StringComparison.Ordinal)); decimal.TryParse(q, out quantity); } NumeratorValue = ""; if (quantity <= 0) return; var weightBarcodePrefix = _settingService.ProgramSettings.WeightBarcodePrefix; if (!string.IsNullOrEmpty(weightBarcodePrefix) && insertedData.StartsWith(weightBarcodePrefix)) { var itemLength = _settingService.ProgramSettings.WeightBarcodeItemLength; var quantityLength = _settingService.ProgramSettings.WeightBarcodeQuantityLength; if (itemLength > 0 && quantityLength > 0 && insertedData.Length >= itemLength + quantityLength + weightBarcodePrefix.Length) { var bc = insertedData.Substring(weightBarcodePrefix.Length, itemLength); if (!string.IsNullOrEmpty(_settingService.ProgramSettings.WeightBarcodeItemFormat)) { int integerValue; int.TryParse(bc, out integerValue); if (integerValue > 0) bc = integerValue.ToString(_settingService.ProgramSettings.WeightBarcodeItemFormat); } var qty = insertedData.Substring(weightBarcodePrefix.Length + itemLength, quantityLength); if (bc.Length > 0 && qty.Length > 0) { insertedData = bc; decimal.TryParse(qty, out quantity); } } } var mi = _cacheService.FindMenuItemByBarcode(insertedData); if (mi != null) { var si = new ScreenMenuItem { MenuItemId = mi.Id, Name = mi.Name }; var data = new ScreenMenuItemData { ScreenMenuItem = si, Quantity = quantity }; data.PublishEvent(EventTopicNames.ScreenMenuItemDataSelected); } else _applicationState.NotifyEvent(RuleEventNames.NumberpadValueEntered, new { Ticket = SelectedTicket, Value = insertedData }); }
private void OnFindMenuItemCommand(string obj) { var insertedData = GetInsertedData(NumeratorValue, 'x', '*'); var quantity = GetInsertedQuantity(NumeratorValue, 'x', '*'); NumeratorValue = ""; if (quantity > 0) { var weightBarcodePrefix = AppServices.SettingService.WeightBarcodePrefix; if (!string.IsNullOrEmpty(weightBarcodePrefix) && insertedData.StartsWith(weightBarcodePrefix)) { var itemLength = AppServices.SettingService.WeightBarcodeItemLength; var quantityLength = AppServices.SettingService.WeightBarcodeQuantityLength; if (itemLength > 0 && quantityLength > 0 && insertedData.Length >= itemLength + quantityLength + weightBarcodePrefix.Length) { var bc = insertedData.Substring(weightBarcodePrefix.Length, itemLength); if (!string.IsNullOrEmpty(AppServices.SettingService.WeightBarcodeItemFormat)) { int integerValue; int.TryParse(bc, out integerValue); if (integerValue > 0) bc = integerValue.ToString(AppServices.SettingService.WeightBarcodeItemFormat); } var qty = insertedData.Substring(weightBarcodePrefix.Length + itemLength, quantityLength); if (bc.Length > 0 && qty.Length > 0) { insertedData = bc; decimal.TryParse(qty, out quantity); } } } try { var mi = AppServices.DataAccessService.GetMenuItem(insertedData); if (mi != null) { var si = new ScreenMenuItem { MenuItemId = mi.Id, Name = mi.Name }; var data = new ScreenMenuItemData { ScreenMenuItem = si, Quantity = quantity }; _addMenuItemCommand.Execute(data); } } catch (Exception) { } } }
public ScreenMenuItemViewModel(IWorkspace workspace, ScreenMenuItem model) { Model = model; _workspace = workspace; }