SellerHasStall_info.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 SellerHasStall
  10. public class SellerHasStall_info : ITableInfo
  11. {
  12. #region SellerHasStall表 字段信息
  13. /// <summary>
  14. /// 为关键字段: Y --- PrimaryKey;
  15. /// 自动增长: N;
  16. /// 数据类型: int;
  17. /// 数据长度: 4;
  18. /// 是否允许为空: N;
  19. /// 默认值: ;
  20. /// 描述: 经营户编号;
  21. /// </summary>
  22. public const string cSellerID = "SellerID";
  23. /// <summary>
  24. /// 为关键字段: Y --- PrimaryKey;
  25. /// 自动增长: N;
  26. /// 数据类型: int;
  27. /// 数据长度: 4;
  28. /// 是否允许为空: N;
  29. /// 默认值: ;
  30. /// 描述: 摊位编号;
  31. /// </summary>
  32. public const string cStallID = "StallID";
  33. #endregion
  34. public SellerHasStall_info() { }
  35. public SellerHasStall_info(DataRow poRow)
  36. {
  37. CreateTableInfo(poRow);
  38. }
  39. public void CreateTableInfo(DataRow poRow)
  40. {
  41. _SellerID = UtilStr.StrFromObj(poRow[cSellerID]);
  42. _StallID = UtilStr.StrFromObj(poRow[cStallID]);
  43. }
  44. public SellerHasStall_info(string pcSellerID, string pcStallID, DBConnSql poDBConn)
  45. {
  46. if (pcSellerID.Trim().Length > 0 && pcStallID.Trim().Length > 0 && poDBConn != null)
  47. {
  48. string lcSql = "select * from " + Tn.SellerHasStall + " where SellerID='" + pcSellerID + "' and StallID='" + pcStallID + "'";
  49. rsQuery loQuery = poDBConn.OpenQuery(lcSql);
  50. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount == 1)
  51. {
  52. loQuery.MoveFirst();
  53. CreateTableInfo(loQuery.CurrentRow);
  54. }
  55. }
  56. }
  57. private string _SellerID = "";
  58. public string SellerID
  59. {
  60. get { return _SellerID; }
  61. set { _SellerID = value; }
  62. }
  63. private string _StallID = "";
  64. public string StallID
  65. {
  66. get { return _StallID; }
  67. set { _StallID = value; }
  68. }
  69. [ScriptIgnore]
  70. public rsXmlNode DataXMLNode
  71. {
  72. get
  73. {
  74. rsXmlNode loMainNode = new rsXmlNode("SellerHasStallRecord", "");
  75. rsXmlNode loNode = null;
  76. loNode = new rsXmlNode(cSellerID, SellerID);
  77. loMainNode.AddChild(loNode);
  78. loNode = new rsXmlNode(cStallID, StallID);
  79. loMainNode.AddChild(loNode);
  80. return loMainNode;
  81. }
  82. }
  83. public string InsertSql()
  84. {
  85. return " insert into " + Tn.SellerHasStall + " " +
  86. " (" + cSellerID + "," + cStallID + ") " +
  87. " values (" + _SellerID + "," + _StallID + ") ";
  88. }
  89. public string UpdateSql()
  90. {
  91. return "";
  92. }
  93. public string DeleteSql()
  94. {
  95. return "Delete " + Tn.SellerHasStall + " where " + cSellerID + "=" + _SellerID + " and " + cStallID + "=" + _StallID + "";
  96. }
  97. public static string GetStallInfobySellerId(string pcSellerId, DBConnSql poDBConn)
  98. {
  99. string lcRetVal = "";
  100. string lcSql = " select * from SellerHasStall where SellerID =" + pcSellerId + "";
  101. rsQuery loQuery = poDBConn.OpenQuery(lcSql);
  102. if (loQuery != null && loQuery.IsOpened && loQuery.RecCount > 0)
  103. {
  104. loQuery.MoveFirst();
  105. for (int i = 0; i < loQuery.RecCount; i++)
  106. {
  107. lcRetVal += (lcRetVal == "" ? "" : ",") + loQuery.GetString("StallID");
  108. loQuery.MoveNext();
  109. }
  110. }
  111. return lcRetVal;
  112. }
  113. public static bool UpdateStallBySellerId(string pcSellerId, string pcStallList, DBConnSql poConn)
  114. {
  115. bool lbRetVal = false;
  116. string lcSql = " Delete SellerHasStall where SellerID=" + pcSellerId + " \r\n ";
  117. if (pcStallList.Trim().Length > 0)
  118. {
  119. Array loArr = UtilStr.StrToArrayEx(pcStallList, ",");
  120. if (loArr != null && loArr.Length > 0)
  121. {
  122. foreach (string lcStallId in loArr)
  123. {
  124. string Stallid = UtilStr.FormatStr(lcStallId);
  125. if (lcStallId.Trim().Length > 0)
  126. lcSql += " insert into SellerHasStall (SellerID,StallID) values (" + pcSellerId + "," + Stallid + ") \r\n ";
  127. }
  128. }
  129. }
  130. if (poConn != null)
  131. {
  132. lbRetVal = poConn.ExcuteSqlTran(lcSql);
  133. }
  134. return lbRetVal;
  135. }
  136. }
  137. #endregion
  138. #region
  139. public class SellerHasStall_Qry : rsQuery
  140. {
  141. public Int64 SellerID
  142. {
  143. get { return GetInt(SellerHasStall_info.cSellerID); }
  144. // set { SetField(SellerHasStall_info.cSellerID, value); }
  145. }
  146. public Int64 StallID
  147. {
  148. get { return GetInt(SellerHasStall_info.cStallID); }
  149. // set { SetField(SellerHasStall_info.cStallID, value); }
  150. }
  151. }
  152. #endregion
  153. }