private void TryAddToCard() { CardProduct found = ProductManager.Instance.GetCardProduct(CardAddProductComboBox.Text); if (found != null) { bool exists = false; foreach (CardProduct product in card) { if (product.Name == found.Name) { product.Count += 1; product.CalculateWholePrice(); exists = true; break; } } if (!exists) { card.Add(found); } Refresh(); } CardAddProductComboBox.Text = ""; }
public void AddProduct(CardProduct cardProduct) { cardProduct.IsSecAccRequired = Convert.ToBoolean(cardProduct.IsSecAccRequired.ToString().Split(',')[0]); _appDbContext.CardProducts.Add(cardProduct); _appDbContext.SaveChanges(); }
private async void btn_adds_Click(object sender, EventArgs e) { new ADDProduct().ShowDialog(); await CardPOS.AddRangeAsync <DummyCard>(Cards()); await CardProduct.AddRangeAsync <DummyCard>(Cards()); }
public void RefreshData(CardProduct pro) { show = pro.Id != 0; product = pro; if (product.Id != 0) { virtualRegion.SetRegionInfo(1, product.Cid); } string effectName = ""; var card = CardAssistant.GetCard(product.Cid); if (card.GetCardType() == CardTypes.Monster) { MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(product.Cid); foreach (var skill in MonsterBook.GetSkillList(monsterConfig.Id)) { int skillId = skill.Id; SkillConfig skillConfig = ConfigData.GetSkillConfig(skillId); if (skillConfig.Cover != null) { effectName = skillConfig.Cover; } } if (monsterConfig.Cover != "") { effectName = monsterConfig.Cover; } } string nowEffectName = ""; if (coverEffect != null) { nowEffectName = coverEffect.Name; } if (effectName != nowEffectName) { if (effectName == "") { coverEffect = null; } else { coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(x + 12, y + 14), new Size(64, 84)); } } parent.Invalidate(new Rectangle(x+12, y+14, 64, 84)); }
private void CardDataGrid_LoadingRow(object sender, DataGridRowEventArgs e) { DataGridRow row = e.Row; CardProduct product = row.DataContext as CardProduct; if (product.Count > ProductManager.Instance.GetProduct(product.Name).Count) { row.Background = new SolidColorBrush(Colors.Red); } else if (product.CurrentPrice != product.Price) { row.Background = new SolidColorBrush(Colors.Orange); } }
private async void btn_update_Click(object sender, EventArgs e) { if (_id == 0) { MessageBox.Show("Product Not Selected"); return; } new UPDATEProduct(_id).ShowDialog(); await CardPOS.AddRangeAsync <DummyCard>(Cards()); await CardProduct.AddRangeAsync <DummyCard>(Cards()); _id = 0; }
public void BuyProductWithCard(Product product, Card card, int amount, double cost) { int newId = 0; if (context.CardProduct.ToList().Count > 0) { newId = context.CardProduct.ToList().Count; } var cardProduct = new CardProduct() { Id = newId, ProductId = product.Id, CardId = card.Id, Amount = amount, Cost = cost }; context.CardProduct.Add(cardProduct); context.SaveChanges(); Console.WriteLine("Card Product Added"); Console.WriteLine(context.CardProduct.ToList().Count); }
public IActionResult Create(CardProduct cardProduct) { if (!_accountController) { return(RedirectToAction("SignOff", "Account")); } try { if (ModelState.IsValid) { // TODO: Add insert logic here _cardProductRepo.AddProduct(cardProduct); return(RedirectToAction(nameof(Index))); } return(View()); } catch { return(View()); } }
private async void SIMSProduct_Load(object sender, EventArgs e) { await CardPOS.AddRangeAsync <DummyCard>(Cards()); await CardProduct.AddRangeAsync <DummyCard>(Cards()); }