/// <summary> /// get items by category /// </summary> /// <param name="category">Category Description</param> /// <returns></returns> public List<Model.Item> getItemByCategory(string category) { Model.ItemCategory cat = new Model.ItemCategory(); cat = (from c in ctx.ItemCategory where c.ItemDescription == category select c).First(); var items = from c in ctx.Item where cat.ItemCatID == c.ItemCatID select c; return items.ToList(); }
/// <summary> /// get items by category /// </summary> /// <param name="category">Category Description</param> /// <returns></returns> public List <Model.Item> getItemByCategory(string category) { Model.ItemCategory cat = new Model.ItemCategory(); cat = (from c in ctx.ItemCategory where c.ItemDescription == category select c).First(); var items = from c in ctx.Item where cat.ItemCatID == c.ItemCatID select c; return(items.ToList()); }
public static ViewWayBill prepareWB(Guid wbId) { using (var db = new SCMSEntities()) { WayBill entitymodel = db.WayBills.First(p => p.Id == wbId); ViewWayBill model = new ViewWayBill(); model.EntityWBill = entitymodel; WarehouseRelease wrn = model.EntityWBill.WarehouseRelease; model.issuer = db.VStaffDetails.FirstOrDefault(p => p.StaffID == entitymodel.PreparedBy); model.consignee = db.VStaffDetails.FirstOrDefault(p => p.StaffID == entitymodel.Consignee); model.ReceivedBy = db.VStaffDetails.FirstOrDefault(p => p.StaffID == entitymodel.ReceivedBy); model.OrrignWH = db.WareHouses.FirstOrDefault(p => p.Id == entitymodel.IssuerWarehouse); model.destinationWH = db.WareHouses.FirstOrDefault(p => p.Id == entitymodel.DestinationWarehouse); model.DestnationOfiice = db.CountrySubOffices.FirstOrDefault(p => p.Id == entitymodel.DestinationOffice); Model.Location loc = model.destinationWH.Location; Model.CountrySubOffice cso = model.destinationWH.CountrySubOffice; model.OrignSOfiice = db.CountrySubOffices.First(p => p.Id == entitymodel.IssuingOffice); Model.Location l = model.OrignSOfiice.Location; Model.Location lok = model.DestnationOfiice.Location; List <WarehouseReleaseItem> writems = entitymodel.WarehouseRelease.WarehouseReleaseItems.ToList(); foreach (WarehouseReleaseItem item in writems) { Model.Inventory inv = item.Inventory; Model.Item it = inv.Item; Model.ItemCategory ic = it.ItemCategory; Model.UnitOfMeasure u = it.UnitOfMeasure; Model.Asset ast = item.Asset; } model.WRItems = writems; //dummies var person = entitymodel.Staff.Person; if (entitymodel.Staff1 != null) { person = entitymodel.Staff1.Person; } return(model); } }
public static BasicCategory ConvertToDTO(this Model.ItemCategory category) { if (category.ItemCategories1.Any()) { var dtoCategory = new Category(); dtoCategory.ID = category.ID; dtoCategory.Name = category.Name; dtoCategory.ParentId = category.ParentCategoryID; foreach (var child in category.ItemCategories1) { dtoCategory.Children.Add(child.ConvertToDTO()); } return(dtoCategory); } return(new BasicCategory() { ID = category.ID, Name = category.Name, ParentId = category.ParentCategoryID }); }
public ActionResult WBReceive() { using (var db = new SCMSEntities()) { WarehouseRelease wrn = db.WarehouseReleases.FirstOrDefault <WarehouseRelease>(); List <WarehouseReleaseItem> itmz = wrn != null?wrn.WarehouseReleaseItems.ToList() : new List <WarehouseReleaseItem>(); foreach (WarehouseReleaseItem item in itmz) { Model.Inventory iv = item.Inventory; Model.Item it = iv.Item; Model.ItemCategory itc = it.ItemCategory; Model.Asset ast = item.Asset; Model.UnitOfMeasure u = it.UnitOfMeasure; } //Use this to populate items on load for any changes in the stolen code //WayBill wb = db.WayBills.First(p => p.Id == new Guid("0D88562F-BBEC-4722-941B-91FC4D82BB1C")); //List<WarehouseReleaseItem> wrnn = db.WarehouseReleases.FirstOrDefault(p => p.Id == wb.WRNId).WarehouseReleaseItems.ToList(); //foreach (WarehouseReleaseItem item in wrnn) //{ // Model.Asset ass = item.Asset; // Model.Inventory iv = item.Inventory; // Model.Item it = iv.Item; // Model.ItemCategory ic = it.ItemCategory; // Model.UnitOfMeasure u = it.UnitOfMeasure; //} var model = new ReceiveWB() { EntityWBill = new WayBill(), IssuingOffice = new SelectList(WBService.GetSubOffices(countryProg.Id), "Id", "Name"), WBlist = new SelectList(WBService.GetWayBillsNotReceived(countryProg.Id), "Id", "RefNumber"), WRItems = new List <WarehouseReleaseItem>()//wrnn }; return(View(model)); } }