private void OnFreeTagSelected(OrderTagGroupViewModel obj) { if (string.IsNullOrEmpty(obj.FreeTagName) || string.IsNullOrEmpty(obj.FreeTagName.Trim())) { return; } if (obj.OrderTags.Any(x => x.Name.ToLower() == obj.FreeTagName.ToLower())) { var b = obj.OrderTags.First(x => x.Name == obj.FreeTagName.ToLower()); OnOrderTagSelected(b); return; } var orderTagData = new OrderTagData { OrderTagGroup = obj.Model, SelectedOrderTag = new OrderTag { Name = obj.FreeTagName, Price = obj.FreeTagPrice }, Ticket = SelectedTicket }; obj.FreeTagName = ""; obj.FreeTagPriceStr = "0"; obj.CreateOrderTagButton(orderTagData); orderTagData.PublishEvent(RemoveMode ? EventTopicNames.OrderTagRemoved : EventTopicNames.OrderTagSelected, true); RemoveMode = false; OrderTagGroups.Where(x => x.OrderTags.Any(y => y.Name == obj.FreeTagName)).ToList().ForEach(x => x.Refresh()); }
private void OnFreeTagSelected(OrderTagGroupViewModel obj) { if (string.IsNullOrEmpty(obj.FreeTagName) || string.IsNullOrEmpty(obj.FreeTagName.Trim())) return; if (obj.OrderTags.Any(x => x.Name.ToLower() == obj.FreeTagName.ToLower())) { var b = obj.OrderTags.First(x => x.Name == obj.FreeTagName.ToLower()); OnOrderTagSelected(b); return; } var orderTagData = new OrderTagData { OrderTagGroup = obj.Model, SelectedOrderTag = new OrderTag { Name = obj.FreeTagName, Price = obj.FreeTagPrice }, Ticket = SelectedTicket }; obj.FreeTagName = ""; obj.FreeTagPriceStr = "0"; obj.CreateOrderTagButton(orderTagData); orderTagData.PublishEvent(RemoveMode ? EventTopicNames.OrderTagRemoved : EventTopicNames.OrderTagSelected, true); RemoveMode = false; OrderTagGroups.Where(x => x.OrderTags.Any(y => y.Name == obj.FreeTagName)).ToList().ForEach(x => x.Refresh()); }