1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 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 CGDSAService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<CarGuideData_SA> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<CarGuideData_SA>.excuteSql(new CarGuideData_SA(), "CarGuideData_SA", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- CarGuideData_SA excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<CarGuideData_SA> hdList = excuteSql(sql, param);
- //判断集合是否为空
- if (hdList == null || hdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return hdList[0];
- }
- /// <summary>
- /// 获取全部 - 分页
- /// </summary>
- /// <returns></returns>
- public List<CarGuideData_SA> 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<CarGuideData_SA>.excutePageSql(new CarGuideData_SA(), "CarGuideData_SA", "CarGuideData_SA", "*", "id asc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
- }
- /// <summary>
- /// 单个查询
- /// </summary>
- /// <returns></returns>
- public CarGuideData_SA GetALL(string area, string type, string cost)
- {
- return excuteType("select * from CarGuideData_SA where IsDel=0 and area like '%" + area + "%' " + "and CarType like '%" + type + "%' " + "and CarCost like '%" + cost + "%'");
- }
- }
- }
|