コード例 #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public Dictionary <string, object> fetchServiceList(Dictionary <string, object> d)
        {
            Dictionary <string, object> r = new Dictionary <string, object>();

            try
            {
                int       limit = d["limit"] == null ? 100 : int.Parse(d["limit"].ToString());
                int       page  = d["page"] == null ? 1 : int.Parse(d["page"].ToString());
                DataTable dt    = db.fetchServiceList(d);
                r["total"]   = dt.Rows.Count;
                r["items"]   = KVTool.TableToListDic(KVTool.GetPagedTable(dt, page, limit));
                r["code"]    = 2000;
                r["message"] = "查询成功";
            }
            catch (Exception ex)
            {
                r["items"]   = null;
                r["code"]    = -1;
                r["message"] = ex.Message;
            }
            return(r);
        }