using Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
namespace DAL
{
public class CGDEUService
{
///
/// 查询所有
///
/// sql语句
/// 可变参数数组
/// 返回集合
List excuteSql(string sql, params SqlParameter[] param)
{
return ServiceBase.excuteSql(new CarGuideData_EU(), "CarGuideData_EU", sql, CommandType.Text, param);
}
///
/// 获取单个对象
///
/// sql语句
/// 可变参数数组
/// 返回空或者单个对象
CarGuideData_EU excuteType(string sql, params SqlParameter[] param)
{
//查询结果放入对象集合
List hdList = excuteSql(sql, param);
//判断集合是否为空
if (hdList == null || hdList.Count == 0)
//返回null
return null;
//返回单个对象
return hdList[0];
}
///
/// 获取全部 - 分页
///
///
public List GetALL(int pageIndex, out int sumPage, out int totalRecord, string Area)
{
string sqlwhere = "IsDel = 0";
if (!string.IsNullOrEmpty(Area))
sqlwhere += " and Area like '%" + Area + "%'";
return PageBase.excutePageSql(new CarGuideData_EU(), "CarGuideData_EU", "CarGuideData_EU", "*", "id asc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
}
///
/// 获取全部
///
///
public List GetALL()
{
return excuteSql("select * from CarGuideData_EU where IsDel=0");
}
///
/// 单个查询
///
///
public CarGuideData_EU GetALL(string area, string type, string cost)
{
return excuteType("select * from CarGuideData_EU where IsDel=0 and area like '%" + area + "%' " + "and CarType like '%" + type + "%' " + "and CarCost like '%" + cost + "%'");
}
}
}