Esempio n. 1
0
        /// <summary>
        /// 加载数据库表字段 返回JSon
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFieldJson()
        {
            string        tableCode = Request["tableCode"];//表名
            StringBuilder sb        = new StringBuilder();
            DataTable     dt        = Basedatabasebll.GetColumnList(tableCode);

            sb.Append("[");
            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("{");
                sb.Append("\"id\":\"" + dr["column"].ToString() + "\",");
                sb.Append("\"text\":\"" + dr["remark"].ToString() + "\",");
                sb.Append("\"value\":\"" + dr["column"].ToString() + "\",");
                sb.Append("\"title\":\"" + dr["column"].ToString() + "\",");
                sb.Append("\"length\":\"" + dr["length"].ToString() + "\",");
                sb.Append("\"showcheck\":true,");
                sb.Append("\"checkstate\":0,");
                sb.Append("\"isexpand\":true,");
                sb.Append("\"hasChildren\":false");
                sb.Append("},");
            }
            sb = sb.Remove(sb.Length - 1, 1);
            sb.Append("]");
            return(Content(sb.ToString()));
        }
Esempio n. 2
0
        public ActionResult FormSubmit()
        {
            BaseDataBaseBll Basedatabasebll = new BaseDataBaseBll();


            StringBuilder      sb        = new StringBuilder();
            StringBuilder      values    = new StringBuilder("(");
            DataTable          dt        = Basedatabasebll.GetColumnList("TestTable");
            List <DbParameter> parameter = new List <DbParameter>();

            sb.Append("INSERT INTO TestTable (");
            foreach (DataRow dr in dt.Rows)
            {
                string filed = dr["column"].ToString();
                parameter.Add(DbFactory.CreateDbParameter($"@{filed}", Request.Form[$"Build_{filed}"]));
                sb.Append($"[{filed}],");
                values.Append($"@{filed},");
            }
            sb.Append(") values");
            values.Append(")");

            base.Repositoryfactory.Repository().ExecuteBySql(sb.Append(values).Replace(",)", ")"), parameter.ToArray());


            Console.WriteLine(parameter);


            return(Content("xxxxxxxxxxxxxxxxxxx"));
        }
Esempio n. 3
0
 /// <summary>
 /// 【数据库管理】返回列表JONS
 /// </summary>
 /// <returns></returns>
 public ActionResult GridColumnListJson(string tableName)
 {
     try
     {
         DataTable listData = _baseDatabasebll.GetColumnList(tableName);
         var       jsonData = new
         {
             rows = listData,
         };
         return(Content(Util.Json.ToJson(jsonData)));
     }
     catch (Exception ex)
     {
         BaseSysLogBll.Instance.WriteLog("", OperationType.Query, "-1", "异常错误:" + ex.Message);
         return(null);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 加载数据库表字段 返回JSon
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFieldTreeJson(string tableCode)
        {
            StringBuilder sb = new StringBuilder();
            DataTable     dt = new DataTable();

            if (Config.GetValue("CodeMaticMode") == "PowerDesigner")
            {
                dt = _codematicbll.GetColumns(tableCode);
            }
            else if (Config.GetValue("CodeMaticMode") == "DataBase")
            {
                dt = _basedatabasebll.GetColumnList(tableCode);
                dt.Columns["column"].ColumnName   = "column_Name";
                dt.Columns["datatype"].ColumnName = "data_type";
                dt.Columns["length"].ColumnName   = "char_col_decl_length";
                dt.Columns["remark"].ColumnName   = "comments";
            }
            return(Content(Util.Json.ToJson(dt)));
        }