public async Task addCategory(string category) { Category cat = new Category(); cat.CategoryName = category; db.Category.Add(cat); await db.SaveChangesAsync(); }
public async Task addEmployee(MadeToMeasureContext context) { BusinessEntity b = new BusinessEntity(); // b.EntityAddress = address; // b.EntityType = 3; // context.BusinessEntity.Add(b); await context.SaveChangesAsync(); }
public async Task addToVendorsList(AddVendorListViewModel model, int userId) { OrderfromVendor order = new OrderfromVendor(); order.BrandName = model.brand; order.CategoryId = model.categoryName; order.Color = model.color; order.Quantity = model.quantity; order.Status = 0; order.SubCategoryId = model.subCategoryName; order.UnitofMeasure = model.unitOfMeasure; order.VendorName = model.vendorName; order.WarehouseManager = userId; db.OrderfromVendor.Add(order); await db.SaveChangesAsync(); }
public async Task addShop(MadeToMeasureContext context) { BusinessEntity b = new BusinessEntity(); b.EntityAddress = address; b.EntityType = 1; context.BusinessEntity.Add(b); await context.SaveChangesAsync(); }
public async Task addShop(MadeToMeasureContext context, int shopcode, int warehousecode) { Madetomeasure.Data.Shop shop = new Madetomeasure.Data.Shop(); shop.ShopCode = shopcode; shop.AssociatedWarehouseCode = warehousecode; context.Shop.Add(shop); await context.SaveChangesAsync(); }
public async Task add(MadeToMeasureContext context, int stitchingcode, int warehousecode) { Warehouse warehouse = new Warehouse(); warehouse.AssociatedStitchingUnitCode = stitchingcode; warehouse.WarehouseCode = warehousecode; context.Warehouse.Add(warehouse); await context.SaveChangesAsync(); }
public async Task addItem(AddItemStockViewModel model, int WorksAt) { var ite = from i in db.Item where i.BrandName == model.brand && i.CategoryId == model.categoryName && i.Color == model.color && i.PercentageProfit == model.salePrice && i.SubCategoryId == model.subCategoryName && i.UnitofMeasure == model.unitOfMeasure && i.UnitCostPrice == model.costPrice && i.VendorName == model.vendorName && i.WarehouseCode == WorksAt select i; bool flag = false; foreach (var x in ite) { x.Quantity += model.quantity; flag = true; } if (flag == true) { await db.SaveChangesAsync(); } else { Item item = new Item(); item.BrandName = model.brand; item.CategoryId = model.categoryName; item.Color = model.color; item.PercentageProfit = model.salePrice; item.Quantity = model.quantity; item.SubCategoryId = model.subCategoryName; item.UnitofMeasure = model.unitOfMeasure; item.UnitCostPrice = model.costPrice; item.VendorName = model.vendorName; item.WarehouseCode = WorksAt; db.Item.Add(item); await db.SaveChangesAsync(); } }
public async Task AddStunitEmployee(MadeToMeasureContext context, string name, int id, int duty) { StitchingUnitEmployee st = new StitchingUnitEmployee(); st.Name = name; st.WarehouseId = id; st.DepartmentId = duty; // b.EntityAddress = address; // ;/ b.EntityType = 3; context.StitchingUnitEmployee.Add(st); await context.SaveChangesAsync(); }
public async Task doOrderProcessing(int jobId) { var jobDetail = from stitchingjob in db.StitchingJob where stitchingjob.JobId == jobId select stitchingjob; foreach (var x in jobDetail) { x.WarehouseStatus = 1; } await db.SaveChangesAsync(); }
public async Task addstdp(MadeToMeasureContext context, string name, string id, DateTime date, string password, int entitycode, int deprtmentcode) { Users user = new Users(); user.WorksAt = entitycode; user.UserId = id; user.UserType = 5; user.Password = password; user.JoiningDate = date; user.Name = name; context.Users.Add(user); await context.SaveChangesAsync(); var a = from k in context.Users where k.UserId == id select k.Id; int idd = 0; // b.EntityAddress = address; // ;/ b.EntityType = 3; foreach (var b in a) { idd = (int)b; StitchingUnitDepartmentHead sthead = new StitchingUnitDepartmentHead(); sthead.Id = idd; sthead.AssociatedDepartmentId = deprtmentcode; context.StitchingUnitDepartmentHead.Add(sthead); } await context.SaveChangesAsync(); }
public async Task addemployeecom(MadeToMeasureContext context, string name, string id, DateTime date, string password, int works, int entitycod) { Users user = new Users(); user.WorksAt = works; user.UserId = id; user.UserType = entitycod; user.Password = password; user.JoiningDate = date; user.Name = name; // b.EntityAddress = address; // ;/ b.EntityType = 3; context.Users.Add(user); await context.SaveChangesAsync(); }
public async Task logProductionActivity(MadeToMeasureContext _context, int employeeid, int stitchingjodid, int progressstatus) { ProductionActivity p = new ProductionActivity(); p.StitchingUnitEmployeeId = employeeid; p.TimeStamp = DateTime.Now; p.StitchingJobId = stitchingjodid; p.ProgressStatus = progressstatus; _context.ProductionActivity.Add(p); if (progressstatus == 5) { p.ProgressStatus = 6; } _context.ProductionActivity.Add(p); await _context.SaveChangesAsync(); }
public async Task processOrder(IEnumerable <int> ordersProcessed) { var orders = from p in db.ShopOrder where ordersProcessed.Contains <int>(p.Id) select p; List <int> itemCodes = new List <int>(); List <int> quant = new List <int>(); foreach (var o in orders) { o.WarehouseStatus = 1; itemCodes.Add(o.ItemCode.Value); quant.Add(o.Quantity); } var ite = from p in db.Item where itemCodes.Contains <int>(p.ItemCode) select p; int i = 0; foreach (var o in ite) { o.Quantity = o.Quantity - quant.ElementAt <int>(i); i++; } try { await db.SaveChangesAsync(); } catch (Exception e) { } }