using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Models;
using System.Data.SqlClient;
using System.Data;
namespace DAL
{
///
/// 日常费用付款申请多表联查数据访问类
///
public class ViewDailyFeePaymentService
{
///
/// 查询所有
///
/// sql语句
/// 可变参数数组
/// 返回集合
List excuteSql(string sql, params SqlParameter[] param)
{
return ServiceBase.excuteSql(new ViewDailyFeePayment(), "ViewDailyFeePayment", sql, CommandType.Text, param);
}
///
/// 获取单个对象
///
/// sql语句
/// 可变参数数组
/// 返回空或者单个对象
ViewDailyFeePayment excuteType(string sql, params SqlParameter[] param)
{
//查询结果放入对象集合
List ctggdList = excuteSql(sql, param);
//判断集合是否为空
if (ctggdList == null || ctggdList.Count == 0)
//返回null
return null;
//返回单个对象
return ctggdList[0];
}
///
/// 根据编号查询对象信息
///
/// 对象编号
/// 返回空或者对象信息
public List GetByDIId(int id)
{
//调用获取单个对象的方法
return excuteSql("select dfpc.PriceName,dfpc.[Count],dfpc.Price,dfpc.ItemSumPrice,dfpc.Remark from DailyFeePayment dfp join DailyFeePaymentContent dfpc on dfp.id = dfpc.DFPID where dfp.id = @Id", new SqlParameter("@Id", id));
}
///
/// 根据编号查询对象信息
///
/// 对象编号
/// 返回空或者对象信息
public List GetByDIIdStatements(string id)
{
//调用获取单个对象的方法
return excuteSql("select dfpc.PriceName,dfpc.[Count],dfpc.Price,dfpc.ItemSumPrice,dfpc.Remark from DailyFeePayment dfp join DailyFeePaymentContent dfpc on dfp.id = dfpc.DFPID where dfp.id in (" + id + ")");
}
}
}