ViewAirTicketReservationsPayService.cs 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 ViewAirTicketReservationsPayService
  14. {
  15. /// <summary>
  16. /// 查询所有
  17. /// </summary>
  18. /// <param name="sql">sql语句</param>
  19. /// <param name="param">可变参数数组</param>
  20. /// <returns>返回集合</returns>
  21. List<ViewAirTicketReservationsPay> excuteSql(string sql, params SqlParameter[] param)
  22. {
  23. return ServiceBase<ViewAirTicketReservationsPay>.excuteSql(new ViewAirTicketReservationsPay(), "ViewAirTicketReservationsPay", 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. ViewAirTicketReservationsPay excuteType(string sql, params SqlParameter[] param)
  32. {
  33. //查询结果放入对象集合
  34. List<ViewAirTicketReservationsPay> 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 ViewAirTicketReservationsPay GetViewAirTicketReservationsPayByID(int id)
  48. {
  49. //调用获取单个对象的方法
  50. return excuteType("select * from ViewAirTicketReservationsPay where Id = @id and IsDel = 0", new SqlParameter("@id", id));
  51. }
  52. /// <summary>
  53. /// 获取全部
  54. /// </summary>
  55. /// <returns></returns>
  56. public List<ViewAirTicketReservationsPay> GetAll()
  57. {
  58. return excuteSql("select * from ViewAirTicketReservationsPay where IsDel = 0");
  59. }
  60. /// <summary>
  61. /// 查询已审核数据
  62. /// </summary>
  63. /// <param name="id">对象编号</param>
  64. /// <returns>返回空或者对象信息</returns>
  65. public List<ViewAirTicketReservationsPay> GetByDIId(int DIId)
  66. {
  67. return excuteSql("select (select Name from SetData where Id=ccp.CTDId) as CarType,ccp.IsMatchCreditCard,atr.FlightsDescription,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer,ccp.PayDid,ccp.payee,ccp.ispay,atr.OperatorDate,"
  68. + "atr.FlightsCode,atr.FlightsCity,atr.FlightsDate,atr.FlightsTime,atr.ClientName,sd.[Name],ccp.PayMoney as Spread,ccp.RMBprice,ccp.dayRate,atr.PriceDescription,atr.Price,"
  69. + "ccp.consumptionDate,sd4.Name as CType,sd3.Name+sd3.Remark as CTDId,atr.ArrivedTime,atr.PrePrice,atr.ClientNum from AirTicketReservations atr "
  70. + "join CreditCardPayment ccp on ccp.Diid = atr.Diid and ccp.Cid = atr.Id join SetData sd on sd.Id =ccp.PaymentCurrency join setdata sd1 on sd1.id=ccp.PayDid "
  71. + "join setdata sd3 on sd3.id=ccp.CTDId join setdata sd4 on sd4.Id=atr.CType where atr.DIID = @DIId and atr.IsDel = 0 and ccp.CTable = 85 and ccp.isDel=0 and ccp.IsAuditGM =1 or ccp.IsAuditGM=3 and ccp.IsPay=1 order by atr.FlightsDate", new SqlParameter("@DIId", DIId));
  72. }
  73. /// <summary>
  74. /// 查询未审核及已审核的所有数据
  75. /// </summary>
  76. /// <param name="id">对象编号</param>
  77. /// <returns>返回空或者对象信息</returns>
  78. public List<ViewAirTicketReservationsPay> GetByDIIdandWSH(int DIId)
  79. {
  80. return excuteSql("select atr.FlightsDescription,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer,ccp.PayDid,ccp.payee,ccp.ispay,atr.OperatorDate,"
  81. + "atr.FlightsCode,atr.FlightsCity,atr.FlightsDate,atr.FlightsTime,atr.ClientName,sd.[Name],ccp.PayMoney as Spread,ccp.RMBprice,ccp.dayRate,atr.PriceDescription,atr.Price,"
  82. + "ccp.consumptionDate,sd4.Name as CType,sd3.Name+sd3.Remark as CTDId,atr.ArrivedTime,atr.PrePrice,atr.ClientNum,ccp.IsMatchCreditCard from AirTicketReservations atr "
  83. + "join CreditCardPayment ccp on ccp.Diid = atr.Diid and ccp.Cid = atr.Id join SetData sd on sd.Id =ccp.PaymentCurrency join setdata sd1 on sd1.id=ccp.PayDid "
  84. + "join setdata sd3 on sd3.id=ccp.CTDId join setdata sd4 on sd4.Id=atr.CType where atr.DIID = @DIId and atr.IsDel = 0 and ccp.CTable = 85 and ccp.isDel=0 order by atr.FlightsDate asc ,atr.flightsTime asc", new SqlParameter("@DIId", DIId));
  85. }
  86. }
  87. }