PlatRegDsn_info.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. using SysBaseLibs;
  6. using System.Web.Script.Serialization;
  7. namespace SysDataLibs.TableClass
  8. {
  9. #region PlatRegDsn
  10. public class PlatRegDsn_info : ITableInfo
  11. {
  12. #region PlatRegDsn表 字段信息
  13. /// <summary>
  14. /// 为关键字段: N ;
  15. /// 自动增长: N;
  16. /// 数据类型: nvarchar;
  17. /// 数据长度: 100;
  18. /// 是否允许为空: Y;
  19. /// 默认值: ;
  20. /// 描述: Description;
  21. /// </summary>
  22. public const string cDescription = "Description";
  23. /// <summary>
  24. /// 为关键字段: N ;
  25. /// 自动增长: N;
  26. /// 数据类型: varchar;
  27. /// 数据长度: 50;
  28. /// 是否允许为空: N;
  29. /// 默认值: ;
  30. /// 描述: PlatDsName;
  31. /// </summary>
  32. public const string cPlatDsName = "PlatDsName";
  33. /// <summary>
  34. /// 为关键字段: Y --- PrimaryKey;
  35. /// 自动增长: N;
  36. /// 数据类型: varchar;
  37. /// 数据长度: 50;
  38. /// 是否允许为空: N;
  39. /// 默认值: ;
  40. /// 描述: TableId;
  41. /// </summary>
  42. public const string cTableId = "TableId";
  43. #endregion
  44. public PlatRegDsn_info(){}
  45. public PlatRegDsn_info(DataRow poRow)
  46. {
  47. CreateTableInfo(poRow);
  48. }
  49. public void CreateTableInfo(DataRow poRow)
  50. {
  51. _Description=UtilStr.StrFromObj(poRow[cDescription]);
  52. _PlatDsName=UtilStr.StrFromObj(poRow[cPlatDsName]);
  53. _TableId=UtilStr.StrFromObj(poRow[cTableId]);
  54. }
  55. public PlatRegDsn_info( string pcTableId, DBConnSql poDBConn)
  56. {
  57. if ( pcTableId.Trim().Length > 0 && poDBConn != null)
  58. {
  59. string lcSql = "select * from " + Tn.PlatRegDsn + " where TableId='"+pcTableId+"'";
  60. rsQuery loQuery = poDBConn.OpenQuery(lcSql);
  61. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1)
  62. {
  63. loQuery.MoveFirst();
  64. CreateTableInfo(loQuery.CurrentRow);
  65. }
  66. }
  67. }
  68. private string _Description="";
  69. public string Description
  70. {
  71. get { return _Description; }
  72. set { _Description = value; }
  73. }
  74. private string _PlatDsName="";
  75. public string PlatDsName
  76. {
  77. get { return _PlatDsName; }
  78. set { _PlatDsName = value; }
  79. }
  80. private string _TableId="";
  81. public string TableId
  82. {
  83. get { return _TableId; }
  84. set { _TableId = value; }
  85. }
  86. [ScriptIgnore]
  87. public rsXmlNode DataXMLNode
  88. {
  89. get
  90. {
  91. rsXmlNode loMainNode = new rsXmlNode("PlatRegDsnRecord", "");
  92. rsXmlNode loNode =null;
  93. loNode = new rsXmlNode(cDescription, Description);
  94. loMainNode.AddChild(loNode);
  95. loNode = new rsXmlNode(cPlatDsName, PlatDsName);
  96. loMainNode.AddChild(loNode);
  97. loNode = new rsXmlNode(cTableId, TableId);
  98. loMainNode.AddChild(loNode);
  99. return loMainNode ;
  100. }
  101. }
  102. public string InsertSql()
  103. {
  104. return " insert into "+Tn.PlatRegDsn+" "+
  105. " ("+cDescription+","+cPlatDsName+","+cTableId+") "+
  106. " values ('"+_Description+"','"+_PlatDsName+"','"+_TableId+"') " ;
  107. }
  108. public string UpdateSql()
  109. {
  110. return " update "+Tn.PlatRegDsn+" "+
  111. " set "+cDescription+"='"+_Description+"',"+cPlatDsName+"='"+_PlatDsName+"' "+
  112. " where "+cTableId+"='"+_TableId+"'" ;
  113. }
  114. public string DeleteSql()
  115. {
  116. return "Delete "+Tn.PlatRegDsn+" where "+cTableId+"='"+_TableId+"'" ;
  117. }
  118. }
  119. #endregion
  120. #region
  121. public class PlatRegDsn_Qry : rsQuery
  122. {
  123. public String Description
  124. {
  125. get { return GetString(PlatRegDsn_info.cDescription); }
  126. // set { SetField(PlatRegDsn_info.cDescription, value); }
  127. }
  128. public String PlatDsName
  129. {
  130. get { return GetString(PlatRegDsn_info.cPlatDsName); }
  131. // set { SetField(PlatRegDsn_info.cPlatDsName, value); }
  132. }
  133. public String TableId
  134. {
  135. get { return GetString(PlatRegDsn_info.cTableId); }
  136. // set { SetField(PlatRegDsn_info.cTableId, value); }
  137. }
  138. }
  139. #endregion
  140. }