Example #1
0
        public Dictionary <string, object> fetchConfigList(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.fetchConfigList(d);
                r["total"] = dt.Rows.Count;
                //r["items"] = KVTool.TableToListDic(KVTool.GetPagedTable(dt, page,limit));
                r["items"]   = KVTool.RowsToListDic(dt, d);
                r["code"]    = 2000;
                r["message"] = "查询成功";
            }
            catch (Exception e)
            {
                r["total"]   = 0;
                r["items"]   = null;
                r["code"]    = -1;
                r["message"] = e.Message;
            }
            return(r);
        }
Example #2
0
        public Dictionary <string, object> GetInfo(Dictionary <string, object> d)
        {
            //Dictionary<string, object> r = new Dictionary<string, object>();
            //try
            //{
            //    DataTable dt = db.GetInfo(XMBH, XMMC);
            //    if (dt.Rows.Count > 0)
            //    {
            //        r["code"] = 2000;
            //        r["message"] = "success";
            //        r["items"] = KVTool.GetPagedTable(dt, page, limit);
            //        r["total"] = dt.Rows.Count;
            //    }
            //    else
            //    {
            //        r["code"] = 2000;
            //        r["message"] = "success,but no info ";
            //        r["total"] = dt.Rows.Count;
            //    }
            //}
            //catch(Exception e)
            //{
            //    r["code"] = -1;
            //    r["message"] = e.Message;
            //}
            //return r;
            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.GetInfo(d);
                r["total"]   = dt.Rows.Count;
                r["items"]   = KVTool.RowsToListDic(dt, d);
                r["code"]    = 2000;
                r["message"] = "查询成功";
            }
            catch (Exception e)
            {
                r["code"]    = -1;
                r["message"] = e.Message;
            }
            return(r);
        }