コード例 #1
0
ファイル: ColumnController.cs プロジェクト: dtscal/DBVortaro
 /// <summary>
 /// 根据(主表同步副表)字段
 /// </summary>
 /// <param name="Params">参数</param>
 /// <param name="tablesCode">表编码</param>
 /// <param name="columnDt">主表</param>
 /// <param name="columnlist">副表</param>
 private void SynchronousSide(NameValueCollection Params, Guid tablesCode, DataTable columnDt, IList <Column> columnlist)
 {
     for (int k = 0; k < columnDt.Rows.Count; k++)
     {
         int columnNumber = 0;//记录主表与副表的交集数
         for (int q = 0; q < columnlist.Count; q++)
         {
             if (columnDt.Rows[k]["columnsName"].ToString() == columnlist[q].Name)
             {
                 columnNumber++;
             }
         }
         //主表存在新的列字段
         if (columnNumber == 0)
         {
             Column column = new Column();
             column.Author     = User.Identity.Name;
             column.TablesCode = tablesCode;
             column.Owner      = columnDt.Rows[k]["owner"].ToString();
             column.Name       = columnDt.Rows[k]["columnsName"].ToString();
             column.Type       = columnDt.Rows[k]["columnType"].ToString();
             column.Bewrite    = columnDt.Rows[k]["remark"].ToString();
             column.FieldState = 1;
             column.HideAuthor = string.Empty;
             column.HideTime   = DateTime.Now;
             column.Code       = Guid.NewGuid();
             DColumn.Add(column);
         }
     }
 }
コード例 #2
0
ファイル: ColumnController.cs プロジェクト: dtscal/DBVortaro
        //保存列字段信息
        public void SaveColumn()
        {
            NameValueCollection Params = HttpContext.Request.Form;//参数
            Column column = new Column();

            column.Author     = User.Identity.Name;
            column.TablesCode = new Guid(Params["tablesCode"]);
            column.Owner      = Params["owner"];
            column.Name       = Params["name"];
            column.Type       = Params["type"];
            column.Bewrite    = Params["bewrite"];
            column.FieldState = int.Parse(Params["fieldState"]);
            column.HideAuthor = Params["hideAuthor"];
            column.HideTime   = DateTime.Now;//默认为空
            string result = string.Empty;

            if (Params["code"] != null)
            {
                column.Code = new Guid(Params["code"]);
                result      = DColumn.Update(column) != null ? "{HasError:false,msg:'列字段编辑成功!'}" : "{HasError:true,msg:'列字段编辑失败,请稍候再试!'}";
            }
            else
            {
                column.Code = Guid.NewGuid();
                result      = DColumn.Add(column) != null ? "{HasError:false,msg:'列字段创建成功!'}" : "{HasError:true,msg:'列字段创建失败,请稍候再试!'}";
            }
            Response.Write(result);
            Response.End();
        }
コード例 #3
0
 /// <summary>
 /// 批量添加列字段信息
 /// </summary>
 /// <param name="resultT">执行结果</param>
 /// <param name="table">表信息</param>
 /// <param name="dt">列字段信息</param>
 /// <returns></returns>
 private bool BatchAddColumn(bool resultT, Tables table, DataTable dt)
 {
     for (int j = 0; j < dt.Rows.Count; j++)
     {
         //列名是否重复,重复则不执行保存操作
         string columnName = dt.Rows[j]["columnsName"].ToString();
         if (!DColumn.RepeatColumnName(columnName, table.Code, User.Identity.Name))
         {
             Column column = new Column();
             column.Author     = User.Identity.Name;
             column.TablesCode = table.Code;
             column.Owner      = dt.Rows[j]["owner"].ToString();
             column.Name       = columnName;
             column.Type       = dt.Rows[j]["columnType"].ToString();
             column.Bewrite    = dt.Rows[j]["remark"].ToString();
             column.FieldState = 1;
             column.HideAuthor = "";
             column.HideTime   = DateTime.Now; //默认为空
             column.Code       = Guid.NewGuid();
             DColumn.Add(column);              //添加列
             resultT = true;
         }
     }
     return(resultT);
 }