Exemplo n.º 1
0
        public object LoadMenu(dynamic obj)
        {
            //Dictionary<string, object> result = new Dictionary<string, object>();
            string    strSql = "SELECT SYS_PERMISSION_ID as ID,CNAME AS NAME,PID,CURL,IORDER FROM SYS_PERMISSION order by iorder ";
            Database  db     = DataBaseHelper.CreateDataBase();
            DataTable dt;

            //DataTable reDataTable;

            using (DbConnection conn = db.CreateConnection())
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                dt = db.ExecuteDataSet(CommandType.Text, strSql).Tables[0];
            }
            ArrayList list = FormatJsonExtension.DataTableArrayList(dt);

            return(this.JsonFormat(list));
        }
Exemplo n.º 2
0
        public object LoadStoredProcedureMenu(dynamic obj)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();
            string    strSql = "存储过程";
            Database  db     = DataBaseHelper.CreateDataBase();
            DataTable dt;

            using (DbConnection conn = db.CreateConnection())
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                dt = db.ExecuteDataSet(CommandType.StoredProcedure, strSql).Tables[0];
            }
            ArrayList list = FormatJsonExtension.DataTableArrayList(dt);

            result.Add("code", "200");
            result.Add("msg", "ok");
            result.Add("data", list);
            result.Add("count", list.Count);

            return(result);
        }