public bool RemoveReciep(Receipe reciep) { string query = "DELETE FROM ReceipesIngredients WHERE ReceipeId = @Id"; this.connection.Query <Receipe>(query, param: reciep); return(this.connection.Delete <Receipe>(reciep)); }
private Receipe CreateReceipe() { Receipe rec; if (type == 1) { rec = SceneItemManager.Instance.Factory.LearnedFood(receipeName); if (rec == null) { rec = new Receipe(receipeName, type); for (int i = 0; i < materials.Count; i++) { rec.AddIngredient(materials[i], amount[i]); } SceneItemManager.Instance.Factory.AddFood(rec); } } else { rec = SceneItemManager.Instance.Factory.LearnedDrink(receipeName); if (rec == null) { rec = new Receipe(receipeName, type); for (int i = 0; i < materials.Count; i++) { rec.AddIngredient(materials[i], amount[i]); } SceneItemManager.Instance.Factory.AddDrink(rec); } } return(rec); }
/// <summary> /// Refreshes the specified e. /// </summary> /// <param name="e">The e.</param> public void Refresh(Event e) { if (e is ReceipeEvent) { ReceipeEvent receipeE = (ReceipeEvent)e; Receipe receipe = receipeE.Receipe; if (receipeE is AddedReceipeEvent) { this.ItemsReceipe.Add(ToolItem.CreateItemReceipe(receipe)); } else if (receipeE is RemovedReceipeEvent) { foreach (ItemReceipe item in this.ItemsReceipe) { if (item.Receipe == receipe) { this.ItemsReceipe.Remove(item); } } } else if (receipeE is ClearedReceipeEvent) { this.ItemsReceipe = new List <ItemReceipe>(); } } }
/// <summary> /// Handles the Click event of the ItemFavorite control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param> private void ItemFavorite_Click(object sender, ItemClickEventArgs e) { Receipe item = ((Receipe)e.ClickedItem); this.Model.SelectReceipe(item); this.Frame.Navigate(typeof(ReceipeDetail), this.Model); }
public void SetReceipe(Receipe rec, float time, int prof, int cost) { receipe = rec; produceTime = time; profit = prof; buildCost = cost; }
public EditingViewModel(IEditingView view, Receipe receipe, IDataService dataService) { this.Receipe = receipe; this.dataService = dataService; this.View = view; this.View.BindDataContext(this); }
// Start is called before the first frame update protected override void Start() { base.Start(); if (faceRight) { foreach (SpriteRenderer sprite in bodySprites) { sprite.flipX = true; } } Receipe foodOrder = SceneItemManager.Instance.Factory.GetRandomFood(); if (foodOrder != null) { order1 = new KeyValuePair <Receipe, GameObject>(foodOrder, gameObject); waitOrder1 = true; SceneItemManager.Instance.Bar.AddOrder(order1); } Receipe drinkOrder = SceneItemManager.Instance.Factory.GetRandomDrink(); if (drinkOrder != null) { order2 = new KeyValuePair <Receipe, GameObject>(drinkOrder, gameObject); waitOrder2 = true; SceneItemManager.Instance.Bar.AddOrder(order2); } if (foodOrder == null && drinkOrder == null) { StartCoroutine(NoOrderLeave()); return; } waiting = true; remainTime = waitTime; countDownText.text = ((int)remainTime).ToString(); }
public void AddIdleFactory(Receipe receipe, GameObject fac) { if (!idleFactories.ContainsKey(receipe)) { idleFactories.Add(receipe, new List <GameObject>()); } idleFactories[receipe].Add(fac); }
public bool UpdateReceipe(Receipe receipe) { this.recipesRepository.OpenConnection(); var result = this.recipesRepository.Update(receipe); this.recipesRepository.CloseConnection(); return(result); }
public bool AddReciepe(Receipe receipe, Ingredient ingredient) { this.recipesRepository.OpenConnection(); var result = this.recipesRepository.AddReceipe(receipe, ingredient); this.recipesRepository.CloseConnection(); return(result); }
public bool DeleteReciep(Receipe reciep) { this.recipesRepository.OpenConnection(); var result = this.recipesRepository.RemoveReciep(reciep); this.recipesRepository.CloseConnection(); return(result); }
public IEnumerable <Ingredient> GetSelectedReciepeIngredients(Receipe reciep) { this.ingredientRepository.OpenConnection(); var result = ingredientRepository.GetReciepIngredients(reciep); this.ingredientRepository.CloseConnection(); return(result); }
void Add(Receipe receipe, Rational count) => Receipes = Receipes .Concat(new[] { new Stack <Receipe> { Target = receipe, Count = count } }) .GroupBy(i => i.Target) .Select(g => new Stack <Receipe> { Target = g.Key, Count = g.Select(i => i.Count).Aggregate() }) .ToArray();
public void ConsumeMaterial(Receipe rec) { foreach (var pair in rec.Ingredients) { rawMat[pair.Key] -= pair.Value; storageUI.Find(pair.Key).Find("ItemCount").GetComponent <Text>().text = rawMat[pair.Key].ToString(); stored -= pair.Value; } }
public async Task <Receipe> Add(Receipe receipe) { var model = mapper.Map <ReceipeModel>(receipe); var dbModel = await serviceRepo.CreateReceipeAsync(model); var result = mapper.Map <Receipe>(dbModel); return(result); }
/// <summary> /// Go to the ReceipeDetail page when the user click on the receipe /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param> private void ReceipeClick_Click(object sender, ItemClickEventArgs e) { if (e.ClickedItem is ItemReceipe) { ItemReceipe item = (ItemReceipe)e.ClickedItem; Receipe re = item.Receipe; this.Model.SelectReceipe(re); this.Frame.Navigate(typeof(ReceipeDetail), this.Model); } }
public bool CheckEnoughMaterial(Receipe rec) { foreach (var pair in rec.Ingredients) { if (!rawMat.ContainsKey(pair.Key) || rawMat[pair.Key] < pair.Value) { return(false); } } return(true); }
/// <summary> /// Handles the Click event of the GoToDetailReceipe control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param> private void GoToDetailReceipe_Click(object sender, ItemClickEventArgs e) { if (e.ClickedItem is ItemReceipe) { ItemReceipe item = (ItemReceipe)e.ClickedItem; Receipe receipe = item.Receipe; this.Model.SelectReceipe(receipe); //navigate to the ReceipeDetail page this.Frame.Navigate(typeof(ReceipeDetail), this.Model); } }
//[HttpPut] public ActionResult <Receipe> Put(int id, [FromBody] Receipe receipeUpdated) { if (id != receipeUpdated.Id) { return(BadRequest()); } Receipe[] list = this.ReadData(); int idx = Array.IndexOf(list, list.FirstOrDefault(st => st.Id == receipeUpdated.Id)); list[idx] = receipeUpdated; this.WriteData(list); return(list.FirstOrDefault(st => st.Id == receipeUpdated.Id)); }
public Receipe Save([FromBody] Receipe receipe) { try { if (receipe == null) { throw new ArgumentException("Bad Request"); } return(_chefRepository.SaveAsync(receipe).Result); } catch (Exception ex) { throw ex; } }
/// <summary> /// Handles the Click event of the RemoveReceipe, update the model and the json file. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Windows.UI.Xaml.RoutedEventArgs"/> instance containing the event data.</param> public async void RemoveReceipe_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { Button button = sender as Button; if (this.Frame != null && button != null && button.DataContext is ItemReceipe) { ItemReceipe item = (ItemReceipe)button.DataContext; Receipe re = item.Receipe; this.Model.RemoveReceipeList(re, (string)button.Tag, this.date); StorageFolder folder = KnownFolders.PicturesLibrary; StorageFile receipeFile = await folder.CreateFileAsync("receipes.json", CreationCollisionOption.ReplaceExisting); await Windows.Storage.FileIO.WriteTextAsync(receipeFile, this.Model.StringifyReceipesList()); } }
public ActionResult <Receipe> Post([FromBody] Receipe receipeNew) { if (receipeNew.Id != -1) { return(BadRequest()); } Receipe[] rcList = this.ReadData(); int maxId = rcList.Max(st => st.Id); receipeNew.Id = 1 + maxId; rcList = rcList.Concat(new Receipe[] { receipeNew }) .ToArray(); this.WriteData(rcList); return(receipeNew); }
private bool CheckUpgradeBonus(Receipe r, out bool useFakeWeaponView) { useFakeWeaponView = false; if (r._weaponStatUpgrades != null && r._weaponStatUpgrades.Length > 0) { WeaponStatUpgrade.Types type = r._weaponStatUpgrades[0]._type; switch (type) { case WeaponStatUpgrade.Types.FlareGunAmmo: this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE__AMMO", "{0} AMMO", true); useFakeWeaponView = false; return(true); default: if (type != WeaponStatUpgrade.Types.BurningAmmo) { return(false); } break; case WeaponStatUpgrade.Types.PoisonnedAmmo: this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_POISONED_", "Poisoned {0}", true); return(true); case WeaponStatUpgrade.Types.BurningWeaponExtra: this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_EXTRA_BURNING_", "Extra burning {0}", true); return(true); case WeaponStatUpgrade.Types.Incendiary: break; case WeaponStatUpgrade.Types.BoneAmmo: this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_BONE_", "Bone {0}", true); return(true); case WeaponStatUpgrade.Types.PoisonnedWeapon: this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_POISONED_", "Poisoned {0}", true); useFakeWeaponView = true; return(true); } this._title.text = UiTranslationDatabase.TranslateKey("UPGRADE_INCENDIARY_", "Incendiary {0}", true); return(true); } return(false); }
private bool CheckUpgradeBonus(Receipe r) { if (r._weaponStatUpgrades != null && r._weaponStatUpgrades.Length > 0) { WeaponStatUpgrade.Types type = r._weaponStatUpgrades[0]._type; if (type == WeaponStatUpgrade.Types.BurningWeaponExtra) { this._title.text = "Extra burning "; return(true); } if (type == WeaponStatUpgrade.Types.Incendiary) { this._title.text = "Incendiary "; return(true); } } return(false); }
public bool AddReceipe(Receipe receipe, Ingredient ingredient) { try { var parametres = new DynamicParameters(); parametres.Add("title", receipe.Title, System.Data.DbType.String); parametres.Add("description", receipe.Description, System.Data.DbType.String); parametres.Add("prepareTime", receipe.PrepareTime, System.Data.DbType.Time); parametres.Add("note", receipe.Note, System.Data.DbType.String); parametres.Add("ingredient", ingredient.IngrentName, System.Data.DbType.String); parametres.Add("unitId", ingredient.UnitId, System.Data.DbType.Int32); parametres.Add("receipeId", receipe.Id, System.Data.DbType.Int32); parametres.Add("ingredientId", ingredient.Id, System.Data.DbType.Int32); parametres.Add("quantity", ingredient.Quantity, System.Data.DbType.Int32); this.connection.Execute("AddReceipe", parametres, commandType: System.Data.CommandType.StoredProcedure); return(true); } catch (DbException) { return(false); } }
void Start() { _db = GameObject.FindGameObjectWithTag("ItemDataBase").GetComponent <ItemDataBase>(); Receipe recipe1 = new Receipe() { Ingridients = new List <Item>() { new Item(Item.Name.Meat, Item.StateOfIncision.Whole, Item.StateOfPreparing.Raw, false), new Item(Item.Name.Bread, Item.StateOfIncision.Whole, Item.StateOfPreparing.Raw, false), }, Result = _db.Generate(Item.Name.Sandwich, Item.StateOfIncision.Whole, Item.StateOfPreparing.Raw, false) }; Receipe recipe2 = new Receipe() { Ingridients = new List <Item>() { new Item(Item.Name.Meat, Item.StateOfIncision.Whole, Item.StateOfPreparing.Raw, false), new Item(Item.Name.Meat, Item.StateOfIncision.Whole, Item.StateOfPreparing.Raw, false) }, Result = _db.Generate(Item.Name.Meat, Item.StateOfIncision.Whole, Item.StateOfPreparing.Fried, false) }; Receipes = new List <Receipe>() { recipe1, recipe2 }; }
/// <summary> /// Initializes a new instance of the <see cref="ReceipeDescription"/> class. /// </summary> /// <param name="receipe">The receipe.</param> public ReceipeDescription(Receipe receipe) { if (receipe.Author == String.Empty || receipe == null) { this.Author = "Auteur : -"; } else { this.Author = "Auteur : " + receipe.Author; } this.PublicationDate = "Publié le : " + receipe.PublicationDate.ToString("d"); this.Description = receipe.Description; if (receipe.WithAlcohol) { this.Alcool = "Avec alcool"; } else { this.Alcool = "Sans alcool"; } if (receipe.Vegetarian) { this.Vegetarien = "Plat végétarien"; } else { this.Vegetarien = "Plat non végétarien"; } this.Difficulty = receipe.Difficulty.ToString(); this.Cost = receipe.Cost.ToString(); this.Rating = receipe.Rating.ToString(); this.Image = receipe.Image; this.DishType = "Type de plat : " + receipe.DishType.Name; this.AlcoolVege = this.Alcool + " - " + this.Vegetarien; }
/// <summary> /// Creates the item receipe. /// </summary> /// <param name="receipe">The receipe.</param> /// <returns></returns> public static ItemReceipe CreateItemReceipe(Receipe receipe) { ItemReceipe item = new ItemReceipe(receipe); item.Name = receipe.Title; TextBlock toto = new TextBlock(); toto.Text = item.Name; toto.Measure(new Size(1200, 1200)); if (toto.DesiredSize.Width > 90) { while (toto.DesiredSize.Width > 90) { item.Name = item.Name.Remove(item.Name.Length - 1, 1); toto.Text = item.Name; toto.Measure(new Size(1200, 1200)); } item.Name = item.Name.PadRight(item.Name.Length + 3, '.'); } return(item); }
private void GenerateReceipe(MainWindow mainWindow) { Receipe receipe = new Receipe { TransactionNumber = _dataId, Data = DateTime.Now, ListOfBoughtProducts = MainWindow.ListOfBoughtItems, PriceSum = _dataTotalPrice, KindOfPayment = _flagToKindOfPayment ? "Gotowka" : "Karta" }; receipe.PriceSum = _dataTotalPrice; receipe.CashNumber = Convert.ToInt32(mainWindow.lblCashRegisterNumber.Content); receipe.CashierNumber = Convert.ToInt32(mainWindow.lblCashierNumber.Content); if (MainWindow.ListOfDeletedItems.Count > 0) { receipe.ListOfDeletedProducts = MainWindow.ListOfDeletedItems; } ReceipePdfGenerator receipePdfGenerator = new ReceipePdfGenerator(receipe); receipePdfGenerator.GeneratePdf(); }
/// <summary> /// Display all the ingredients of a receipe /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void ClickHandleIngredients(object sender, RoutedEventArgs e) { Button b = sender as Button; if (b != null && b.DataContext is ItemReceipe) { ItemReceipe item = (ItemReceipe)b.DataContext; Receipe receipe = item.Receipe; List <ItemIngredient> itemsIng = new List <ItemIngredient>(); foreach (Ingredient ing in receipe.ingredients) { itemsIng.Add(ToolItem.CreateItemIngredient(ing)); } this.listIngredientsViewSource.Source = itemsIng; if (this.IngredientTextBlock != null) { this.IngredientTextBlock.Text = (string)receipe.Title; } } }
private bool CheckUpgradeBonus(Receipe r) { if (r._weaponStatUpgrades != null && r._weaponStatUpgrades.Length > 0) { WeaponStatUpgrade.Types type = r._weaponStatUpgrades[0]._type; if (type == WeaponStatUpgrade.Types.BurningWeaponExtra) { this._title.text = "Extra burning "; return true; } if (type == WeaponStatUpgrade.Types.Incendiary) { this._title.text = "Incendiary "; return true; } } return false; }
public void ApplyUpgradeRecipe(InventoryItemView craftView, Receipe receipe, int amount) { this._currentIngredientIndex = 0; this._recipe = receipe; this._craftView = craftView; this._currentReceiver = null; this._upPositionV = craftView.transform.position + this._upPosition.parent.TransformDirection(new Vector3(0.5f, -1.05f, 0f)); this._upRotation = craftView.transform.rotation * Quaternion.Euler(30f, 0f, 0f); this._receivers = this._craftView.GetAllComponentsInChildren<UpgradeViewReceiver>(); this._downPosition = this._craftView.transform.position; this._downRotation = this._craftView.transform.rotation; this._state = UpgradeCog.States.MoveUp; this._totalUpgrades = amount; this._implantsDone = 0; this._totalIngredientImplants = 0; this._craftingCog.enabled = false; base.enabled = true; Scene.HudGui.ShowValidCraftingRecipes(null); Scene.HudGui.ShowUpgradesDistribution(this._recipe._productItemID, this._recipe._ingredients[1]._itemID, 1); }
public void ShowReceipe(Receipe receipe, HudGui.InventoryItemInfo iii) { if (iii != null) { this._icon.mainTexture = iii._icon; this._icon.enabled = true; } else { this._icon.enabled = false; } if (receipe._type == Receipe.Types.Craft) { this._title.text = ((iii == null) ? ItemDatabase.ItemById(receipe._productItemID)._name : iii._titleText); if (receipe._productItemAmount > 1) { UILabel expr_82 = this._title; expr_82.text = expr_82.text + " x" + receipe._productItemAmount; } } else { string name = ItemDatabase.ItemById(receipe._ingredients[1]._itemID)._name; string text = name; switch (text) { case "Feather": this._title.text = "+Speed "; goto IL_29B; case "Tooth": this._title.text = "+Damage -Speed "; goto IL_29B; case "Booze": if (!this.CheckUpgradeBonus(receipe)) { this._title.text = "+Damage "; } goto IL_29B; case "Treesap": this._title.text = "Sticky "; goto IL_29B; case "Cloth": this._title.text = "Burning "; goto IL_29B; case "OrangePaint": this._title.text = "Orange "; goto IL_29B; case "BluePaint": this._title.text = "Blue "; goto IL_29B; case "Battery": this._title.text = "Recharged "; goto IL_29B; case "Cassette 1": case "Cassette 2": case "Cassette 3": case "Cassette 4": case "Cassette 5": this._title.text = name + " "; goto IL_29B; } this._title.text = string.Empty; IL_29B: UILabel expr_2A1 = this._title; expr_2A1.text += ((iii == null) ? ItemDatabase.ItemById(receipe._productItemID)._name : iii._titleText); } }