public List<ProductCategorySetCustom> Query(ProductCategorySetCustom query) { try { return _categorySetDao.Query(query); } catch (Exception ex) { throw new Exception("ProductCategorySetMgr-->Query(ProductCategorySetCustom query)-->" + ex.Message, ex); } }
public List<ProductCategorySetCustom> Query(ProductCategorySetCustom query) { //string sql = string.Format("select s.category_id,c.category_name from product_category_set s inner join product_category c on c.category_id = s.category_id where s.product_id = {0}", query.Product_Id); //return _access.getDataTableForObj<ProductCategorySetCustom>(sql); StringBuilder sb = new StringBuilder(); string sql = "select s.category_id,c.category_name from product_category_set s inner join product_category c on c.category_id = s.category_id where 1=1 "; if (0 != query.Product_Id) { sb.AppendFormat(" and s.product_id = {0}", query.Product_Id); } if (0 != query.Category_Id) { sb.AppendFormat(" and s.category_id = {0}", query.Category_Id); } //sb.AppendFormat(); //+" s.product_id = {0}", query.Product_Id); return _access.getDataTableForObj<ProductCategorySetCustom>(sql + sb.ToString()); }
public List<ProductCategorySetCustom> QueryByCategory(ProductCategorySetCustom query) { string sql = string.Format("select s.category_id,c.category_name from product_category_set s inner join product_category c on c.category_id = s.category_id where s.category_id = {0} ", query.Category_Id); return _access.getDataTableForObj<ProductCategorySetCustom>(sql); }