private void BindInv() { var invs1 = from idt in uow.InvDepts.GetAll().Where(w => w.Dept == App.MyIdentity.dept.DeptId) select idt.Inv; var invs = from i in uow.Inventory.GetAll() orderby i.Code where invs1.Contains(i.Id) select i; if (lvCategory.SelectedItem != null) { DXInfo.Models.InventoryCategory ic = lvCategory.SelectedItem as DXInfo.Models.InventoryCategory; invs = invs.Where(w => w.Category == ic.Id); } lvInv.ItemsSource = invs.ToList(); }
private void BindInv() { var invs = from i in uow.Inventory.GetAll() join idt in uow.InvDepts.GetAll().Where(w => w.Dept == App.MyIdentity.dept.DeptId) on i.Id equals idt.Inv select i; if (lvCategory.SelectedItem != null) { DXInfo.Models.InventoryCategory ic = lvCategory.SelectedItem as DXInfo.Models.InventoryCategory; invs = invs.Where(w => w.Category == ic.Id); } var linvs = invs.ToList(); string strpath = AppDomain.CurrentDomain.BaseDirectory; var inv = linvs.Select(s => new { s.Id, s.Code, s.Name, s.Category, s.SalePrice, s.SalePrice0, s.SalePrice1, s.SalePrice2 , ImageFileName = strpath + @"images\" + s.ImageFileName }); lvInv.ItemsSource = inv; }
public void SyncGT(IAMSCMUow amscmUow) { var ltbCommCode = amscmUow.tbCommCode.GetAll().Where(w => w.vcCommSign == "GT").ToList(); foreach (DXInfo.Models.tbCommCode commCode in ltbCommCode) { var oldInvCat = uow.InventoryCategory.GetAll().Where(w => w.Code == commCode.vcCommCode).FirstOrDefault(); if (oldInvCat == null) { DXInfo.Models.InventoryCategory newInvCat = new DXInfo.Models.InventoryCategory(); newInvCat.Code = commCode.vcCommCode; newInvCat.Name = commCode.vcCommName; if (System.Configuration.ConfigurationManager.AppSettings.AllKeys.Contains("AMSApp")) { newInvCat.ProductType = (int)DXInfo.Models.ProductType.Product; } newInvCat.CategoryType = (int)DXInfo.Models.CategoryType.StockManage; uow.InventoryCategory.Add(newInvCat); } } uow.Commit(); }