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 CGDUSService { /// /// 查询所有 /// /// sql语句 /// 可变参数数组 /// 返回集合 List excuteSql(string sql, params SqlParameter[] param) { return ServiceBase.excuteSql(new CarGuideData_US(), "CarGuideData_US", sql, CommandType.Text, param); } /// /// 获取单个对象 /// /// sql语句 /// 可变参数数组 /// 返回空或者单个对象 CarGuideData_US 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_US(), "CarGuideData_US", "CarGuideData_US", "*", "id asc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord); } /// /// 单个查询 /// /// public CarGuideData_US GetALL(string area, string type, string ishigh) { return excuteType("select * from CarGuideData_US where IsDel=0 and area like '%" + area + "%' " + "and CarType like '%" + type + "%' " + "and IsHighTop like '%" + ishigh + "%'"); } } }