LawRule_info.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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. using System.Web.UI.HtmlControls;
  8. namespace SysDataLibs.TableClass
  9. {
  10. #region LawRule
  11. public class LawRule_info : ITableInfo
  12. {
  13. #region LawRule表 字段信息
  14. /// <summary>
  15. /// 为关键字段: N ;
  16. /// 自动增长: N;
  17. /// 数据类型: text;
  18. /// 数据长度: 16;
  19. /// 是否允许为空: Y;
  20. /// 默认值: ;
  21. /// 描述: 内容;
  22. /// </summary>
  23. public const string cContent = "Content";
  24. /// <summary>
  25. /// 为关键字段: N ;
  26. /// 自动增长: N;
  27. /// 数据类型: varchar;
  28. /// 数据长度: 200;
  29. /// 是否允许为空: Y;
  30. /// 默认值: ;
  31. /// 描述: 下载地址;
  32. /// </summary>
  33. public const string cDownUrl = "DownUrl";
  34. /// <summary>
  35. /// 为关键字段: Y --- PrimaryKey;
  36. /// 自动增长: Y;
  37. /// 数据类型: int;
  38. /// 数据长度: 4;
  39. /// 是否允许为空: N;
  40. /// 默认值: ;
  41. /// 描述: 编号;
  42. /// </summary>
  43. public const string cLawRuleId = "LawRuleId";
  44. /// <summary>
  45. /// 为关键字段: N ;
  46. /// 自动增长: N;
  47. /// 数据类型: nvarchar;
  48. /// 数据长度: 400;
  49. /// 是否允许为空: N;
  50. /// 默认值: ;
  51. /// 描述: 法规名称;
  52. /// </summary>
  53. public const string cLawRuleName = "LawRuleName";
  54. /// <summary>
  55. /// 为关键字段: N ;
  56. /// 自动增长: N;
  57. /// 数据类型: int;
  58. /// 数据长度: 4;
  59. /// 是否允许为空: N;
  60. /// 默认值: ;
  61. /// 描述: 法规类型;
  62. /// </summary>
  63. public const string cLawRuleTypeId = "LawRuleTypeId";
  64. /// <summary>
  65. /// 为关键字段: N ;
  66. /// 自动增长: N;
  67. /// 数据类型: smalldatetime;
  68. /// 数据长度: 4;
  69. /// 是否允许为空: Y;
  70. /// 默认值: ;
  71. /// 描述: 发布日期;
  72. /// </summary>
  73. public const string cpromulgateDate = "promulgateDate";
  74. /// <summary>
  75. /// 为关键字段: N ;
  76. /// 自动增长: N;
  77. /// 数据类型: nvarchar;
  78. /// 数据长度: 200;
  79. /// 是否允许为空: Y;
  80. /// 默认值: ;
  81. /// 描述: 发布者;
  82. /// </summary>
  83. public const string cpromulgator = "promulgator";
  84. /// <summary>
  85. /// 为关键字段: N ;
  86. /// 自动增长: N;
  87. /// 数据类型: smalldatetime;
  88. /// 数据长度: 4;
  89. /// 是否允许为空: N;
  90. /// 默认值: ;
  91. /// 描述: 更新时间;
  92. /// </summary>
  93. public const string cUpdateTime = "UpdateTime";
  94. /// <summary>
  95. /// 为关键字段: N ;
  96. /// 自动增长: N;
  97. /// 数据类型: varchar;
  98. /// 数据长度: 20;
  99. /// 是否允许为空: N;
  100. /// 默认值: ;
  101. /// 描述: 用户编号;
  102. /// </summary>
  103. public const string cUserId = "UserId";
  104. #endregion
  105. public LawRule_info() { }
  106. public LawRule_info(DataRow poRow)
  107. {
  108. CreateTableInfo(poRow);
  109. }
  110. public void CreateTableInfo(DataRow poRow)
  111. {
  112. _Content = UtilStr.StrFromObj(poRow[cContent]);
  113. _DownUrl = UtilStr.StrFromObj(poRow[cDownUrl]);
  114. _LawRuleId = UtilStr.StrFromObj(poRow[cLawRuleId]);
  115. _LawRuleName = UtilStr.StrFromObj(poRow[cLawRuleName]);
  116. _LawRuleTypeId = UtilStr.StrFromObj(poRow[cLawRuleTypeId]);
  117. _promulgateDate = UtilStr.StrFromObj(poRow[cpromulgateDate]);
  118. _promulgator = UtilStr.StrFromObj(poRow[cpromulgator]);
  119. _UpdateTime = UtilStr.StrFromObj(poRow[cUpdateTime]);
  120. _UserId = UtilStr.StrFromObj(poRow[cUserId]);
  121. }
  122. public LawRule_info(string pcLawRuleId, DBConnSql poDBConn)
  123. {
  124. if (pcLawRuleId.Trim().Length > 0 && poDBConn != null)
  125. {
  126. string lcSql = "select * from " + Tn.LawRule + " where LawRuleId='" + pcLawRuleId + "'";
  127. rsQuery loQuery = poDBConn.OpenQuery(lcSql);
  128. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1)
  129. {
  130. loQuery.MoveFirst();
  131. CreateTableInfo(loQuery.CurrentRow);
  132. }
  133. }
  134. }
  135. private string _Content = "";
  136. public string Content
  137. {
  138. get { return _Content; }
  139. set { _Content = value; }
  140. }
  141. private string _DownUrl = "";
  142. public string DownUrl
  143. {
  144. get { return _DownUrl; }
  145. set { _DownUrl = value; }
  146. }
  147. private string _LawRuleId = "";
  148. public string LawRuleId
  149. {
  150. get { return _LawRuleId; }
  151. set { _LawRuleId = value; }
  152. }
  153. private string _LawRuleName = "";
  154. public string LawRuleName
  155. {
  156. get { return _LawRuleName; }
  157. set { _LawRuleName = value; }
  158. }
  159. private string _LawRuleTypeId = "";
  160. public string LawRuleTypeId
  161. {
  162. get { return _LawRuleTypeId; }
  163. set { _LawRuleTypeId = value; }
  164. }
  165. private string _promulgateDate = "";
  166. public string promulgateDate
  167. {
  168. get { return _promulgateDate; }
  169. set { _promulgateDate = value; }
  170. }
  171. private string _promulgator = "";
  172. public string promulgator
  173. {
  174. get { return _promulgator; }
  175. set { _promulgator = value; }
  176. }
  177. private string _UpdateTime = "";
  178. public string UpdateTime
  179. {
  180. get { return _UpdateTime; }
  181. set { _UpdateTime = value; }
  182. }
  183. private string _UserId = "";
  184. public string UserId
  185. {
  186. get { return _UserId; }
  187. set { _UserId = value; }
  188. }
  189. [ScriptIgnore]
  190. public rsXmlNode DataXMLNode
  191. {
  192. get
  193. {
  194. rsXmlNode loMainNode = new rsXmlNode("LawRuleRecord", "");
  195. rsXmlNode loNode = null;
  196. loNode = new rsXmlNode(cContent, Content);
  197. loMainNode.AddChild(loNode);
  198. loNode = new rsXmlNode(cDownUrl, DownUrl);
  199. loMainNode.AddChild(loNode);
  200. loNode = new rsXmlNode(cLawRuleId, LawRuleId);
  201. loMainNode.AddChild(loNode);
  202. loNode = new rsXmlNode(cLawRuleName, LawRuleName);
  203. loMainNode.AddChild(loNode);
  204. loNode = new rsXmlNode(cLawRuleTypeId, LawRuleTypeId);
  205. loMainNode.AddChild(loNode);
  206. loNode = new rsXmlNode(cpromulgateDate, promulgateDate);
  207. loMainNode.AddChild(loNode);
  208. loNode = new rsXmlNode(cpromulgator, promulgator);
  209. loMainNode.AddChild(loNode);
  210. loNode = new rsXmlNode(cUpdateTime, UpdateTime);
  211. loMainNode.AddChild(loNode);
  212. loNode = new rsXmlNode(cUserId, UserId);
  213. loMainNode.AddChild(loNode);
  214. return loMainNode;
  215. }
  216. }
  217. public string InsertSql()
  218. {
  219. return " insert into " + Tn.LawRule + " " +
  220. " (" + cContent + "," + cDownUrl + "," + cLawRuleName + "," + cLawRuleTypeId + "," + cpromulgateDate + "," + cpromulgator + "," + cUpdateTime + "," + cUserId + ") " +
  221. " values ('" + _Content + "','" + _DownUrl + "','" + _LawRuleName + "'," + _LawRuleTypeId + ",'" + _promulgateDate + "','" + _promulgator + "','" + _UpdateTime + "','" + _UserId + "') ";
  222. }
  223. public string UpdateSql()
  224. {
  225. return " update " + Tn.LawRule + " " +
  226. " set " + cContent + "='" + _Content + "'," + cDownUrl + "='" + _DownUrl + "'," + cLawRuleName + "='" + _LawRuleName + "'," + cLawRuleTypeId + "=" + _LawRuleTypeId + "," + cpromulgateDate + "='" + _promulgateDate + "'," + cpromulgator + "='" + _promulgator + "'," + cUpdateTime + "='" + _UpdateTime + "'," + cUserId + "='" + _UserId + "' " +
  227. " where " + cLawRuleId + "=" + _LawRuleId + "";
  228. }
  229. public string DeleteSql()
  230. {
  231. return "Delete " + Tn.LawRule + " where " + cLawRuleId + "=" + _LawRuleId + "";
  232. }
  233. public static void PrintLawRuleInfo(HtmlTable poTable, string pcType, UserSession poSession, string pcCurId)
  234. {
  235. if (poTable != null && pcType.Trim().Length > 0 && poSession != null && poSession.DBConn != null)
  236. {
  237. string lcSql = "select Top 50 * from LawRule where LawRuleTypeId='" + pcType + "'";
  238. rsQuery loQuery = poSession.DBConn.OpenQuery(lcSql);
  239. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0)
  240. {
  241. loQuery.SortBy("UpdateTime", false);
  242. loQuery.MoveFirst();
  243. for (int i = 0; i < loQuery.RecCount; i++)
  244. {
  245. string lcColor = "#C6DBFF";
  246. bool lbIsCurLine = pcCurId == loQuery.GetString("LawRuleId");
  247. if (lbIsCurLine)
  248. lcColor = "#8CAAE7";
  249. HtmlTableRow loRow = new HtmlTableRow();
  250. HtmlTableCell loCell = new HtmlTableCell();
  251. loCell.Attributes.Add("bgcolor", lcColor);
  252. loCell.InnerText = (i + 1) + "";
  253. loRow.Cells.Add(loCell);
  254. loCell = new HtmlTableCell();
  255. string lcTitle = loQuery.GetString("LawRuleName");
  256. if (lcTitle.Length < 60)
  257. {
  258. lcTitle += UtilStr.Replicate("&nbsp;", 60 - lcTitle.Length);
  259. }
  260. if (lbIsCurLine)
  261. {
  262. loCell.InnerHtml = string.Format("<div id='row{0}'>{1}</div>\n", loQuery.GetString("LawRuleId"), lcTitle);
  263. }
  264. else
  265. {
  266. loCell.InnerHtml = string.Format("<div style='CURSOR:hand' onclick=\"javascript:ShowContextById({0})\" id='row{0}'>{1}</div>\n", loQuery.GetString("LawRuleId"), lcTitle);
  267. }
  268. loCell.Attributes.Add("bgcolor", lcColor);
  269. loRow.Cells.Add(loCell);
  270. loCell = new HtmlTableCell();
  271. loCell.InnerText = loQuery.GetString("promulgator");
  272. loCell.Attributes.Add("bgcolor", lcColor);
  273. loRow.Cells.Add(loCell);
  274. loCell = new HtmlTableCell();
  275. loCell.InnerHtml = string.Format("{0:d}", loQuery.GetDateTime("promulgateDate"));
  276. loCell.Attributes.Add("bgcolor", lcColor);
  277. loRow.Cells.Add(loCell);
  278. poTable.Rows.Add(loRow);
  279. loCell = new HtmlTableCell();
  280. string lcDownUrl = loQuery.GetString("DownUrl");
  281. if (lcDownUrl.Trim().Length > 0)
  282. {
  283. string ext = lcDownUrl.Substring(lcDownUrl.LastIndexOf(".") + 1, lcDownUrl.Length - lcDownUrl.LastIndexOf(".") - 1);
  284. ext = UtilStr.UAndT(ext);
  285. string lcImg = "RICON100.GIF";
  286. if (ext == "DOC"||ext=="DOCS"||ext == "DOCX")
  287. {
  288. lcImg = "ICON-WORD.GIF";
  289. }
  290. else if (ext == "XLS"||ext=="XLSX")
  291. {
  292. lcImg = "ICON-EXCEL.GIF";
  293. }
  294. else if (ext == "TXT")
  295. {
  296. lcImg = "ftv2doc_3.gif";
  297. }
  298. lcDownUrl = "../" + SysDataLibs.AppEnv.SysSetObj.GetString("UPLOADPATH") + "/" + SysDataLibs.AppEnv.SysSetObj.GetString("LawRuleDown") + "/" + lcDownUrl; //SysBaseLibs.AppConfig.ReadString("DownLoadPath") + lcDownUrl;
  299. loCell.InnerHtml = string.Format(" <a href =\"{0}\"> <IMG style=\"CURSOR: hand\" title=\"下载\" src=\"../Images/{1}\"></a>", lcDownUrl, lcImg);
  300. }
  301. else
  302. {
  303. loCell.InnerHtml = "没有附件";
  304. }
  305. loCell.Attributes.Add("bgcolor", lcColor);
  306. loCell.Attributes.Add("align", "center");
  307. loRow.Cells.Add(loCell);
  308. poTable.Rows.Add(loRow);
  309. if (lbIsCurLine)
  310. {
  311. loRow = new HtmlTableRow();
  312. loCell = new HtmlTableCell();
  313. loCell.Attributes.Add("bgcolor", lcColor);
  314. loCell.Attributes.Add("colspan", "5");
  315. loCell.InnerHtml = loQuery.GetString("Content");
  316. loCell.Attributes.Add("bgcolor", "#FFFBF7");
  317. loRow.Cells.Add(loCell);
  318. poTable.Rows.Add(loRow);
  319. }
  320. loQuery.MoveNext();
  321. }
  322. }
  323. }
  324. }
  325. }
  326. #endregion
  327. #region
  328. public class LawRule_Qry : rsQuery
  329. {
  330. public String Content
  331. {
  332. get { return GetString(LawRule_info.cContent); }
  333. // set { SetField(LawRule_info.cContent, value); }
  334. }
  335. public String DownUrl
  336. {
  337. get { return GetString(LawRule_info.cDownUrl); }
  338. // set { SetField(LawRule_info.cDownUrl, value); }
  339. }
  340. public Int64 LawRuleId
  341. {
  342. get { return GetInt(LawRule_info.cLawRuleId); }
  343. // set { SetField(LawRule_info.cLawRuleId, value); }
  344. }
  345. public String LawRuleName
  346. {
  347. get { return GetString(LawRule_info.cLawRuleName); }
  348. // set { SetField(LawRule_info.cLawRuleName, value); }
  349. }
  350. public Int64 LawRuleTypeId
  351. {
  352. get { return GetInt(LawRule_info.cLawRuleTypeId); }
  353. // set { SetField(LawRule_info.cLawRuleTypeId, value); }
  354. }
  355. public DateTime promulgateDate
  356. {
  357. get { return GetDateTime(LawRule_info.cpromulgateDate); }
  358. // set { SetField(LawRule_info.cpromulgateDate, value); }
  359. }
  360. public String promulgator
  361. {
  362. get { return GetString(LawRule_info.cpromulgator); }
  363. // set { SetField(LawRule_info.cpromulgator, value); }
  364. }
  365. public DateTime UpdateTime
  366. {
  367. get { return GetDateTime(LawRule_info.cUpdateTime); }
  368. // set { SetField(LawRule_info.cUpdateTime, value); }
  369. }
  370. public String UserId
  371. {
  372. get { return GetString(LawRule_info.cUserId); }
  373. // set { SetField(LawRule_info.cUserId, value); }
  374. }
  375. }
  376. #endregion
  377. }