public Food(string name, MoneyValue unitPrice, FoodItemType type, bool isGlutenFree, bool isVeg, bool isNonVeg, string imageUrl, Categories.Category category, Cuisine cuisine, string description, string descriptionEng, Menu menu, List <string> ingredients) { CheckRule(new ConditionMustBeTrueRule(category.Categorize == Categorize.Food, "invalid category")); ImageUrl = imageUrl; Category = category; Cuisine = cuisine; Description = description; DescriptionEng = descriptionEng; Name = name; UnitPrice = unitPrice; Type = type; IsGlutenFree = isGlutenFree; IsVeg = !isNonVeg && isVeg; IsNonVeg = !isVeg && isNonVeg; OldUnitPrice = unitPrice; Status = FoodStatus.Available; Rating = 0; TotalRatingsCount = 0; TotalOrderCount = 0; SetDefaultVariant(); Menu = menu; void SetDefaultVariant() { AddVariant(new Variant(DefaultVariant, DefaultVariantEng, unitPrice, "", "")); } SetIngredients(ingredients); }
private void ShowCatList(object[] Params) { Categories.Category[] Categories = (Categories.Category[])Params; if (treeView1.Nodes.Count == 0) { TreeNode top = treeView1.Nodes.Add("Select Category"); FindingAPI.Categories.Category cat = new Categories.Category(); cat.CategoryID = -1; cat.CategoryName = "Top Level"; } if (treeView1.SelectedNode == null) { treeView1.SelectedNode = treeView1.Nodes[0]; } if (Categories != null) { treeView1.SelectedNode.Nodes.Clear(); foreach (Categories.Category cat in Categories) { TreeNode newNode = treeView1.SelectedNode.Nodes.Add(cat.CategoryID.ToString(), cat.CategoryName); newNode.Tag = cat; } } treeView1.SelectedNode.Expand(); }
public void SupportNewCategory(Categories.Category category) { CheckRule(new ConditionMustBeTrueRule(category.HasValue() && category.Categorize == Categorize.Restaurant, "only a category of type restaurant must be assigned")); CheckRule(new ConditionMustBeTrueRule( _categories.FirstOrDefault(x => x.CategoryId == category.Id).HasNoValue(), "category already exists")); _categories.Add(new RestaurantCategory(this, category)); }
private void textBoxCategory_TextChanged(object sender, EventArgs e) { int result; if (int.TryParse(textBoxCategory.Text.Trim(), out result)) { Categories.Category c = new Categories.Category(); c.CategoryID = result; textBoxCategory.Tag = c; } }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { Categories.Category cat = (Categories.Category)e.Node.Tag; if (cat != null) { SelectedCategory = cat; label1.Text = cat.CategoryName + "(" + cat.CategoryID.ToString() + ")"; LoadCategories(cat.CategoryID); } e.Node.Expand(); }
private void button1_Click(object sender, EventArgs e) { if (sc.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (sc.SelectedCategory == null) { textBoxCategory.Text = "Select Category"; Categories.Category c = new Categories.Category(); c.CategoryID = 1; textBoxCategory.Tag = c; } else { textBoxCategory.Text = sc.SelectedCategory.CategoryName + "(" + sc.SelectedCategory.CategoryID.ToString() + ")"; textBoxCategory.Tag = sc.SelectedCategory; } } }
public RestaurantCategory(Restaurant restaurant, Categories.Category category) { Restaurant = restaurant; Category = category; }
public void UpdateCategory(Categories.Category category) { CheckRule(new ConditionMustBeTrueRule(category != null && category.Categorize == Categorize.Food, "invalid category")); Category = category; }