ViewInvitationOfficialActivitiesPayService.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 ViewInvitationOfficialActivitiesPayService
  14. {
  15. /// <summary>
  16. /// 查询所有
  17. /// </summary>
  18. /// <param name="sql">sql语句</param>
  19. /// <param name="param">可变参数数组</param>
  20. /// <returns>返回集合</returns>
  21. List<ViewInvitationOfficialActivitiesPay> excuteSql(string sql, params SqlParameter[] param)
  22. {
  23. return ServiceBase<ViewInvitationOfficialActivitiesPay>.excuteSql(new ViewInvitationOfficialActivitiesPay(), "ViewInvitationOfficialActivitiesPay", 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. ViewInvitationOfficialActivitiesPay excuteType(string sql, params SqlParameter[] param)
  32. {
  33. //查询结果放入对象集合
  34. List<ViewInvitationOfficialActivitiesPay> 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 ViewInvitationOfficialActivitiesPay GetViewInvitationOfficialActivitiesPayByID(int id)
  48. {
  49. //调用获取单个对象的方法
  50. return excuteType("select * from ViewInvitationOfficialActivitiesPay where Id = @id and IsDel = 0", new SqlParameter("@id", id));
  51. }
  52. /// <summary>
  53. /// 获取全部
  54. /// </summary>
  55. /// <returns></returns>
  56. public List<ViewInvitationOfficialActivitiesPay> GetAll()
  57. {
  58. return excuteSql("select * from ViewInvitationOfficialActivitiesPay where IsDel = 0");
  59. }
  60. /// <summary>
  61. /// 根据编号查询对象信息
  62. /// </summary>
  63. /// <param name="id">对象编号</param>
  64. /// <returns>返回空或者对象信息</returns>
  65. public List<ViewInvitationOfficialActivitiesPay> GetByDIId1(int DIId)
  66. {
  67. //调用获取单个对象的方法
  68. //return excuteSql("select ccp.RMBPrice,ioa.OperatorDate,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,sd.[Name],ioa.InviteCosts,ioa.Currency,ccp.PayMoney,ccp.DayRate,ioa.remark from InvitationOfficialActivities ioa join CreditCardPayment ccp on ccp.Diid = ioa.Diid and ccp.Cid = ioa.Id join SetData sd on sd.Id =ioa.Currency where ioa.DIID = @DIId and ioa.IsDel = 0 and ccp.CTable = 81 and ccp.IsPay = 1", new SqlParameter("@DIId", DIId));
  69. //去除ispay=1条件
  70. return excuteSql("select ioa.SendCost,ioa.EventsCost,ioa.TranslateCost,ccp.IsMatchCreditCard,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer," +
  71. "ccp.PayDid,ccp.payee,ccp.ispay,ccp.RMBPrice,ioa.OperatorDate,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,sd.[Name],ioa.InviteCosts," +
  72. "ioa.Currency,ccp.PayMoney,ccp.DayRate,ioa.remark from InvitationOfficialActivities ioa join CreditCardPayment ccp on ccp.Diid = ioa.Diid " +
  73. "and ccp.Cid = ioa.Id join SetData sd on sd.Id =ioa.Currency join setdata sd1 on sd1.id=ccp.PayDid where ioa.DIID = @DIId and ioa.IsDel = 0 " +
  74. "and ccp.CTable = 81 and ccp.IsAuditGM <> 2 and ccp.isDel=0", new SqlParameter("@DIId", DIId));
  75. }
  76. /// <summary>
  77. /// 根据编号查询对象信息
  78. /// </summary>
  79. /// <param name="id">对象编号</param>
  80. /// <returns>返回空或者对象信息</returns>
  81. public List<ViewInvitationOfficialActivitiesPay> GetByDIId(int DIId)
  82. {
  83. //调用获取单个对象的方法
  84. //return excuteSql("select ccp.RMBPrice,ioa.OperatorDate,ioa.InviterArea,ioa.Inviter,ioa.InviteTime,sd.[Name],ioa.InviteCosts,ioa.Currency,ccp.PayMoney,ccp.DayRate,ioa.remark from InvitationOfficialActivities ioa join CreditCardPayment ccp on ccp.Diid = ioa.Diid and ccp.Cid = ioa.Id join SetData sd on sd.Id =ioa.Currency where ioa.DIID = @DIId and ioa.IsDel = 0 and ccp.CTable = 81 and ccp.IsPay = 1", new SqlParameter("@DIId", DIId));
  85. //去除ispay=1条件
  86. return excuteSql("select ioa.SendCost,ioa.EventsCost,ioa.TranslateCost,ccp.IsMatchCreditCard,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer," +
  87. "ccp.PayDid, ccp.payee, ccp.ispay, ccp.RMBPrice, ioa.OperatorDate, ioa.InviterArea, ioa.Inviter, ioa.InviteTime, sd.[Name], sd3.[Name] as SendCurrency, sd4.[Name] as EventsCurrency," +
  88. " sd5.[Name] as TranslateCurrency, ioa.InviteCosts,ccp.PaymentCurrency as Currency, ccp.PayMoney, ccp.DayRate, ioa.remark from InvitationOfficialActivities ioa join CreditCardPayment " +
  89. "ccp on ccp.Diid = ioa.Diid and ccp.Cid = ioa.Id left join SetData sd on sd.Id = ioa.Currency join setdata sd1 on sd1.id = ccp.PayDid left join setdata sd3 on sd3.id = ioa.SendCurrency left join " +
  90. "setdata sd4 on sd4.id = ioa.EventsCurrency left join setdata sd5 on sd5.id = ioa.TranslateCurrency where ioa.DIID = @DIId and ioa.IsDel = 0 and ccp.CTable = 81 and (ccp.IsAuditGM=1 or ccp.IsAuditGM=3) and ccp.isDel = 0", new SqlParameter("@DIId", DIId));
  91. }
  92. }
  93. }