public void do_Print() { if (do_Validation()) { return; } try { var req = new ProductPrintRequest { ProductBegin = Convert.ToInt32(lp_PRoductBegin.EditValue), ProductEnd = Convert.ToInt32(lp_PRoductEnd.EditValue), companyId = lc_Company.EditValue == null ? 0 : (int)lc_Company.EditValue, DepotId = lc_Depot.EditValue == null ? 0 : (int)lc_Depot.EditValue }; List <ProductDTO> data = new List <ProductDTO>(); data = _repository.Run <ReportService, List <ProductDTO> >(x => x.Get_List_EnvanterBilgisi(req)); if (data.Count > 0) { frmPrint frm = new frmPrint(); frm.PrintEnvanterBilgisi(data); frm.ShowDialog(); } } catch (Exception ex) { } }
public List <ProductDTO> Get_List_EnvanterBilgisi(ProductPrintRequest req) { using (var _db = new MspDbContext()) { List <ProductDTO> products = new List <ProductDTO>(); products = base.Map <List <Products>, List <ProductDTO> >(_db.products.Where(x => x.PID >= req.ProductBegin && x.PID <= req.ProductEnd).ToList()); if (req.DepotId != 0) { products = products.Where(x => x.PDepotId == req.DepotId).ToList(); } if (req.companyId != 0) { products = products.Where(x => x.PCompanyId == req.companyId).ToList(); } return(products); } }