ViewDailyFeePaymentService.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Models;
  6. using System.Data.SqlClient;
  7. using System.Data;
  8. namespace DAL
  9. {
  10. /// <summary>
  11. /// 日常费用付款申请多表联查数据访问类
  12. /// </summary>
  13. public class ViewDailyFeePaymentService
  14. {
  15. /// <summary>
  16. /// 查询所有
  17. /// </summary>
  18. /// <param name="sql">sql语句</param>
  19. /// <param name="param">可变参数数组</param>
  20. /// <returns>返回集合</returns>
  21. List<ViewDailyFeePayment> excuteSql(string sql, params SqlParameter[] param)
  22. {
  23. return ServiceBase<ViewDailyFeePayment>.excuteSql(new ViewDailyFeePayment(), "ViewDailyFeePayment", sql, CommandType.Text, param);
  24. }
  25. /// <summary>
  26. /// 获取单个对象
  27. /// </summary>
  28. /// <param name="sql">sql语句</param>
  29. /// <param name="param">可变参数数组</param>
  30. /// <returns>返回空或者单个对象</returns>
  31. ViewDailyFeePayment excuteType(string sql, params SqlParameter[] param)
  32. {
  33. //查询结果放入对象集合
  34. List<ViewDailyFeePayment> ctggdList = excuteSql(sql, param);
  35. //判断集合是否为空
  36. if (ctggdList == null || ctggdList.Count == 0)
  37. //返回null
  38. return null;
  39. //返回单个对象
  40. return ctggdList[0];
  41. }
  42. /// <summary>
  43. /// 根据编号查询对象信息
  44. /// </summary>
  45. /// <param name="id">对象编号</param>
  46. /// <returns>返回空或者对象信息</returns>
  47. public List<ViewDailyFeePayment> GetByDIId(int id)
  48. {
  49. //调用获取单个对象的方法
  50. 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));
  51. }
  52. /// <summary>
  53. /// 根据编号查询对象信息
  54. /// </summary>
  55. /// <param name="id">对象编号</param>
  56. /// <returns>返回空或者对象信息</returns>
  57. public List<ViewDailyFeePayment> GetByDIIdStatements(string id)
  58. {
  59. //调用获取单个对象的方法
  60. 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 + ")");
  61. }
  62. }
  63. }