grouopExceedService.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data.SqlClient;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace DAL
  10. {
  11. public class grouopExceedService
  12. {
  13. /// <summary>
  14. /// 查询所有
  15. /// </summary>
  16. /// <param name="sql">sql语句</param>
  17. /// <param name="param">可变参数数组</param>
  18. /// <returns>返回集合</returns>
  19. List<grouopExceed> excuteSql(string sql, params SqlParameter[] param)
  20. {
  21. return ServiceBase<grouopExceed>.excuteSql(new grouopExceed(), "grouopExceed", sql, CommandType.Text, param);
  22. }
  23. /// <summary>
  24. /// 获取单个对象
  25. /// </summary>
  26. /// <param name="sql">sql语句</param>
  27. /// <param name="param">可变参数数组</param>
  28. /// <returns>返回空或者单个对象</returns>
  29. grouopExceed excuteType(string sql, params SqlParameter[] param)
  30. {
  31. //查询结果放入对象集合
  32. List<grouopExceed> gdpList = excuteSql(sql, param);
  33. //判断集合是否为空
  34. if (gdpList == null || gdpList.Count == 0)
  35. //返回null
  36. return null;
  37. //返回单个对象
  38. return gdpList[0];
  39. }
  40. public List<grouopExceed> GetgrouopExceed(int pageIndex, out int sumPage, out int totalRecord, string tourCode)
  41. {
  42. string sqlwhere = "IsDel = 0 and DIId = " + tourCode ;
  43. return PageBase<grouopExceed>.excutePageSql(new grouopExceed(), "grouopExceed", "grouopExceed", "*", "id desc", sqlwhere, 10, pageIndex, out sumPage, out totalRecord);
  44. }
  45. /// 增加
  46. /// </summary>
  47. /// <returns></returns>
  48. public bool AddGrouopExceed(grouopExceed gpd, out int id)
  49. {
  50. string sql = "insert into grouopExceed values(@DIID,@PriceName,@Price,@Currency,@FilePath,@Remark,@Operator,@OperatorDate,@PriceType,@coefficient,@PriceTypeDetail,@IsDel);SELECT @@IDENTITY";
  51. SqlParameter[] parameter = new SqlParameter[]{
  52. new SqlParameter("@DIId",gpd.DIID),
  53. new SqlParameter("@PriceName",gpd.PriceName),
  54. new SqlParameter("@Price",gpd.Price),
  55. new SqlParameter("@Currency",gpd.Currency),
  56. new SqlParameter("@FilePath",gpd.FilePath),
  57. new SqlParameter("@Remark",gpd.Remark),
  58. new SqlParameter("@Operator",gpd.Operators),
  59. new SqlParameter("@OperatorDate",gpd.OperatorsDate),
  60. new SqlParameter("@IsDel",gpd.IsDel),
  61. new SqlParameter("@PriceType",gpd.PriceType),
  62. new SqlParameter("@coefficient",gpd.coefficient),
  63. new SqlParameter("@PriceTypeDetail",gpd.PriceTypeDetail)
  64. };
  65. int obj = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter));
  66. if (obj > 0)
  67. {
  68. id = obj;
  69. return true;
  70. }
  71. id = 0;
  72. return false;
  73. }
  74. /// <summary>
  75. /// 删除
  76. /// </summary>
  77. /// <returns></returns>
  78. public bool DelGrouopExceed(int id)
  79. {
  80. string sql = "update grouopExceed set IsDel = 1 where Id = @Id";
  81. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, new SqlParameter("@Id", id)) > 0)
  82. return true;
  83. return false;
  84. }
  85. /// <summary>
  86. /// 根据编号查询对象信息
  87. /// </summary>
  88. /// <param name="id">对象编号</param>
  89. /// <returns>返回空或者单个对象信息</returns>
  90. public grouopExceed GetGrouopExceed(int id)
  91. {
  92. //调用获取单个对象的方法
  93. return excuteType("select * from grouopExceed where Id = @id and isdel=0", new SqlParameter("@id", id));
  94. }
  95. /// <summary>
  96. /// 编辑
  97. /// </summary>
  98. /// <returns></returns>
  99. public bool EditGrouopExceed(grouopExceed gpd)
  100. {
  101. string sql = "update GrouopExceed set DIID = @DIID,PriceName = @PriceName,Price = @Price,Currency = @Currency,FilePath = @FilePath,Remark = @Remark ,Operators = @Operators,OperatorsDate = @OperatorsDate,PriceType = @PriceType,coefficient= @coefficient,PriceTypeDetail=@PriceTypeDetail where Id = @Id";
  102. SqlParameter[] parameter = new SqlParameter[]{
  103. new SqlParameter("@DIId",gpd.DIID),
  104. new SqlParameter("@PriceName",gpd.PriceName),
  105. new SqlParameter("@Price",gpd.Price),
  106. new SqlParameter("@Currency",gpd.Currency),
  107. new SqlParameter("@FilePath",gpd.FilePath),
  108. new SqlParameter("@Remark",gpd.Remark),
  109. new SqlParameter("@Operators",gpd.Operators),
  110. new SqlParameter("@OperatorsDate",gpd.OperatorsDate),
  111. new SqlParameter("@Id",gpd.Id),
  112. new SqlParameter("@PriceType",gpd.PriceType),
  113. new SqlParameter("@coefficient",gpd.coefficient),
  114. new SqlParameter("@PriceTypeDetail",gpd.PriceTypeDetail)
  115. };
  116. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  117. return true;
  118. return false;
  119. }
  120. public DataTable GetGrouopExceedAllByDiid(int diid)
  121. {
  122. return SqlHelper.TransferProcedure("Exec_GetCreditCardPaymentAnd",CommandType.StoredProcedure , new SqlParameter("@DiiD", diid));
  123. }
  124. }
  125. }