public static void CopyStoreInventory(StoreItems original) { if (!storeCopyDone) { storeCopy.Add(original); } }
// [FunctionName("ProcessEvents")] public Task <MDS> ProcessEvents(ItemEvent itemEvent) { StoreItems currentStoreItem; MDS currentMDS = new MDS(); if (storeItems == null) { storeItems = new Dictionary <string, StoreItems>(); } if (itemEvent != null) { string key = $"{itemEvent.divisionId}:{itemEvent.storeId}"; if (!storeItems.ContainsKey(key)) { currentStoreItem = new StoreItems(); currentStoreItem.storeId = itemEvent.storeId; currentStoreItem.divisionId = itemEvent.divisionId; currentStoreItem.items = new Dictionary <string, MDS>(); storeItems[key] = currentStoreItem; } currentStoreItem = storeItems[key]; if (!currentStoreItem.items.ContainsKey(itemEvent.upc)) { currentMDS = new MDS(); currentMDS.id = $"{itemEvent.divisionId}:{itemEvent.storeId}:{itemEvent.upc}"; currentMDS.storeId = itemEvent.storeId; currentMDS.divisionId = itemEvent.divisionId; currentMDS.upc = itemEvent.upc; currentMDS.inventoryCount = 0; currentMDS.description = itemEvent.description; currentMDS.productName = itemEvent.productName; currentMDS.lastUpdateTimestamp = itemEvent.lastUpdateTimestamp; currentMDS.lastShipmentTimestamp = itemEvent.lastShipmentTimestamp; currentStoreItem.items[itemEvent.upc] = currentMDS; } currentMDS = currentStoreItem.items[itemEvent.upc]; if (itemEvent.type == "onHandUpdate") { currentMDS.inventoryCount = itemEvent.countAdjustment; currentMDS.description = itemEvent.description; currentMDS.productName = itemEvent.productName; currentMDS.lastUpdateTimestamp = itemEvent.lastUpdateTimestamp; currentMDS.lastShipmentTimestamp = itemEvent.lastShipmentTimestamp; } else if (itemEvent.type == "shipmentUpdate") { currentMDS.inventoryCount += itemEvent.countAdjustment; currentMDS.description = itemEvent.description; currentMDS.productName = itemEvent.productName; currentMDS.lastUpdateTimestamp = itemEvent.lastUpdateTimestamp; currentMDS.lastShipmentTimestamp = itemEvent.lastShipmentTimestamp; } } //return currentMDS; return(Task.FromResult(currentMDS)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name,Description,TodayPrice,Quantity,StorePrice,ProductionDate,ExpirationDate,CreationDate,CreationBy,IsActive,UserId")] StoreItems storeItems) { if (id != storeItems.Id) { return(NotFound()); } if (ModelState.IsValid) { try { storeItems.UserId = _userManager.GetUserId(User); _context.Update(storeItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreItemsExists(storeItems.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", storeItems.UserId); return(View(storeItems)); }
private void DisplaySimple(StoreItems content) { if (content.ItemType == Type.Imported && content.ItemCategory == Category.Book) { Console.WriteLine($"{content.ItemId}. {content.ItemType} {content.ItemCategory} at ${content.ListPrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Food) { Console.WriteLine($"{content.ItemId}. {content.ItemType} {content.ItemName} at ${content.ListPrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Medical_Product) { Console.WriteLine($"{content.ItemId}. {content.ItemType} {content.ItemName} at ${content.ListPrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Other) { Console.WriteLine($"{content.ItemId}. {content.ItemType} {content.ItemName} at ${content.ListPrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Book) { Console.WriteLine($"{content.ItemId}. {content.ItemCategory} at ${content.ListPrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Food) { Console.WriteLine($"{content.ItemId}. {content.ItemName} at ${content.ListPrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Medical_Product) { Console.WriteLine($"{content.ItemId}. {content.ItemName} at ${content.ListPrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Other) { Console.WriteLine($"{content.ItemId}. {content.ItemName} at ${content.ListPrice}"); } }
public void CreateItems(StoreItems items) { Dictionary <string, GameObject> defaultContainers = GetDefaultContainers(); defaultContainers.ToList().ForEach((KeyValuePair <string, GameObject> container) => { AddContainer(container.Value, container.Key); }); List <StoreItem> list = items.items.ToList(); isEmptyCatalog = !list.Any(); if (!isEmptyCatalog) { foreach (var item in list) { if (item.groups.Any()) { item.groups.ToList().ForEach((group) => AddItemToContainer(group.name, item)); } else { AddItemToContainer(Constants.UngroupedGroupName, item); } } } else { ActivateContainer(Constants.EmptyContainerName); } }
public void CreateItems(StoreItems items) { foreach (var item in items.items) { if (item.groups.Any()) { foreach (var group in item.groups) { if (!_containers.ContainsKey(group.name)) { AddContainer(itemsContainerPrefab, group.name); } var groupContainer = _containers[group.name]; groupContainer.GetComponent <ItemContainer>().AddItem(item); } } else { if (!_containers.ContainsKey(Constants.UngroupedGroupName)) { AddContainer(itemsContainerPrefab, Constants.UngroupedGroupName); } var groupContainer = _containers[Constants.UngroupedGroupName]; groupContainer.GetComponent <ItemContainer>().AddItem(item); } } AddContainer(itemsContainerPrefab, Constants.CurrencyGroupName); AddContainer(cartContainerPrefab, Constants.CartGroupName); AddContainer(inventoryContainerPrefab, Constants.InventoryContainerName); }
public void Remove(int _StoreItemID) { StoreItems storeItem = context.StoreItem.Find(_StoreItemID); context.StoreItem.Remove(storeItem); context.SaveChanges(); }
public Task Write(StoreItems changes) { lock (_syncroot) { foreach (var change in changes) { StoreItem newValue = change.Value as StoreItem; StoreItem oldValue = null; if (_memory.TryGetValue(change.Key, out object x)) { oldValue = x as StoreItem; } if (oldValue == null || newValue.eTag == "*" || oldValue.eTag == newValue.eTag) { // clone and set etag newValue = newValue.Clone() as StoreItem; newValue.eTag = (_eTag++).ToString(); _memory[change.Key] = newValue; } else { throw new Exception("etag conflict"); } } } return(Task.CompletedTask); }
protected async Task _createObjectTest(IStorage storage) { var storeItems = new StoreItems(); storeItems["create1"] = new TestItem() { Id = "1" }; dynamic newItem2 = new TestItem() { Id = "2" }; newItem2.dyno = "dynamicStuff"; storeItems["create2"] = newItem2; await storage.Write(storeItems); dynamic result = await storage.Read(new string[] { "create1", "create2" }); Assert.IsNotNull(result.create1, "create1 should not be null"); Assert.AreEqual(result.create1.Id, "1", "strong create1.id should be 1"); Assert.IsNotNull(result.create2, "create2 should not be null"); Assert.AreEqual(result.create2.Id, "2", "create2.id should be 2"); Assert.AreEqual(result.create2.dyno, "dynamicStuff", "create2.dyno should be dynoStuff"); }
public static ActorMeth Shop() { List <Shop.Item> ItemShop = new List <Shop.Item>(); ItemShop.Add(new Shop.Item("Gladius", "A mighty Sword", 100)); ItemShop.Add(new Shop.Item("Gladius", "A mighty Sword", 100)); ItemShop.Add(new Shop.Item("Gladius", "A mighty Sword", 100)); ActorMeth behaviour = (rt, self, _, msg) => { switch (msg.mtype) { case Symbol.Items: StoreItems items = new StoreItems() { MailType = "items", Items = ItemShop }; string json = JsonSerializer.Serialize(items); WebSocketClient.SendMessage(rt.GetWebSocket(new PID(long.Parse(msg.content.PId))), json); break; case Symbol.Buy: break; } return(null); }; return(behaviour); }
public ActionResult Create([Bind(Include = "Id,Code,Name,Quantity,UnitPrice,UnitId,PurchaseBillId,StoreId,PurchaseBillDate")] PurchaseItemsViewModel viewModel) { if (ModelState.IsValid) { StoreItems storeItems = new StoreItems(); PurchaseItems purchaseItems = Mapper.Map <PurchaseItems>(viewModel); Guid purchaseItemid = Guid.NewGuid(); purchaseItems.Id = purchaseItemid; storeItems.Id = Guid.NewGuid(); storeItems.Code = viewModel.Code; storeItems.Name = viewModel.Name; storeItems.PurchaseBillId = viewModel.PurchaseBillId; storeItems.Quantity = viewModel.Quantity; storeItems.UnitPrice = viewModel.UnitPrice; storeItems.ExtendedPrice = viewModel.ExtendedPrice; storeItems.StoreId = viewModel.StoreId; storeItems.Unit = viewModel.Unit; storeItems.UnitId = viewModel.UnitId; storeItems.BalanceQuantity = viewModel.Quantity; storeItems.ItemAddedDate = viewModel.PurchaseBillDate; storeItems.PurchaseItemsId = purchaseItemid; storeItems.Type = "Inward"; _dbContext.StoreItems.Add(storeItems); _dbContext.PurchaseItems.Add(purchaseItems); _dbContext.SaveChanges(); return(Json(new { success = true })); } ViewBag.PurchaseBillId = new SelectList(_dbContext.PurchaseBills, "Id", "BillInvoice", viewModel.PurchaseBillId); ViewBag.UnitId = new SelectList(_dbContext.Units, "Id", "Name", viewModel.UnitId); ViewBag.StoreId = new SelectList(_dbContext.Store, "Id", "Name"); return(View(viewModel)); }
public ActionResult Edit([Bind(Include = "Id,Code,Name,Quantity,UnitPrice,UnitId,WareHouseId,PurchaseBillId,StoreId,PurchaseBillDate")] PurchaseItemsViewModel viewModel) { if (ModelState.IsValid) { PurchaseItems purchaseItems = Mapper.Map <PurchaseItems>(viewModel); // StoreItems storeItems = _dbContext.StoreItems.Where(si => si.PurchaseBillId == purchaseItems.PurchaseBillId && si.StoreId == purchaseItems.StoreId).FirstOrDefault(); StoreItems storeItems = _dbContext.StoreItems.Where(si => si.PurchaseItemsId == viewModel.Id).FirstOrDefault(); storeItems.Code = viewModel.Code; storeItems.Name = viewModel.Name; storeItems.Quantity = viewModel.Quantity; storeItems.UnitPrice = viewModel.UnitPrice; storeItems.ExtendedPrice = viewModel.ExtendedPrice; storeItems.BalanceQuantity = viewModel.Quantity; storeItems.ItemAddedDate = viewModel.PurchaseBillDate; _dbContext.Entry(purchaseItems).State = EntityState.Modified; _dbContext.Entry(storeItems).State = EntityState.Modified; _dbContext.SaveChanges(); return(Json(new { success = true })); } ViewBag.PurchaseBillId = new SelectList(_dbContext.PurchaseBills, "Id", "BillInvoice", viewModel.PurchaseBillId); ViewBag.UnitId = new SelectList(_dbContext.Units, "Id", "Name", viewModel.UnitId); ViewBag.WareHouseId = new SelectList(_dbContext.WareHouses, "Id", "Name"); return(View(viewModel)); }
protected virtual async Task Write(IBotContext context) { StoreItems changes = new StoreItems(); var state = context.Get <StateT>(this._propertyName); if (state == null) { state = new StateT(); } var key = _keyDelegate(context); changes[key] = state; if (this._settings.LastWriterWins) { foreach (var item in changes) { if (item.Value is IStoreItem valueStoreItem) { valueStoreItem.eTag = "*"; } } } await _storage.Write(changes).ConfigureAwait(false); }
private void AddItemToCart() { Console.Clear(); List <StoreItems> listOfItems = _storeItemsRepo.ShowAllItems(); foreach (StoreItems item in listOfItems) { DisplaySimple(item); } Console.WriteLine(); Console.WriteLine("Enter the number of the item you would like to add to your cart:"); int id = int.Parse(Console.ReadLine()); StoreItems content = _storeItemsRepo.GetItemsById(id); if (content != null) { _cartItemsRepo.AddItemsToCart(content); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Item successfully added to cart!"); Console.ResetColor(); } else { Console.WriteLine(); Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("There are no items that match that number."); Console.ResetColor(); } Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("Press any key to continue..."); Console.ResetColor(); Console.ReadKey(); }
private void DisplayReceipt(StoreItems content) { if (content.ItemType == Type.Imported && content.ItemCategory == Category.Book) { float x = (float)(content.ListPrice * 0.05); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemType} {content.ItemCategory}: ${content.SalePrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Food) { float x = (float)(content.ListPrice * 0.05); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemType} {content.ItemName}: ${content.SalePrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Medical_Product) { float x = (float)(content.ListPrice * 0.05); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemType} {content.ItemName}: ${content.SalePrice}"); } else if (content.ItemType == Type.Imported && content.ItemCategory == Category.Other) { float x = (float)(content.ListPrice * 0.15); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemType} {content.ItemName}: ${content.SalePrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Book) { float x = (float)(content.ListPrice * 0); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemCategory}: ${content.SalePrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Food) { float x = (float)(content.ListPrice * 0); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemName}: ${content.SalePrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Medical_Product) { float x = (float)(content.ListPrice * 0); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemName}: ${content.SalePrice}"); } else if (content.ItemType == Type.Not_Imported && content.ItemCategory == Category.Other) { float x = (float)(content.ListPrice * 0.10); content.SalesTax = (float)Math.Ceiling(x * 20) / 20; content.SalePrice = content.ListPrice + content.SalesTax; Console.WriteLine($"{content.ItemName}: ${content.SalePrice}"); } }
public ActionResult DeleteConfirmed(Guid id) { StoreItems storeItems = _dbContext.StoreItems.Find(id); _dbContext.StoreItems.Remove(storeItems); _dbContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { StoreItems storeItems = db.StoreItems.Find(id); db.StoreItems.Remove(storeItems); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Guid storeid) { //ViewBag.StoreId = new SelectList(_dbContext.Store, "Id", "Name"); ViewBag.UnitId = new SelectList(_dbContext.Units, "Id", "Name"); StoreItems storeItems = new StoreItems(); storeItems.StoreId = storeid; return(PartialView("_Create", storeItems)); }
protected override async Task Write(IBotContext context, StoreItems changes = null) { if (changes == null) { changes = new StoreItems(); } changes[KeyName] = context.State[KeyName]; await base.Write(context, changes); }
private void LoadStoreItems() { StoreItems.Clear(); IEnumerable <StoreItem> items = ShoppingListDataStore.GetStoreItemsAsync().Result; foreach (StoreItem item in items) { StoreItems.Add(item); } }
public ActionResult Edit([Bind(Include = "ItemId,ItemName,ItemQuantity,ItemPrice")] StoreItems storeItems) { if (ModelState.IsValid) { db.Entry(storeItems).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(storeItems)); }
public ActionResult Create([Bind(Include = "ItemId,ItemName,ItemQuantity,ItemPrice")] StoreItems storeItems) { if (ModelState.IsValid) { db.StoreItems.Add(storeItems); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(storeItems)); }
public ActionResult Inward(Guid storeItemsId) { StoreItems storeItems = _dbContext.StoreItems.Find(storeItemsId); IssueItems issueItems = new IssueItems(); IssueItemsViewModel viewModel = Mapper.Map <IssueItemsViewModel>(issueItems); ViewBag.IssueType = new SelectList(viewModel.getIssueTypeList(), "Value", "Text", "2"); ViewBag.ItemName = storeItems.Name; viewModel.StoreItemsId = storeItemsId; viewModel.RemainingItem = storeItems.BalanceQuantity; return(PartialView("_Inward", viewModel)); }
public ActionResult Edit([Bind(Include = "Id,Code,Name,Quantity,UnitPrice,ExtendedPrice,UnitId,StoreId,PurchaseBillId")] StoreItems storeItems) { if (ModelState.IsValid) { _dbContext.Entry(storeItems).State = EntityState.Modified; _dbContext.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StoreId = new SelectList(_dbContext.Store, "Id", "Name", storeItems.StoreId); ViewBag.UnitId = new SelectList(_dbContext.Units, "Id", "Name", storeItems.UnitId); return(View(storeItems)); }
public async Task <IActionResult> Create([Bind("Id,Code,Name,Description,TodayPrice,Quantity,StorePrice,ProductionDate,ExpirationDate,CreationDate,CreationBy,IsActive,UserId")] StoreItems storeItems) { if (ModelState.IsValid) { storeItems.UserId = _userManager.GetUserId(User); _context.Add(storeItems); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", storeItems.UserId); return(View(storeItems)); }
public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StoreItems storeItems = _dbContext.StoreItems.Find(id); if (storeItems == null) { return(HttpNotFound()); } return(View(storeItems)); }
// GET: StoreItems/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StoreItems storeItems = db.StoreItems.Find(id); if (storeItems == null) { return(HttpNotFound()); } return(View(storeItems)); }
public async Task <StoreItems> Read(string[] keys) { var storeItems = new StoreItems(); foreach (var key in keys) { var item = await ReadIStoreItem(key).ConfigureAwait(false); if (item != null) { storeItems[key] = item; } } return(storeItems); }
protected override async Task <StoreItems> Read(IBotContext context, IList <String> keys = null) { if (keys == null) { keys = new List <String>(); } keys.Add(KeyName); StoreItems items = await base.Read(context, keys); context.State[KeyName] = items.Get <CustomState>(KeyName) ?? new CustomState() { }; return(items); }
public ActionResult Create([Bind(Include = "Id,Code,Name,Quantity,UnitPrice,UnitId,StoreId,PurchaseBillId,ItemAddedDate")] StoreItems storeItems) { if (ModelState.IsValid) { storeItems.BalanceQuantity = storeItems.Quantity; storeItems.Id = Guid.NewGuid(); _dbContext.StoreItems.Add(storeItems); _dbContext.SaveChanges(); return(Json(new { success = true })); } // ViewBag.StoreId = new SelectList(_dbContext.Store, "Id", "Name", storeItems.StoreId); ViewBag.UnitId = new SelectList(_dbContext.Units, "Id", "Name", storeItems.UnitId); return(View(storeItems)); }