EnterExitCostService.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Linq;
  7. using System.Text;
  8. namespace DAL
  9. {
  10. public class EnterExitCostService
  11. {
  12. List<EnterExitCost> excuteSql(string sql, params SqlParameter[] param)
  13. {
  14. return ServiceBase<EnterExitCost>.excuteSql(new EnterExitCost(), "EnterExitCost", sql, CommandType.Text, param);
  15. }
  16. EnterExitCost excuteType(string sql, params SqlParameter[] param)
  17. {
  18. //查询结果放入对象集合
  19. List<EnterExitCost> hdList = excuteSql(sql, param);
  20. //判断集合是否为空
  21. if (hdList == null || hdList.Count == 0)
  22. //返回null
  23. return null;
  24. //返回单个对象
  25. return hdList[0];
  26. }
  27. //增Add
  28. public bool Add(EnterExitCost Dov)
  29. {
  30. string sql = "insert into EnterExitCost values(@Diid,@InsidePay,@VisaPay,@VisaPayRemark,@SafePay,@YiMiao,@HeSuan,@ServiceFee,@Ticket,@OutsideJJ,@OutsaideGW,@AirJJ,@AirGW,"
  31. + "@CityTranffic,@RateUSD,@RateJPY,@RateEUR,@RateGBP,@RateHKD,@OPer,@OPDate,@Isdel,@ChoiceOne,@ChoiceTwo,@ChoiceThree,@ChoiceFour,@ChoiceFive,"
  32. + " @SumJJC,@SumGWC,@AirJJC_Checked,@AirGWC_Checked,@ChoiceSix);SELECT @@IDENTITY";
  33. SqlParameter[] parameter = new SqlParameter[]{
  34. new SqlParameter("@Diid",Dov.Diid),
  35. new SqlParameter("@InsidePay",Dov.InsidePay),
  36. new SqlParameter("@VisaPay",Dov.VisaPay),
  37. new SqlParameter("@VisaPayRemark",Dov.VisaPayRemark),
  38. new SqlParameter("@SafePay",Dov.SafePay),
  39. new SqlParameter("@YiMiao",Dov.YiMiao),
  40. new SqlParameter("@HeSuan",Dov.HeSuan),
  41. new SqlParameter("@ServiceFee",Dov.ServiceFee),
  42. new SqlParameter("@Ticket",Dov.Ticket),
  43. new SqlParameter("@OutsideJJ",Dov.OutsideJJ),
  44. new SqlParameter("@OutsaideGW",Dov.OutsaideGW),
  45. new SqlParameter("@AirJJ",Dov.AirJJ),
  46. new SqlParameter("@AirGW",Dov.AirGW),
  47. new SqlParameter("@CityTranffic",Dov.CityTranffic),
  48. new SqlParameter("@RateUSD",Dov.RateUSD),
  49. new SqlParameter("@RateJPY",Dov.RateJPY),
  50. new SqlParameter("@RateEUR",Dov.RateEUR),
  51. new SqlParameter("@RateGBP",Dov.RateGBP),
  52. new SqlParameter("@RateHKD",Dov.RateHKD),
  53. new SqlParameter("@OPer",Dov.OPer),
  54. new SqlParameter("@OPDate",Dov.OPDate),
  55. new SqlParameter("@Isdel",Dov.Isdel),
  56. new SqlParameter("@ChoiceOne",Dov.ChoiceOne),
  57. new SqlParameter("@ChoiceTwo",Dov.ChoiceTwo),
  58. new SqlParameter("@ChoiceThree",Dov.ChoiceThree),
  59. new SqlParameter("@ChoiceFour",Dov.ChoiceFour),
  60. new SqlParameter("@ChoiceFive",Dov.ChoiceFive),
  61. new SqlParameter("@SumJJC",Dov.SumJJC),
  62. new SqlParameter("@SumGWC",Dov.SumGWC),
  63. new SqlParameter("@AirJJC_Checked",Dov.AirJJC_Checked),
  64. new SqlParameter("@AirGWC_Checked",Dov.AirGWC_Checked),
  65. new SqlParameter("@ChoiceSix",Dov.ChoiceSix)
  66. };
  67. int obj = Convert.ToInt32(SqlHelper.ExecuteScalar(sql, CommandType.Text, parameter));
  68. if (obj > 0)
  69. {
  70. return true;
  71. }
  72. return false;
  73. }
  74. //改Update
  75. public bool Edit(EnterExitCost Dov)
  76. {
  77. string sql = "update EnterExitCost set Diid=@Diid,InsidePay=@InsidePay,VisaPay=@VisaPay,VisaPayRemark=@VisaPayRemark,SafePay=@SafePay,YiMiao=@YiMiao,HeSuan=@HeSuan,ServiceFee=@ServiceFee,Ticket=@Ticket,OutsideJJ=@OutsideJJ,OutsaideGW=@OutsaideGW,"
  78. + "AirJJ=@AirJJ,AirGW=@AirGW,CityTranffic=@CityTranffic,RateUSD=@RateUSD,RateJPY=@RateJPY,RateEUR=@RateEUR,RateHKD=@RateHKD,"
  79. + "RateGBP=@RateGBP,OPer=@OPer,OPDate=@OPDate,Isdel=@Isdel,ChoiceOne=@ChoiceOne,ChoiceTwo=@ChoiceTwo,ChoiceThree=@ChoiceThree,ChoiceFour=@ChoiceFour,ChoiceFive=@ChoiceFive,"
  80. + "SumJJC=@SumJJC,SumGWC=@SumGWC,AirJJC_Checked=@AirJJC_Checked,AirGWC_Checked=@AirGWC_Checked,ChoiceSix=@ChoiceSix where Id = @Id";
  81. SqlParameter[] parameter = new SqlParameter[]{
  82. new SqlParameter("@Diid",Dov.Diid),
  83. new SqlParameter("@InsidePay",Dov.InsidePay),
  84. new SqlParameter("@VisaPay",Dov.VisaPay),
  85. new SqlParameter("@VisaPayRemark",Dov.VisaPayRemark),
  86. new SqlParameter("@SafePay",Dov.SafePay),
  87. new SqlParameter("@YiMiao",Dov.YiMiao),
  88. new SqlParameter("@HeSuan",Dov.HeSuan),
  89. new SqlParameter("@ServiceFee",Dov.ServiceFee),
  90. new SqlParameter("@Ticket",Dov.Ticket),
  91. new SqlParameter("@OutsideJJ",Dov.OutsideJJ),
  92. new SqlParameter("@OutsaideGW",Dov.OutsaideGW),
  93. new SqlParameter("@AirJJ",Dov.AirJJ),
  94. new SqlParameter("@AirGW",Dov.AirGW),
  95. new SqlParameter("@CityTranffic",Dov.CityTranffic),
  96. new SqlParameter("@RateUSD",Dov.RateUSD),
  97. new SqlParameter("@RateJPY",Dov.RateJPY),
  98. new SqlParameter("@RateEUR",Dov.RateEUR),
  99. new SqlParameter("@RateGBP",Dov.RateGBP),
  100. new SqlParameter("@RateHKD",Dov.RateHKD),
  101. new SqlParameter("@OPer",Dov.OPer),
  102. new SqlParameter("@OPDate",Dov.OPDate),
  103. new SqlParameter("@Isdel",Dov.Isdel),
  104. new SqlParameter("@ChoiceOne",Dov.ChoiceOne),
  105. new SqlParameter("@ChoiceTwo",Dov.ChoiceTwo),
  106. new SqlParameter("@ChoiceThree",Dov.ChoiceThree),
  107. new SqlParameter("@ChoiceFour",Dov.ChoiceFour),
  108. new SqlParameter("@ChoiceFive",Dov.ChoiceFive),
  109. new SqlParameter("@SumJJC",Dov.SumJJC),
  110. new SqlParameter("@SumGWC",Dov.SumGWC),
  111. new SqlParameter("@AirJJC_Checked",Dov.AirJJC_Checked),
  112. new SqlParameter("@AirGWC_Checked",Dov.AirGWC_Checked),
  113. new SqlParameter("@ChoiceSix",Dov.ChoiceSix),
  114. new SqlParameter("@Id",Dov.Id)
  115. };
  116. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  117. return true;
  118. return false;
  119. }
  120. //删
  121. public bool delOA(int id)
  122. {
  123. if (SqlHelper.ExecuteNonQuery("update EnterExitCost set Isdel=1 where Id= @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  124. return true;
  125. return false;
  126. }
  127. public bool delbydiid(string diid)
  128. {
  129. if (SqlHelper.ExecuteNonQuery("update EnterExitCost set Isdel = 1 where diid = "+ diid, CommandType.Text) > 0)
  130. return true;
  131. return false;
  132. }
  133. public EnterExitCost getById(int id)
  134. {
  135. return excuteType("select * from EnterExitCost where Isdel=0 and diid=@id", new SqlParameter("@id", id));
  136. }
  137. public EnterExitCost getByDiid(string Diid)
  138. {
  139. return excuteType("select * from EnterExitCost where Isdel=0 and Diid =@Diid", new SqlParameter("@Diid", Diid));
  140. }
  141. }
  142. }