private void btnSave_Click(object sender, EventArgs e) { if (isValidEntery()) { try { InventoryIngredient InsertInventoryIngredient = new InventoryIngredient(); InsertInventoryIngredient.IngredientID = (long)Convert.ToDouble(DBMethod.GetSelectedItemID(cmbName)); InsertInventoryIngredient.SupplierId = (long)Convert.ToDouble(DBMethod.GetSelectedItemID(cmbSupplier)); InsertInventoryIngredient.ThisPaymentMethod = DBMethod.GetSelectedItemID(cmbPaymentMethod); InsertInventoryIngredient.PurchaseDate = dtpPurchaseDate.Value; InsertInventoryIngredient.ExpiryDate = dtpExpiryDate.Value; InsertInventoryIngredient.Quantity = Convert.ToDouble(txtQuantity.Text.Trim()); InsertInventoryIngredient.Cost = Convert.ToDouble(txtCost.Text.Trim()); InsertInventoryIngredient.UnitPrice = Convert.ToDouble(txtCost.Text.Trim()) / Convert.ToDouble(txtQuantity.Text.Trim()); DBConnector conn = new DBConnector(Classes.DBMethod.GetConnectionString()); RosieEntity.Connector = conn; InsertInventoryIngredient.Create(); clearData(); MessageBox.Show("The ingredient quantity has successfully stocked into the inventory", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { //MessageBox.Show(ex.Message); MessageBox.Show("Sorry! An internal error has happened", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public IEnumerator CraftingCoroutine() { GameManager.Get <SoundManager>().Play(craftingEffect); canClose = false; craftingInfoPanel.craftButton.interactable = false; InventoryIngredient newII = new InventoryIngredient(); newII.ingredient = craftingInfoPanel.SelectedRecipe.craftedItem; float desiredTime = 5f; float elapsedTime = 0f; while (elapsedTime < desiredTime) { craftingInfoPanel.craftingFillBar.fillAmount = (elapsedTime / desiredTime); elapsedTime += Time.deltaTime; yield return(null); } craftingInfoPanel.craftingFillBar.fillAmount = 0f; newII.amount = 1; UIManager.GetMenu <Inventory>().AddInventoryItem(newII.ingredient, newII.amount); canClose = true; Close(); //SelectCraftingSlot(craftingSlots[0]); //SelectSlot(); }
public ActionResult Gekocht(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BoodschapIngredient boodschapIngredient = db.BoodschapIngredients.Find(id); if (boodschapIngredient == null) { return(HttpNotFound()); } InventoryIngredient inventoryIngredient = new InventoryIngredient(); inventoryIngredient.ingredient = boodschapIngredient.ingredient; inventoryIngredient.Hoeveelheid = boodschapIngredient.Hoeveelheid; inventoryIngredient.Eenheid = boodschapIngredient.Eenheid; db.InventoryIngredients.Add(inventoryIngredient); db.BoodschapIngredients.Remove(boodschapIngredient); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddInventory([Bind(Include = "InventoryingredientID,ingredient,Hoeveelheid,Eenheid")] InventoryIngredient inventoryIngredient) { using (DBingredient context = new DBingredient()) { if (ModelState.IsValid) { User user = (User)Session["user"]; int UserID = user.UserID; User indexUser = context.Users.Find(UserID); //int inventoryID = indexUser.inventory.InventoryID; //Inventory inventory = context.Inventories.Find(inventoryID); Ingredient ig = context.Ingredients.Find(inventoryIngredient.ingredient.ingredientID); inventoryIngredient.ingredient = ig; context.InventoryIngredients.Add(inventoryIngredient); context.SaveChanges(); indexUser.inventory.InventoryIngredients.Add(inventoryIngredient); context.Entry(indexUser.inventory).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } return(View(inventoryIngredient)); } }
public void SetContent(InventoryIngredient ii, bool transferToInventory) { inventoryIngredient = ii; toInventory = transferToInventory; titleText.text = ii.ingredient.displayName; descriptionText.text = ii.ingredient.description; }
public ActionResult DeleteConfirmed(int id) { InventoryIngredient ingredient = db.InventoryIngredients.Find(id); db.InventoryIngredients.Remove(ingredient); db.SaveChanges(); return(RedirectToAction("Index")); }
public void SetContent(InventoryIngredient ii, bool transferToInventory) { inventoryIngredient = ii; toInventory = transferToInventory; titleText.text = ii.ingredient.displayName; descriptionText.text = ii.ingredient.description; }
public void Open(int i, InventoryIngredient ii, bool transferToInventory) { toInventory = transferToInventory; ingredient = ii.ingredient; slider.maxValue = i; slider.value = 0; Open(); }
public void Open(int i, InventoryIngredient ii, bool transferToInventory) { toInventory = transferToInventory; ingredient = ii.ingredient; slider.maxValue = i; slider.value = 0; Open(); }
public void Add(ItemBase toAdd, int amount) { DataLogger.LogMessage("Item added: " + toAdd.name); InventoryItem myInvItem; if (toAdd is Equipment) { InventoryEquipment myEq = myEquipments.Find(x => x.item.name == toAdd.name); myInvItem = new InventoryEquipment((Equipment)toAdd, amount); if (myEq != null) { myEq.chargesLeft += amount; } else { myEquipments.Add((InventoryEquipment)myInvItem); } if (activeEquipment == null) { EquipItem((InventoryEquipment)myInvItem); } } else if (toAdd is Ingredient) { InventoryIngredient myIng = myIngredients.Find(x => x.item.name == toAdd.name); myInvItem = new InventoryIngredient((Ingredient)toAdd, amount); if (myIng != null) { myIng.chargesLeft += amount; } else { myIngredients.Add((InventoryIngredient)myInvItem); } } else { InventoryPotion myPot = myPotions.Find(x => x.item.name == toAdd.name); myInvItem = new InventoryPotion((Potion)toAdd, amount); if (myPot != null) { myPot.chargesLeft += amount; } else { myPotions.Add((InventoryPotion)myInvItem); } } if (ItemGainedScreen.s != null) { ItemGainedScreen.s.ShowGainedItem(myInvItem); } SaveMaster.s.Save(); }
public void Open(InventoryIngredient i1, InventoryIngredient i2, InventoryIngredient i3, InventoryIngredient rareIngredient, float rareDropChance) { if (!isActive) { tier1.Initialize(i1, rareIngredient, rareDropChance); tier2.Initialize(i2, rareIngredient, rareDropChance); tier3.Initialize(i3, rareIngredient, rareDropChance); Open(); } }
public void Open(InventoryIngredient i1, InventoryIngredient i2, InventoryIngredient i3, InventoryIngredient rareIngredient, float rareDropChance) { if (!isActive) { tier1.Initialize(i1, rareIngredient, rareDropChance); tier2.Initialize(i2, rareIngredient, rareDropChance); tier3.Initialize(i3, rareIngredient, rareDropChance); Open(); } }
public ActionResult DeleteConfirmed(int id) { using (DBingredient context = new DBingredient()) { InventoryIngredient ingredient = context.InventoryIngredients.Find(id); context.InventoryIngredients.Remove(ingredient); context.SaveChanges(); return(RedirectToAction("Index")); } }
public void Initialize(InventoryIngredient i, InventoryIngredient ri, float rdc) { fillIcon1.fillAmount = 1f; fillIcon2.fillAmount = 1f; ingredient = i; RareDropChance = rdc; rareIngredient = ri; harvestButton.enabled = true; scanButton.enabled = true; scannerUIRoot.SetActive(true); harvesterUIRoot.SetActive(false); }
public ActionResult Edit([Bind(Include = "InventoryingredientID,Ingredient,Hoeveelheid,Eenheid")] InventoryIngredient inventoryIngredient) { if (ModelState.IsValid) { Ingredient ig = db.Ingredients.Find(inventoryIngredient.ingredient.ingredientID); inventoryIngredient.ingredient = ig; db.Entry(inventoryIngredient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(inventoryIngredient)); }
public void Initialize(InventoryIngredient i, InventoryIngredient ri, float rdc) { fillIcon1.fillAmount = 1f; fillIcon2.fillAmount = 1f; ingredient = i; RareDropChance = rdc; rareIngredient = ri; harvestButton.enabled = true; scanButton.enabled = true; scannerUIRoot.SetActive(true); harvesterUIRoot.SetActive(false); }
// GET: Ingredients/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryIngredient ingredient = db.InventoryIngredients.Find(id); if (ingredient == null) { return(HttpNotFound()); } return(View(ingredient)); }
public ActionResult AddInventory(int?id) { if (id == null) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest)); } InventoryIngredient inventoryIngredient = new InventoryIngredient(); inventoryIngredient.ingredient = db.Ingredients.Find(id); ViewBag.IngredientID = id; return(View(inventoryIngredient)); }
private void btnDestroy_Click(object sender, EventArgs e) { string updateSQLText = "Update [tblIngredientInventory] Set tblIngredientInventory.Quantity=0 " + "where (tblIngredientInventory.Quantity > 0) " + expierdWhere; if (InventoryIngredient.RidOutExpierd(DBMethod.GetConnectionString(), updateSQLText)) { MessageBox.Show("Selected expired items have been rid out", "Confirmation" , MessageBoxButtons.OK, MessageBoxIcon.Information); chkExpierd_CheckedChanged(sender, e); } else { MessageBox.Show("Sorry! An internal error has happened", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// GET: Ingredients/Delete/5 public ActionResult Delete(int?id) { //DBingredient context = new DBingredient(); using (DBingredient context = new DBingredient()) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryIngredient inventoryIngredient = context.InventoryIngredients.Find(id); if (inventoryIngredient == null) { return(HttpNotFound()); } int ingredientID = inventoryIngredient.ingredient.ingredientID; Ingredient ig = context.Ingredients.Find(ingredientID); inventoryIngredient.ingredient = ig; return(View(inventoryIngredient)); } }
public ActionResult Gekocht(int?id) { using (DBingredient context = new DBingredient()) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BoodschapIngredient boodschapIngredient = context.BoodschapIngredients.Find(id); if (boodschapIngredient == null) { return(HttpNotFound()); } User user = (User)Session["user"]; InventoryIngredient inventoryIngredient = new InventoryIngredient(); inventoryIngredient.ingredient = boodschapIngredient.ingredient; inventoryIngredient.Hoeveelheid = boodschapIngredient.Hoeveelheid; inventoryIngredient.Eenheid = boodschapIngredient.Eenheid; int inventoryID = user.inventory.InventoryID; Inventory inventory = context.Inventories.Find(inventoryID); int boodschapLijstID = user.boodschapLijst.BoodschapLijstID; BoodschapLijst boodschapLijst = context.BoodschapLijsts.Find(boodschapLijstID); inventory.InventoryIngredients.Add(inventoryIngredient); //context.Entry(inventory.InventoryIngredients).State = EntityState.Modified; boodschapLijst.BoodschapIngredients.Remove(boodschapIngredient); //context.Entry(user.boodschapLijst).State = EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } }
public void Remove(ItemBase toRemove, int amount) { //InventoryItem myInvItem; if (toRemove is Equipment) { InventoryEquipment myEq = myEquipments.Find(x => x.item.name == toRemove.name); //myInvItem = new InventoryEquipment ((Equipment)toRemove, toRemove.durability); bool didRemove = false; if (myEq != null) { myEq.chargesLeft -= amount; if (myEq.chargesLeft <= 0) { myEquipments.Remove(myEq); didRemove = true; } } else { DataLogger.LogError("Cant remove item! " + toRemove.name + " - " + amount.ToString()); } if (didRemove) { if (toRemove.name == activeEquipment.item.name) { activeEquipment = null; } } } else if (toRemove is Ingredient) { InventoryIngredient myIng = myIngredients.Find(x => x.item.name == toRemove.name); //myInvItem = new InventoryIngredient ((Ingredient)toRemove, toRemove.durability); if (myIng != null) { myIng.chargesLeft -= amount; if (myIng.chargesLeft <= 0) { myIngredients.Remove(myIng); } } else { DataLogger.LogError("Cant remove item! " + toRemove.name + " - " + amount.ToString()); } } else { InventoryPotion myPot = myPotions.Find(x => x.item.name == toRemove.name); //myInvItem = new InventoryPotion ((Potion)toRemove, toRemove.durability); if (myPot != null) { myPot.chargesLeft -= amount; if (myPot.chargesLeft <= 0) { myPotions.Remove(myPot); } } else { DataLogger.LogError("Cant remove item! " + toRemove.name + " - " + amount.ToString()); } } }
public IEnumerator CraftingCoroutine() { GameManager.Get<SoundManager>().Play(craftingEffect); canClose = false; craftingInfoPanel.craftButton.interactable = false; InventoryIngredient newII = new InventoryIngredient(); newII.ingredient = craftingInfoPanel.SelectedRecipe.craftedItem; float desiredTime = 5f; float elapsedTime = 0f; while (elapsedTime < desiredTime) { craftingInfoPanel.craftingFillBar.fillAmount = (elapsedTime / desiredTime); elapsedTime += Time.deltaTime; yield return null; } craftingInfoPanel.craftingFillBar.fillAmount = 0f; newII.amount = 1; UIManager.GetMenu<Inventory>().AddInventoryItem(newII.ingredient, newII.amount); canClose = true; Close(); //SelectCraftingSlot(craftingSlots[0]); //SelectSlot(); }