private void OnOrderTagDataSelected(EventParameters <OrderTagData> obj) { if (obj.Topic == EventTopicNames.SelectOrderTag) { ResetValues(obj.Value.Ticket); SelectedOrderTagData = obj.Value; OrderTags.AddRange(obj.Value.OrderTagGroup.OrderTags.Select(x => new OrderTagButtonViewModel(obj.Value.SelectedOrders, obj.Value.OrderTagGroup, x))); if (OrderTags.Count == 1) { obj.Value.SelectedOrderTag = OrderTags[0].Model; obj.Value.PublishEvent(EventTopicNames.OrderTagSelected); return; } if (obj.Value.SelectedOrders.Count() == 1 && obj.Value.OrderTagGroup.FreeTagging) { var so = obj.Value.SelectedOrders.ElementAt(0); if (so.OrderTagValues.Where(x => x.OrderTagGroupId == obj.Value.OrderTagGroup.Id).Any(x => !OrderTags.Any(y => y.Name == x.Name))) { var ov = so.OrderTagValues.Where(x => x.OrderTagGroupId == obj.Value.OrderTagGroup.Id && !OrderTags.Any(y => y.Name == x.Name)); foreach (var orderTagValue in ov) { OrderTags.Add(new OrderTagButtonViewModel(obj.Value.SelectedOrders, obj.Value.OrderTagGroup, new OrderTag { Name = orderTagValue.Name, Price = orderTagValue.Price })); } } } RaisePropertyChanged(() => OrderTagColumnCount); RaisePropertyChanged(() => FreeTagging); } }
private void OnFreeTagSelected(string obj) { if (string.IsNullOrEmpty(FreeTagName) || string.IsNullOrEmpty(FreeTagName.Trim())) { return; } if (OrderTags.Any(x => x.Name.ToLower() == FreeTagName.ToLower())) { var b = OrderTags.First(x => x.Name == FreeTagName.ToLower()); OnOrderTagSelected(b); return; } var orderTagData = new OrderTagData { SelectedOrders = SelectedOrderTagData.SelectedOrders, OrderTagGroup = SelectedOrderTagData.OrderTagGroup, SelectedOrderTag = new OrderTag { Name = FreeTagName, Price = FreeTagPrice }, Ticket = SelectedTicket }; FreeTagName = ""; FreeTagPriceStr = "0"; OrderTags.Add(new OrderTagButtonViewModel(orderTagData.SelectedOrders, orderTagData.OrderTagGroup, orderTagData.SelectedOrderTag)); orderTagData.PublishEvent(RemoveMode ? EventTopicNames.OrderTagRemoved : EventTopicNames.OrderTagSelected, true); RemoveMode = false; RaisePropertyChanged(() => OrderTagColumnCount); OrderTags.ToList().ForEach(x => x.Refresh()); }
public void CreateOrderTagButton(OrderTagData orderTagData) { if (!OrderTags.Any(x => x.Name == orderTagData.SelectedOrderTag.Name)) { OrderTags.Add(new OrderTagButtonViewModel(_selectedOrders, orderTagData.OrderTagGroup, orderTagData.SelectedOrderTag)); } }
private void OnAddPropertyExecuted(string obj) { var orderTag = MenuItem.AddDefaultMenuItemProperty(Model); orderTag.SortOrder = OrderTags.Any() ? OrderTags.Max(x => x.Model.SortOrder) + 1 : 0; OrderTags.Add(new OrderTagViewModel(orderTag, _menuService)); }
public OrderTag AddOrderTag(string name, decimal price) { var prp = new OrderTag { Name = name, Price = price }; OrderTags.Add(prp); return(prp); }
private void OnAddPropertyExecuted(string obj) { OrderTags.Add(new OrderTagViewModel(MenuItem.AddDefaultMenuItemProperty(Model), _menuService)); }