public void CloseView() { SelectedItem = null; SelectedItemPortions.Clear(); SelectedItemPropertyGroups.Clear(); SelectedItemGroupedPropertyItems.Clear(); TicketTags.Clear(); SelectedTicketTag = null; }
private void ResetValues(TicketViewModel selectedTicket) { SelectedTicket = null; SelectedItem = null; SelectedItemPortions.Clear(); SelectedItemPropertyGroups.Clear(); SelectedItemGroupedPropertyItems.Clear(); Reasons.Clear(); TicketTags.Clear(); _showExtraPropertyEditor = false; _showTicketNoteEditor = false; _showFreeTagEditor = false; _removeModifier = false; SetSelectedTicket(selectedTicket); }
public void Refresh(TicketItemViewModel ticketItem, TicketTagGroup selectedTicketTag) { HideKeyboard(); SelectedTicketTag = null; SelectedItemPortions.Clear(); SelectedItemPropertyGroups.Clear(); SelectedItemGroupedPropertyItems.Clear(); TicketTags.Clear(); SelectedItem = ticketItem; if (ticketItem != null) { var mi = AppServices.DataAccessService.GetMenuItem(ticketItem.Model.MenuItemId); if (mi.Portions.Count > 1) { SelectedItemPortions.AddRange(mi.Portions.Select(x => new MenuItemPortionViewModel(x))); } SelectedItemGroupedPropertyItems.AddRange(mi.PropertyGroups.Where(x => !string.IsNullOrEmpty(x.GroupTag)) .GroupBy(x => x.GroupTag) .Select(x => new MenuItemGroupedPropertyViewModel(SelectedItem, x))); SelectedItemPropertyGroups.AddRange(mi.PropertyGroups .Where(x => string.IsNullOrEmpty(x.GroupTag)) .Select(x => new MenuItemPropertyGroupViewModel(x))); foreach (var ticketItemPropertyViewModel in ticketItem.Properties.ToList()) { var tip = ticketItemPropertyViewModel; var mig = SelectedItemPropertyGroups.Where(x => x.Model.Id == tip.Model.PropertyGroupId).SingleOrDefault(); if (mig != null) { mig.Properties.SingleOrDefault(x => x.Name == tip.Model.Name).TicketItemProperty = ticketItemPropertyViewModel.Model; } var sig = SelectedItemGroupedPropertyItems.SelectMany(x => x.Properties).Where( x => x.MenuItemPropertyGroup.Id == tip.Model.PropertyGroupId).FirstOrDefault(); if (sig != null) { sig.TicketItemProperty = ticketItemPropertyViewModel.Model; } } } else { if (selectedTicketTag != null) { SelectedTicketTag = selectedTicketTag; if (selectedTicketTag.FreeTagging) { TicketTags.AddRange(Dao.Query <TicketTagGroup>(x => x.Id == selectedTicketTag.Id, x => x.TicketTags).SelectMany(x => x.TicketTags).OrderBy(x => x.Name).Select(x => new TicketTagViewModel(x))); } else { TicketTags.AddRange(selectedTicketTag.TicketTags.Select(x => new TicketTagViewModel(x))); } RaisePropertyChanged("TicketTags"); } else { RaisePropertyChanged("TicketNote"); ShowKeyboard(); } } RaisePropertyChanged("SelectedItem"); RaisePropertyChanged("IsPortionsVisible"); RaisePropertyChanged("IsEditorsVisible"); RaisePropertyChanged("IsTicketNoteVisible"); RaisePropertyChanged("IsTagEditorVisible"); RaisePropertyChanged("IsFreeTagEditorVisible"); RaisePropertyChanged("TagColumnCount"); }