using LYFZ.WeixinServiceDate.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace LYFZ.WeixinServiceDate.DAL
{
public class DAL_ShortMessageTemple : BaseDataOperate
{
#region 属性和字段
string _tableName = "tb_ShortMessageTemple";
///
/// 获取数据表名
///
public override string TableName
{
get { return _tableName; }
set { this._tableName = value; }
}
///
/// 获取当前新的数据表模型对象
///
public override object ObjModel
{
get
{
return this.CurrentModel;
}
}
///
/// 获取当前新的MOdel
///
public Model.Model_ShortMessageTemple CurrentModel
{
get { return new Model.Model_ShortMessageTemple(); }
}
string _tableFieldNameString = "";
///
/// 数据表字段名数组
///
public override string TableFieldNameString
{
get { return this._tableFieldNameString; }
set { this._tableFieldNameString = value; }
}
#endregion
public DataTable GetShortMessageTempleList(int pageIndex, int pageSize)
{
string sql = " select top " + (pageIndex * pageSize)
+ " CompanyName, tb_ShortMessageTemple.* from tb_ShortMessageTemple left join tb_CustomerInterfaces on Token=smt_EntID ";
DataSet ds = this.QuaryDataSet(sql);
if (ds.Tables[0].Rows.Count == 0)
{
return new DataTable();
}
DataTable jsonDt = ds.Tables[0].AsEnumerable().Skip((pageIndex - 1) * pageSize).Take(pageSize).CopyToDataTable();
return jsonDt;
}
public int GetShortMessageTempleCount()
{
string sql = " select count(*) from tb_ShortMessageTemple left join tb_CustomerInterfaces on Token=smt_EntID ";
DataSet ds = this.QuaryDataSet(sql);
return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
}
public Model.Model_ShortMessageTemple GetModel(string strWhere)
{
return (Model.Model_ShortMessageTemple)DataRowToModel(GetDataRow(strWhere), new Model_ShortMessageTemple());
}
}
}