DAL_CustomerInterfaces.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Text;
  6. namespace LYFZ.WeixinServiceDate.DAL
  7. {
  8. public class DAL_CustomerInterfaces :BaseDataOperate
  9. {
  10. public DAL_CustomerInterfaces()
  11. {
  12. this.TableFieldNameString = "";
  13. }
  14. #region 属性和字段
  15. string _tableName = "tb_CustomerInterfaces";
  16. /// <summary>
  17. /// 获取数据表名
  18. /// </summary>
  19. public override string TableName
  20. {
  21. get { return _tableName; } set { this._tableName = value; }
  22. }
  23. /// <summary>
  24. /// 获取当前新的数据表模型对象
  25. /// </summary>
  26. public override object ObjModel
  27. {
  28. get
  29. {
  30. return this.CurrentModel;
  31. }
  32. }
  33. /// <summary>
  34. /// 获取当前新的MOdel
  35. /// </summary>
  36. public Model.Model_CustomerInterfaces CurrentModel
  37. {
  38. get { return new Model.Model_CustomerInterfaces(); }
  39. }
  40. string _tableFieldNameString = "";
  41. /// <summary>
  42. /// 数据表字段名数组
  43. /// </summary>
  44. public override string TableFieldNameString
  45. {
  46. get { return this._tableFieldNameString; }
  47. set { this._tableFieldNameString = value; }
  48. }
  49. #endregion
  50. #region 检查记录
  51. //基类已经实现
  52. #endregion
  53. #region 增加数据
  54. /// <summary>
  55. /// 增加一条数据
  56. /// </summary>
  57. /// <param name="model">Model对象</param>
  58. /// <returns></returns>
  59. public bool Add(Model.Model_CustomerInterfaces model)
  60. {
  61. return base.Add(model);
  62. }
  63. /// <summary>
  64. /// 增加一条数据
  65. /// </summary>
  66. /// <param name="model">Model对象</param>
  67. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  68. /// <returns></returns>
  69. public bool Add(Model.Model_CustomerInterfaces model, string overlookFieldList = "ID")
  70. {
  71. return base.Add(model, overlookFieldList);
  72. }
  73. #endregion
  74. #region 删除数据
  75. /// <summary>
  76. /// 删除数据
  77. /// </summary>
  78. /// <param name="model"></param>
  79. /// <returns></returns>
  80. public bool Delete(Model.Model_CustomerInterfaces model)
  81. {
  82. return base.Delete(model.ID);
  83. }
  84. #endregion
  85. #region 更新数据
  86. /// <summary>
  87. /// 更新一条数据
  88. /// </summary>
  89. public bool Update(Model.Model_CustomerInterfaces model)
  90. {
  91. return base.Update(model);
  92. }
  93. /// <summary>
  94. /// 根据筛选字段和SQL筛选运算符号更新数据
  95. /// </summary>
  96. /// <param name="model">Model对象</param>
  97. /// <param name="filterFieldName">筛选字段名称</param>
  98. /// <param name="operators">SQL筛选运算符号</param>
  99. /// <param name="overlookFieldList">忽略字段名列表 字段名之间用“,”号分隔</param>
  100. /// <returns></returns>
  101. public bool Update(Model.Model_CustomerInterfaces model, string filterFieldName = "ID", string operators = "=", string overlookFieldList = "ID")
  102. {
  103. return base.Update(model, filterFieldName, operators, overlookFieldList);
  104. }
  105. #endregion
  106. #region 查询数据
  107. /// <summary>
  108. /// 得到一个对象实体
  109. /// </summary>
  110. public Model.Model_CustomerInterfaces GetModel(int ID)
  111. {
  112. return DataRowToModel(GetDataRow(ID));
  113. }
  114. /// <summary>
  115. /// 得到一个对象实体
  116. /// </summary>
  117. /// <param name="row"></param>
  118. /// <returns></returns>
  119. public Model.Model_CustomerInterfaces DataRowToModel(DataRow row)
  120. {
  121. return DataRowToModelObject(row) as Model.Model_CustomerInterfaces;
  122. }
  123. #endregion
  124. /// <summary>
  125. /// 更新调用次数
  126. /// </summary>
  127. /// <param name="JMGDomainName"></param>
  128. /// <param name="_CallFrequency"></param>
  129. /// <returns></returns>
  130. public bool UpdateCustCallFrequency(string JMGDomainName,long _CallFrequency)
  131. {
  132. bool ret = false;
  133. string sql = "update [dbo].[tb_CustomerInterfaces] set [CallFrequency]=" + _CallFrequency.ToString() + " where [JMGDomainName]='" + JMGDomainName + "'";
  134. if (LYFZ.Helper.SQLHelper.ExecuteSql(sql)>0) {
  135. ret = true;
  136. }
  137. return ret;
  138. }
  139. public DataTable GetOfficialAccountList(string eid)
  140. {
  141. if (!String.IsNullOrEmpty(eid))
  142. {
  143. string sql = String.Format(" SELECT [dbo].[tb_CustomerInterfaces].[id] ,[Token],[AppID] ,[AppSecret],[OfficialAccount],[OfficialAccountName] ,[authorizer_appid],[AuthorizeStatus] FROM [dbo].[tb_CustomerInterfaces] left join [dbo].[tb_authorization_info] on [AppID]=[authorizer_appid] where [Token]='{0}'", eid);
  144. return LYFZ.Helper.SQLHelper.Query(sql).Tables[0];
  145. }
  146. return null;
  147. }
  148. #region 数据分页
  149. //基类已实现相关方法
  150. #endregion
  151. }
  152. }