CeErpCustomer.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using Castle.ActiveRecord;
  2. using NHibernate.Criterion;
  3. using System;
  4. using System.Text;
  5. namespace BizCom
  6. {
  7. [ActiveRecord("CE_ErpCustomer")]
  8. public class CeErpCustomer : ComBase<CeErpCustomer>
  9. {
  10. /// <summary>
  11. ///
  12. /// </summary>
  13. [PrimaryKey(PrimaryKeyType.Native)]
  14. public int ID { get; set; }
  15. private string _buyer_nick = "";
  16. /// <summary>
  17. ///买家昵称
  18. /// </summary>
  19. [Property]
  20. public string buyer_nick
  21. {
  22. get { return _buyer_nick; }
  23. set { _buyer_nick = value; }
  24. }
  25. private string _star_flag = "";
  26. /// <summary>
  27. ///星标
  28. /// </summary>
  29. [Property]
  30. public string star_flag
  31. {
  32. get { return _star_flag; }
  33. set { _star_flag = value; }
  34. }
  35. private int _buy_day = 0;
  36. /// <summary>
  37. ///
  38. /// </summary>
  39. [Property]
  40. public int buy_day
  41. {
  42. get { return _buy_day; }
  43. set { _buy_day = value; }
  44. }
  45. private string _phone = "";
  46. /// <summary>
  47. ///电话
  48. /// </summary>
  49. [Property]
  50. public string phone
  51. {
  52. get { return _phone; }
  53. set { _phone = value; }
  54. }
  55. private string _address = "";
  56. /// <summary>
  57. ///地址
  58. /// </summary>
  59. [Property]
  60. public string address
  61. {
  62. get { return _address; }
  63. set { _address = value; }
  64. }
  65. private double _total_fee = 0;
  66. /// <summary>
  67. ///总金额
  68. /// </summary>
  69. [Property]
  70. public double total_fee
  71. {
  72. get { return _total_fee; }
  73. set { _total_fee = value; }
  74. }
  75. private int _buy_count = 0;
  76. /// <summary>
  77. ///购买次数
  78. /// </summary>
  79. [Property]
  80. public int buy_count
  81. {
  82. get { return _buy_count; }
  83. set { _buy_count = value; }
  84. }
  85. /// <summary>
  86. ///最后购买时间
  87. /// </summary>
  88. [Property]
  89. public DateTime? lastbuy_time { get; set; }
  90. private string _seller_nick = "";
  91. /// <summary>
  92. ///
  93. /// </summary>
  94. [Property]
  95. public string seller_nick
  96. {
  97. get { return _seller_nick; }
  98. set { _seller_nick = value; }
  99. }
  100. private int _product_count = 0;
  101. /// <summary>
  102. ///
  103. /// </summary>
  104. [Property]
  105. public int product_count
  106. {
  107. get { return _product_count; }
  108. set { _product_count = value; }
  109. }
  110. private string _lastTid = "";
  111. /// <summary>
  112. ///上次购买订单号
  113. /// </summary>
  114. [Property]
  115. public string lastTid
  116. {
  117. get { return _lastTid; }
  118. set { _lastTid = value; }
  119. }
  120. private int _isMore = 0;
  121. /// <summary>
  122. ///是否比上次买更多
  123. /// </summary>
  124. [Property]
  125. public int isMore
  126. {
  127. get { return _isMore; }
  128. set { _isMore = value; }
  129. }
  130. private string _lastTid2 = "";
  131. /// <summary>
  132. ///
  133. /// </summary>
  134. [Property]
  135. public string lastTid2
  136. {
  137. get { return _lastTid2; }
  138. set { _lastTid2 = value; }
  139. }
  140. private string _buyer_id = "";
  141. /// <summary>
  142. ///客户id
  143. /// </summary>
  144. [Property]
  145. public string buyer_id
  146. {
  147. get { return _buyer_id; }
  148. set { _buyer_id = value; }
  149. }
  150. /// <summary>
  151. ///
  152. /// </summary>
  153. [Property]
  154. public DateTime? lastbuy_time2 { get; set; }
  155. public static CeErpCustomer GetByNick(string nick)
  156. {
  157. return FindFirst(Expression.Eq("buyer_nick", nick));
  158. }
  159. public static CeErpCustomer GetByNickAndShop(string nick, string shopname)
  160. {
  161. return FindFirst(Expression.Sql(string.Format("(buyer_nick='{0}' and seller_nick='{1}')", nick, shopname)));
  162. }
  163. public static CeErpCustomer GetByIdAndShop(string id, string shopname)
  164. {
  165. return FindFirst(Expression.Sql(string.Format("(buyer_id='{0}' and seller_nick='{1}')", id, shopname)));
  166. }
  167. public static void Del(object id)
  168. {
  169. StringBuilder sql = new StringBuilder();
  170. sql.AppendFormat("delete from CE_ErpCustomer where id=" + id);
  171. ExecuteNonQuery(sql.ToString());
  172. }
  173. }
  174. }