using System; using System.Collections.Generic; using System.Text; using System.Data; using SysBaseLibs; using System.Web.Script.Serialization; namespace SysDataLibs.TableClass { #region PlatRegDsn public class PlatRegDsn_info : ITableInfo { #region PlatRegDsn表 字段信息 /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: nvarchar; /// 数据长度: 100; /// 是否允许为空: Y; /// 默认值: ; /// 描述: Description; /// public const string cDescription = "Description"; /// /// 为关键字段: N ; /// 自动增长: N; /// 数据类型: varchar; /// 数据长度: 50; /// 是否允许为空: N; /// 默认值: ; /// 描述: PlatDsName; /// public const string cPlatDsName = "PlatDsName"; /// /// 为关键字段: Y --- PrimaryKey; /// 自动增长: N; /// 数据类型: varchar; /// 数据长度: 50; /// 是否允许为空: N; /// 默认值: ; /// 描述: TableId; /// public const string cTableId = "TableId"; #endregion public PlatRegDsn_info(){} public PlatRegDsn_info(DataRow poRow) { CreateTableInfo(poRow); } public void CreateTableInfo(DataRow poRow) { _Description=UtilStr.StrFromObj(poRow[cDescription]); _PlatDsName=UtilStr.StrFromObj(poRow[cPlatDsName]); _TableId=UtilStr.StrFromObj(poRow[cTableId]); } public PlatRegDsn_info( string pcTableId, DBConnSql poDBConn) { if ( pcTableId.Trim().Length > 0 && poDBConn != null) { string lcSql = "select * from " + Tn.PlatRegDsn + " where TableId='"+pcTableId+"'"; rsQuery loQuery = poDBConn.OpenQuery(lcSql); if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1) { loQuery.MoveFirst(); CreateTableInfo(loQuery.CurrentRow); } } } private string _Description=""; public string Description { get { return _Description; } set { _Description = value; } } private string _PlatDsName=""; public string PlatDsName { get { return _PlatDsName; } set { _PlatDsName = value; } } private string _TableId=""; public string TableId { get { return _TableId; } set { _TableId = value; } } [ScriptIgnore] public rsXmlNode DataXMLNode { get { rsXmlNode loMainNode = new rsXmlNode("PlatRegDsnRecord", ""); rsXmlNode loNode =null; loNode = new rsXmlNode(cDescription, Description); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cPlatDsName, PlatDsName); loMainNode.AddChild(loNode); loNode = new rsXmlNode(cTableId, TableId); loMainNode.AddChild(loNode); return loMainNode ; } } public string InsertSql() { return " insert into "+Tn.PlatRegDsn+" "+ " ("+cDescription+","+cPlatDsName+","+cTableId+") "+ " values ('"+_Description+"','"+_PlatDsName+"','"+_TableId+"') " ; } public string UpdateSql() { return " update "+Tn.PlatRegDsn+" "+ " set "+cDescription+"='"+_Description+"',"+cPlatDsName+"='"+_PlatDsName+"' "+ " where "+cTableId+"='"+_TableId+"'" ; } public string DeleteSql() { return "Delete "+Tn.PlatRegDsn+" where "+cTableId+"='"+_TableId+"'" ; } } #endregion #region public class PlatRegDsn_Qry : rsQuery { public String Description { get { return GetString(PlatRegDsn_info.cDescription); } // set { SetField(PlatRegDsn_info.cDescription, value); } } public String PlatDsName { get { return GetString(PlatRegDsn_info.cPlatDsName); } // set { SetField(PlatRegDsn_info.cPlatDsName, value); } } public String TableId { get { return GetString(PlatRegDsn_info.cTableId); } // set { SetField(PlatRegDsn_info.cTableId, value); } } } #endregion }