ViewOhterPriceOPService.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. public class ViewOhterPriceOPService
  11. {
  12. /// <summary>
  13. /// 查询所有
  14. /// </summary>
  15. /// <param name="sql">sql语句</param>
  16. /// <param name="param">可变参数数组</param>
  17. /// <returns>返回集合</returns>
  18. List<ViewOtherPriceOP> excuteSql(string sql, params SqlParameter[] param)
  19. {
  20. return ServiceBase<ViewOtherPriceOP>.excuteSql(new ViewOtherPriceOP(), "ViewOtherPriceOP", sql, CommandType.Text, param);
  21. }
  22. /// <summary>
  23. /// 获取单个对象
  24. /// </summary>
  25. /// <param name="sql">sql语句</param>
  26. /// <param name="param">可变参数数组</param>
  27. /// <returns>返回空或者单个对象</returns>
  28. ViewOtherPriceOP excuteType(string sql, params SqlParameter[] param)
  29. {
  30. //查询结果放入对象集合
  31. List<ViewOtherPriceOP> vgdpList = excuteSql(sql, param);
  32. //判断集合是否为空
  33. if (vgdpList == null || vgdpList.Count == 0)
  34. //返回null
  35. return null;
  36. //返回单个对象
  37. return vgdpList[0];
  38. }
  39. /// <summary>
  40. /// 根据编号查询对象信息
  41. /// </summary>
  42. /// <param name="id">对象编号</param>
  43. /// <returns>返回空或者单个对象信息</returns>
  44. public ViewOtherPriceOP GetViewOtherPriceOPByID(int id)
  45. {
  46. //调用获取单个对象的方法
  47. return excuteType("select * from ViewOtherPriceOP where Id = @id and IsDel = 0", new SqlParameter("@id", id));
  48. }
  49. /// <summary>
  50. /// 获取全部
  51. /// </summary>
  52. /// <returns></returns>
  53. public List<ViewOtherPriceOP> GetAll()
  54. {
  55. return excuteSql("select * from ViewOtherPriceOP where IsDel = 0");
  56. }
  57. /// <summary>
  58. /// 根据编号查询对象信息
  59. /// </summary>
  60. /// <param name="id">对象编号</param>
  61. /// <returns>返回空或者对象信息</returns>
  62. public List<ViewOtherPriceOP> GetByDIId(int DIId)
  63. {
  64. //调用获取单个对象的方法
  65. //return excuteSql("select gdp.OperatorDate,gdp.PriceName,gdp.Price,sd.[Name],ccp.PayMoney as Spread,ccp.DayRate,gdp.Remark from OtherPriceOP gdp join CreditCardPayment ccp on ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id join SetData sd on sd.Id =gdp.Currency where gdp.DIID = @DIId and gdp.IsDel = 0 and ccp.CTable=285 and ccp.IsPay=1", new SqlParameter("@DIId", DIId));
  66. //去除ispay=1条件
  67. return excuteSql("select ccp.IsMatchCreditCard,ccp.Operator,ccp.AuditGMDate,sd1.name as PaydName,ccp.OrbitalPrivateTransfer,ccp.PayDid,ccp.payee,ccp.ispay,gdp.OperatorDate,gdp.PriceName,gdp.Price,sd.[Name],ccp.PayMoney as Spread,ccp.DayRate,gdp.Remark from OtherPriceOP gdp join CreditCardPayment ccp on ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id join SetData sd on sd.Id =gdp.Currency join setdata sd1 on sd1.id=ccp.PayDid where gdp.DIID = @DIId and gdp.IsDel = 0 and ccp.CTable=285 and ccp.IsAuditGM <> 2 and ccp.isDel=0", new SqlParameter("@DIId", DIId));
  68. }
  69. }
  70. }