DAL_ShortMessageTemple.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using LYFZ.WeixinServiceDate.Model;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. namespace LYFZ.WeixinServiceDate.DAL
  8. {
  9. public class DAL_ShortMessageTemple : BaseDataOperate
  10. {
  11. #region 属性和字段
  12. string _tableName = "tb_ShortMessageTemple";
  13. /// <summary>
  14. /// 获取数据表名
  15. /// </summary>
  16. public override string TableName
  17. {
  18. get { return _tableName; }
  19. set { this._tableName = value; }
  20. }
  21. /// <summary>
  22. /// 获取当前新的数据表模型对象
  23. /// </summary>
  24. public override object ObjModel
  25. {
  26. get
  27. {
  28. return this.CurrentModel;
  29. }
  30. }
  31. /// <summary>
  32. /// 获取当前新的MOdel
  33. /// </summary>
  34. public Model.Model_ShortMessageTemple CurrentModel
  35. {
  36. get { return new Model.Model_ShortMessageTemple(); }
  37. }
  38. string _tableFieldNameString = "";
  39. /// <summary>
  40. /// 数据表字段名数组
  41. /// </summary>
  42. public override string TableFieldNameString
  43. {
  44. get { return this._tableFieldNameString; }
  45. set { this._tableFieldNameString = value; }
  46. }
  47. #endregion
  48. public DataTable GetShortMessageTempleList(int pageIndex, int pageSize)
  49. {
  50. string sql = " select top " + (pageIndex * pageSize)
  51. + " CompanyName, tb_ShortMessageTemple.* from tb_ShortMessageTemple left join tb_CustomerInterfaces on Token=smt_EntID ";
  52. DataSet ds = this.QuaryDataSet(sql);
  53. if (ds.Tables[0].Rows.Count == 0)
  54. {
  55. return new DataTable();
  56. }
  57. DataTable jsonDt = ds.Tables[0].AsEnumerable().Skip((pageIndex - 1) * pageSize).Take(pageSize).CopyToDataTable();
  58. return jsonDt;
  59. }
  60. public int GetShortMessageTempleCount()
  61. {
  62. string sql = " select count(*) from tb_ShortMessageTemple left join tb_CustomerInterfaces on Token=smt_EntID ";
  63. DataSet ds = this.QuaryDataSet(sql);
  64. return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
  65. }
  66. public Model.Model_ShortMessageTemple GetModel(string strWhere)
  67. {
  68. return (Model.Model_ShortMessageTemple)DataRowToModel(GetDataRow(strWhere), new Model_ShortMessageTemple());
  69. }
  70. }
  71. }