DAL_DZKJ_DistributorAccount.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. using LYFZ.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Linq;
  7. using System.Text;
  8. namespace LYFZ.WeixinServiceDate.DAL
  9. {
  10. public class DAL_DZKJ_DistributorAccount : BaseDataOperate
  11. {
  12. public DAL_DZKJ_DistributorAccount()
  13. {
  14. this.TableFieldNameString = "";
  15. }
  16. #region 属性和字段
  17. string _tableName = "tb_DZKJ_DistributorAccount";
  18. /// <summary>
  19. /// 获取数据表名
  20. /// </summary>
  21. public override string TableName
  22. {
  23. get { return _tableName; }
  24. set { this._tableName = value; }
  25. }
  26. /// <summary>
  27. /// 获取当前新的数据表模型对象
  28. /// </summary>
  29. public override object ObjModel
  30. {
  31. get
  32. {
  33. return this.CurrentModel;
  34. }
  35. }
  36. /// <summary>
  37. /// 获取当前新的MOdel
  38. /// </summary>
  39. public Model.Model_DZKJ_DistributorAccount CurrentModel
  40. {
  41. get { return new Model.Model_DZKJ_DistributorAccount(); }
  42. }
  43. string _tableFieldNameString = "";
  44. /// <summary>
  45. /// 数据表字段名数组
  46. /// </summary>
  47. public override string TableFieldNameString
  48. {
  49. get { return this._tableFieldNameString; }
  50. set { this._tableFieldNameString = value; }
  51. }
  52. #endregion
  53. #region 检查记录
  54. //基类已经实现
  55. #endregion
  56. #region 增加数据
  57. /// <summary>
  58. /// 增加一条数据
  59. /// </summary>
  60. /// <param name="model">Model对象</param>
  61. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  62. /// <returns></returns>
  63. public bool Add(Model.Model_DZKJ_DistributorAccount model, string overlookFieldList = "ID")
  64. {
  65. return base.Add(model, overlookFieldList);
  66. }
  67. #endregion
  68. #region 删除数据
  69. /// <summary>
  70. /// 删除数据
  71. /// </summary>
  72. /// <param name="model"></param>
  73. /// <returns></returns>
  74. public bool Delete(Model.Model_DZKJ_DistributorAccount model)
  75. {
  76. return base.Delete(model.ID);
  77. }
  78. #endregion
  79. #region 更新数据
  80. /// <summary>
  81. /// 更新一条数据
  82. /// </summary>
  83. public bool Update(Model.Model_DZKJ_DistributorAccount model)
  84. {
  85. return base.Update(model);
  86. }
  87. /// <summary>
  88. /// 根据筛选字段和SQL筛选运算符号更新数据
  89. /// </summary>
  90. /// <param name="model">Model对象</param>
  91. /// <param name="filterFieldName">筛选字段名称</param>
  92. /// <param name="operators">SQL筛选运算符号</param>
  93. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  94. /// <returns></returns>
  95. public bool Update(Model.Model_DZKJ_DistributorAccount model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
  96. {
  97. return base.Update(model, filterFieldName, operators, overlookFieldList);
  98. }
  99. #endregion
  100. #region 查询数据
  101. /// <summary>
  102. /// 得到一个对象实体
  103. /// </summary>
  104. public Model.Model_DZKJ_DistributorAccount GetModel(long ID)
  105. {
  106. return DataRowToModel(GetDataRow(ID));
  107. }
  108. public Model.Model_DZKJ_DistributorAccount GetModel(string strWhere)
  109. {
  110. return DataRowToModel(GetDataRow(strWhere));
  111. }
  112. /// <summary>
  113. /// 得到一个对象实体
  114. /// </summary>
  115. /// <param name="row"></param>
  116. /// <returns></returns>
  117. public Model.Model_DZKJ_DistributorAccount DataRowToModel(DataRow row)
  118. {
  119. return DataRowToModelObject(row) as Model.Model_DZKJ_DistributorAccount;
  120. }
  121. public bool UpdateLatestLoginTime(string Account, string ip, string LatestLoginTime)
  122. {
  123. string updateSql = "update [tb_Model_DZKJ_DistributorAccount] set ip='" + ip + "',LatestLoginTime='" + LatestLoginTime + "' where Account='" + Account + "'";
  124. if (LYFZ.Helper.SQLHelper.ExecuteSql(updateSql) > 0)
  125. {
  126. return true;
  127. }
  128. else
  129. {
  130. return false;
  131. }
  132. }
  133. #endregion
  134. #region 数据分页
  135. //基类已实现相关方法
  136. #endregion
  137. public bool Recharge(long Id, string UserName, int Mouney, int Count, string RechargeDescription)
  138. {
  139. try
  140. {
  141. LYFZ.WeixinServiceDate.DAL.DAL_DZKJ_DistributorRechargeRecords DZKJRec_Dal = new WeixinServiceDate.DAL.DAL_DZKJ_DistributorRechargeRecords();
  142. LYFZ.WeixinServiceDate.Model.Model_DZKJ_DistributorRechargeRecords DZKJRecModel = new WeixinServiceDate.Model.Model_DZKJ_DistributorRechargeRecords();
  143. DZKJRecModel.DistributorID = Id;
  144. DZKJRecModel.RechargeTime = DateTime.Now;
  145. DZKJRecModel.RechargeUser = UserName;
  146. DZKJRecModel.RechargeMoney = Mouney;
  147. DZKJRecModel.RechargeCount = Count;
  148. DZKJRecModel.RechargeDescription = RechargeDescription;
  149. DZKJRec_Dal.Add(DZKJRecModel);
  150. Model.Model_DZKJ_DistributorAccount MDDistAccount = this.GetModel(Id);
  151. MDDistAccount.ID = Id;
  152. MDDistAccount.StartSimulatorCount += Count;
  153. this.Update(MDDistAccount);
  154. }
  155. catch
  156. {
  157. return false;
  158. }
  159. return true;
  160. }
  161. }
  162. }