You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.2 KiB
Plaintext
157 lines
5.2 KiB
Plaintext
11 months ago
|
using System;
|
||
|
using System.CodeDom;
|
||
|
using System.CodeDom.Compiler;
|
||
|
using System.Data;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Collections;
|
||
|
using System.IO;
|
||
|
using System.Net;
|
||
|
using System.Xml;
|
||
|
using BP.DA;
|
||
|
using BP.En;
|
||
|
using Microsoft.CSharp;
|
||
|
|
||
|
namespace BP.Sys
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 用户自定义表
|
||
|
/// </summary>
|
||
|
public class SFTableSQL : EntityNoName
|
||
|
{
|
||
|
|
||
|
#region 构造方法
|
||
|
public override UAC HisUAC
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
UAC uac = new UAC();
|
||
|
uac.OpenForSysAdmin();
|
||
|
uac.IsInsert = false;
|
||
|
return uac;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 用户自定义表
|
||
|
/// </summary>
|
||
|
public SFTableSQL()
|
||
|
{
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// EnMap
|
||
|
/// </summary>
|
||
|
public override Map EnMap
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (this._enMap != null)
|
||
|
return this._enMap;
|
||
|
Map map = new Map("Sys_SFTable", "字典表SQL");
|
||
|
|
||
|
|
||
|
map.AddTBStringPK(SFTableAttr.No, null, "表英文名称", true, false, 1, 200, 20);
|
||
|
map.AddTBString(SFTableAttr.Name, null, "表中文名称", true, false, 0, 200, 20);
|
||
|
map.AddDDLSysEnum(SFTableAttr.CodeStruct, 0, "字典表类型", true, false, SFTableAttr.CodeStruct);
|
||
|
map.AddDDLSysEnum(SFTableAttr.DictSrcType, 0, "数据表类型", true, false, SFTableAttr.DictSrcType);
|
||
|
|
||
|
map.AddTBString(SFTableAttr.FK_Val, null, "默认创建的字段名", true, false, 0, 200, 20);
|
||
|
map.AddTBString(SFTableAttr.TableDesc, null, "表描述", true, false, 0, 200, 20);
|
||
|
map.AddTBString(SFTableAttr.DefVal, null, "默认值", true, false, 0, 200, 20);
|
||
|
|
||
|
//数据源.
|
||
|
map.AddDDLEntities(SFTableAttr.FK_SFDBSrc, "local", "数据源", new BP.Sys.SFDBSrcs(), true);
|
||
|
|
||
|
//map.AddTBString(SFTableAttr.ColumnValue, null, "显示的值(编号列)", true, false, 0, 200, 20);
|
||
|
//map.AddTBString(SFTableAttr.ColumnText, null, "显示的文字(名称列)", true, false, 0, 200, 20);
|
||
|
map.AddTBString(SFTableAttr.ParentValue, null, "Root节点的值(对树结构有效)", true, false, 0, 200, 20);
|
||
|
|
||
|
map.AddTBStringDoc(SFTableAttr.SelectStatement, null, "查询语句", true, false);
|
||
|
map.AddTBDateTime(SFTableAttr.RDT, null, "加入日期", false, false);
|
||
|
|
||
|
RefMethod rm = new RefMethod();
|
||
|
rm.Title = "查看数据";
|
||
|
rm.ClassMethodName = this.ToString() + ".DoEdit";
|
||
|
rm.RefMethodType = RefMethodType.RightFrameOpen;
|
||
|
rm.IsForEns = false;
|
||
|
map.AddRefMethod(rm);
|
||
|
this._enMap = map;
|
||
|
return this._enMap;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
/// <summary>
|
||
|
/// 编辑数据
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
public string DoEdit()
|
||
|
{
|
||
|
return "../../Admin/FoolFormDesigner/SFTableEditData.htm?FK_SFTable=" + this.No + "&&QueryType=Sql";
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 删除之前要做的工作
|
||
|
/// </summary>
|
||
|
/// <returns></returns>
|
||
|
protected override bool beforeDelete()
|
||
|
{
|
||
|
MapAttrs mattrs = new MapAttrs();
|
||
|
mattrs.Retrieve(MapAttrAttr.UIBindKey, this.No);
|
||
|
if (mattrs.Count != 0)
|
||
|
{
|
||
|
string err = "";
|
||
|
foreach (MapAttr item in mattrs)
|
||
|
err += " @ " + item.MyPK + " " + item.Name;
|
||
|
throw new Exception("@如下实体字段在引用:" + err + "。您不能删除该表。");
|
||
|
}
|
||
|
return base.beforeDelete();
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 用户自定义表s
|
||
|
/// </summary>
|
||
|
public class SFTableSQLs : EntitiesNoName
|
||
|
{
|
||
|
#region 构造
|
||
|
/// <summary>
|
||
|
/// 用户自定义表s
|
||
|
/// </summary>
|
||
|
public SFTableSQLs()
|
||
|
{
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 得到它的 Entity
|
||
|
/// </summary>
|
||
|
public override Entity GetNewEntity
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return new SFTableSQL();
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 为了适应自动翻译成java的需要,把实体转换成List.
|
||
|
/// <summary>
|
||
|
/// 转化成 java list,C#不能调用.
|
||
|
/// </summary>
|
||
|
/// <returns>List</returns>
|
||
|
public System.Collections.Generic.IList<SFTableSQL> ToJavaList()
|
||
|
{
|
||
|
return (System.Collections.Generic.IList<SFTableSQL>)this;
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 转化成list
|
||
|
/// </summary>
|
||
|
/// <returns>List</returns>
|
||
|
public System.Collections.Generic.List<SFTableSQL> Tolist()
|
||
|
{
|
||
|
System.Collections.Generic.List<SFTableSQL> list = new System.Collections.Generic.List<SFTableSQL>();
|
||
|
for (int i = 0; i < this.Count; i++)
|
||
|
{
|
||
|
list.Add((SFTableSQL)this[i]);
|
||
|
}
|
||
|
return list;
|
||
|
}
|
||
|
#endregion 为了适应自动翻译成java的需要,把实体转换成List.
|
||
|
}
|
||
|
}
|