Example #1
0
        /// <summary>
        /// 獲取滿額滿件送禮列表頁
        /// </summary>
        /// <param name="query">TrialProdCateQuery query對象 </param>
        /// <param name="totalCount">輸出總行數</param>
        /// <returns>List<Model.Query.TrialProdCateQuery>對象</returns>
        public List<TrialProdCateQuery> Query(TrialProdCateQuery query, out int totalCount)
        {
            StringBuilder sql = new StringBuilder();
            query.Replace4MySQL();
            try
            {
                sql.Append(" select id,event_id,type,product_id,category_id,start_date,end_date from trial_prod_cate ");
                sql.Append(" order by id desc ");
                totalCount = 0;
                if (query.IsPage)
                {
                    System.Data.DataTable _dt = _access.getDataTable(sql.ToString());
                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = _dt.Rows.Count;
                    }
                    sql.AppendFormat("  limit {0},{1}", query.Start, query.Limit);
                }
                sql.AppendFormat(";");

                return _access.getDataTableForObj<TrialProdCateQuery>(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("TrialProdCateDao-->Query-->" + ex.Message + sql.ToString(), ex);
            }
        }