private void ResetFields() { OrderItemName = string.Empty; Description = string.Empty; Price = 0; IsEditMode = false; SelectedSubCategory = SubCategories.FirstOrDefault(); }
public ProductTreeLookup FindGroup(string name) { if (SubCategories == null) { LoadSubCategories(); } return(SubCategories.FirstOrDefault(d => d.Name == name)); }
private void LoadGroups() { if (SubCategories == null) { LoadSubCategories(); } Groups = (new Select(_uc).Column("Id").Column("Name").Column("SmrERPId").Column("SmrSubCategoryId").From("SmrProductGroup").GetList(_uc, Guid.Empty, String.Empty, String.Empty, Guid.Empty) as List <Tuple <Guid, String, String, Guid> >) .Select(g => new ProductTreeLookup() { ERPId = g.Item3, Id = g.Item1, Name = g.Item2, Parent = SubCategories.FirstOrDefault(sc => sc.Id == g.Item4) }).ToList(); }
public void InsertSubCategory(NodeCategoryViewModel newSubCategory) { var list = SubCategories.Where(cat => !(cat is ClassesNodeCategoryViewModel)); var nextLargerItemIndex = FindInsertionPointByName(list, newSubCategory.Name); if (nextLargerItemIndex >= 0) { bool hasClasses = SubCategories.FirstOrDefault() is ClassesNodeCategoryViewModel; var offset = hasClasses ? 1 : 0; SubCategories.Insert(nextLargerItemIndex + offset, newSubCategory); } else { SubCategories.Add(newSubCategory); } }
public MenuPageViewModel() { NotificationManager = new NotificationManager(); SelectedSubCategory = SubCategories.FirstOrDefault(); }