123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data.SqlClient;
- using System.Data;
- namespace DAL
- {
- /// <summary>
- /// 日常费用付款申请多表联查数据访问类
- /// </summary>
- public class ViewDailyFeePaymentService
- {
- /// <summary>
- /// 查询所有
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- List<ViewDailyFeePayment> excuteSql(string sql, params SqlParameter[] param)
- {
- return ServiceBase<ViewDailyFeePayment>.excuteSql(new ViewDailyFeePayment(), "ViewDailyFeePayment", sql, CommandType.Text, param);
- }
- /// <summary>
- /// 获取单个对象
- /// </summary>
- /// <param name="sql">sql语句</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回空或者单个对象</returns>
- ViewDailyFeePayment excuteType(string sql, params SqlParameter[] param)
- {
- //查询结果放入对象集合
- List<ViewDailyFeePayment> ctggdList = excuteSql(sql, param);
- //判断集合是否为空
- if (ctggdList == null || ctggdList.Count == 0)
- //返回null
- return null;
- //返回单个对象
- return ctggdList[0];
- }
-
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者对象信息</returns>
- public List<ViewDailyFeePayment> 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));
- }
- /// <summary>
- /// 根据编号查询对象信息
- /// </summary>
- /// <param name="id">对象编号</param>
- /// <returns>返回空或者对象信息</returns>
- public List<ViewDailyFeePayment> 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 + ")");
- }
- }
- }
|