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_ShortMessageConfig : BaseDataOperate
{
#region 属性和字段
string _tableName = "tb_ShortMessageConfig";
///
/// 获取数据表名
///
public override string TableName
{
get { return _tableName; }
set { this._tableName = value; }
}
///
/// 获取当前新的数据表模型对象
///
public override object ObjModel
{
get
{
return this.CurrentModel;
}
}
///
/// 获取当前新的MOdel
///
public Model.Model_ShortMessageConfig CurrentModel
{
get { return new Model.Model_ShortMessageConfig(); }
}
string _tableFieldNameString = "";
///
/// 数据表字段名数组
///
public override string TableFieldNameString
{
get { return this._tableFieldNameString; }
set { this._tableFieldNameString = value; }
}
#endregion
public DataTable GetShortMessageConfigList(int pageIndex, int pageSize)
{
string sql = " select top " + (pageIndex * pageSize)
+ " CompanyName , tb_ShortMessageConfig.* from tb_ShortMessageConfig left join tb_CustomerInterfaces on Token=smc_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 GetShortMessageConfigCount()
{
string sql = " select count(*) from tb_ShortMessageConfig left join tb_CustomerInterfaces on Token=smc_EntID ";
DataSet ds = this.QuaryDataSet(sql);
return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
}
public Model.Model_ShortMessageConfig GetModel(string strWhere)
{
return (Model.Model_ShortMessageConfig)DataRowToModel(GetDataRow(strWhere), new Model_ShortMessageConfig());
}
}
}