GroupCostService.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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 GroupCostService
  11. {
  12. /// <summary>
  13. /// 查询所有
  14. /// </summary>
  15. /// <param name="sql">sql语句</param>
  16. /// <param name="param">可变参数数组</param>
  17. /// <returns>返回集合</returns>
  18. List<GroupCost> excuteSql(string sql, params SqlParameter[] param)
  19. {
  20. return ServiceBase<GroupCost>.excuteSql(new GroupCost(), "GroupCost", 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. GroupCost excuteType(string sql, params SqlParameter[] param)
  29. {
  30. //查询结果放入对象集合
  31. List<GroupCost> hdList = excuteSql(sql, param);
  32. //判断集合是否为空
  33. if (hdList == null || hdList.Count == 0)
  34. //返回null
  35. return null;
  36. //返回单个对象
  37. return hdList[0];
  38. }
  39. /// <summary>
  40. /// 根据编号查询对象信息
  41. /// </summary>
  42. /// <param name="id">对象编号</param>
  43. /// <returns>返回空或者单个对象信息</returns>
  44. public GroupCost GetItaliaTranById(int id)
  45. {
  46. //调用获取单个对象的方法
  47. return excuteType("select * from GroupCost where Id = @id and IsDel = 0", new SqlParameter("@id", id));
  48. }
  49. /// <summary>
  50. /// 查询信息
  51. /// </summary>
  52. /// <returns>返回空或者对象信息</returns>
  53. public List<GroupCost> GetItaliaTranByDiid(int diid)
  54. {
  55. //调用获取单个对象的方法
  56. return excuteSql("select * from GroupCost where Diid = @diid and IsDel = 0 order by Id", new SqlParameter("@diid", diid));
  57. }
  58. /// <summary>
  59. /// 查询信息
  60. /// </summary>
  61. /// <returns>返回空或者对象信息</returns>
  62. public List<GroupCost> GetByDiid(int diid)
  63. {
  64. //调用获取单个对象的方法
  65. return excuteSql("select * from GroupCost where Diid = @diid and IsDel = 0 and (Date!='' or ITIN!='') order by Id", new SqlParameter("@diid", diid));
  66. }
  67. /// <summary>
  68. /// 查询所有
  69. /// </summary>
  70. /// <returns></returns>
  71. public List<GroupCost> GetAll()
  72. {
  73. return excuteSql("select * from GroupCost where IsDel=0");
  74. }
  75. /// <summary>
  76. /// 增加
  77. /// </summary>
  78. /// <param name="cd"></param>
  79. /// <returns></returns>
  80. public bool AddItaliaTran(GroupCost hd)
  81. {
  82. string sql = "insert into GroupCost values(@Diid,@Day,@Date,@ITIN,@CarType,@CarCost,@CarNumber,@CarTiming,@TGS,@TGWH,@TGN,@TGOF,@TGM,@TGA,@TGTF,@TGEF,@CFS,@CFM,@CFOF,@B,@L,@D," +
  83. "@TBR,@SGR,@JS_ES,@Suite,@ACCON,@TV,@IL,@IF,@EF,@B_R_F,@TE,@TGTips,@DRVTips,@PC,@TLF,@ECT,@Oper,@OpTime,@Isdel)";
  84. SqlParameter[] parameter = new SqlParameter[]{
  85. new SqlParameter("@Diid",hd.Diid),
  86. new SqlParameter("@Day",hd.DAY),
  87. new SqlParameter("@Date",hd.Date),
  88. new SqlParameter("@ITIN",hd.ITIN),
  89. new SqlParameter("@CarType",hd.CarType),
  90. new SqlParameter("@CarTiming",hd.CarTiming),
  91. new SqlParameter("@CarCost",hd.CarCost),
  92. new SqlParameter("@CarNumber",hd.CarNumber),
  93. new SqlParameter("@TGS",hd.TGS),
  94. new SqlParameter("@TGWH",hd.TGWH),
  95. new SqlParameter("@TGN",hd.TGN),
  96. new SqlParameter("@TGOF",hd.TGOF),
  97. new SqlParameter("@TGM",hd.TGM),
  98. new SqlParameter("@TGA",hd.TGA),
  99. new SqlParameter("@TGTF",hd.TGTF),
  100. new SqlParameter("@TGEF",hd.TGEF),
  101. new SqlParameter("@CFS",hd.CFS),
  102. new SqlParameter("@CFM",hd.CFM),
  103. new SqlParameter("@CFOF",hd.CFOF),
  104. new SqlParameter("@B",hd.B),
  105. new SqlParameter("@L",hd.L),
  106. new SqlParameter("@D",hd.D),
  107. new SqlParameter("@TBR",hd.TBR),
  108. new SqlParameter("@SGR",hd.SGR),
  109. new SqlParameter("@JS_ES",hd.JS_ES),
  110. new SqlParameter("@Suite",hd.Suite),
  111. new SqlParameter("@ACCON",hd.ACCON),
  112. new SqlParameter("@TV",hd.TV),
  113. new SqlParameter("@IL",hd.iL),
  114. new SqlParameter("@IF",hd.IF),
  115. new SqlParameter("@EF",hd.EF),
  116. new SqlParameter("@B_R_F",hd.B_R_F),
  117. new SqlParameter("@TE",hd.TE),
  118. new SqlParameter("@TGTips",hd.TGTips),
  119. new SqlParameter("@DRVTips",hd.DRVTips),
  120. new SqlParameter("@PC",hd.PC),
  121. new SqlParameter("@TLF",hd.TLF),
  122. new SqlParameter("@ECT",hd.ECT),
  123. new SqlParameter("@Oper",hd.Oper),
  124. new SqlParameter("@OpTime",hd.OpTime),
  125. new SqlParameter("@IsDel",hd.Isdel),
  126. };
  127. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  128. return true;
  129. return false;
  130. }
  131. /// <summary>
  132. /// 编辑
  133. /// </summary>
  134. /// <param name="sdt"></param>
  135. /// <returns></returns>
  136. public bool EditItaliaTran(GroupCost hd)
  137. {
  138. string sql = "update GroupCost set Diid=@Diid,Day=@Day,Date=@Date,ITIN=@ITIN,CarType=@CarType,CarTiming=@CarTiming,CarCost=@CarCost,CarNumber=@CarNumber,TGS=@TGS,TGWH=@TGWH,TGN=@TGN,TGOF=@TGOF," +
  139. "TGM=@TGM,TGA=@TGA,TGTF=@TGTF,TGEF=@TGEF,CFS=@CFS,CFM=@CFM,CFOF=@CFOF,B=@B,L=@L,D=@D,TBR=@TBR,SGR=@SGR,JS_ES=@JS_ES,Suite=@Suite,ACCON=@ACCON,TV=@TV," +
  140. "IL=@IL,[IF]=@IF,EF=@EF,B_R_F=@B_R_F,TE=@TE,TGTips=@TGTips,DRVTips=@DRVTips,PC=@PC,TLF=@TLF,ECT=@ECT,Oper=@Oper,OpTime=@OpTime,Isdel=@Isdel where Id = @Id";
  141. SqlParameter[] parameter = new SqlParameter[]{
  142. new SqlParameter("@Diid",hd.Diid),
  143. new SqlParameter("@Day",hd.DAY),
  144. new SqlParameter("@Date",hd.Date),
  145. new SqlParameter("@ITIN",hd.ITIN),
  146. new SqlParameter("@CarType",hd.CarType),
  147. new SqlParameter("@CarTiming",hd.CarTiming),
  148. new SqlParameter("@CarCost",hd.CarCost),
  149. new SqlParameter("@CarNumber",hd.CarNumber),
  150. new SqlParameter("@TGS",hd.TGS),
  151. new SqlParameter("@TGWH",hd.TGWH),
  152. new SqlParameter("@TGN",hd.TGN),
  153. new SqlParameter("@TGOF",hd.TGOF),
  154. new SqlParameter("@TGM",hd.TGM),
  155. new SqlParameter("@TGA",hd.TGA),
  156. new SqlParameter("@TGTF",hd.TGTF),
  157. new SqlParameter("@TGEF",hd.TGEF),
  158. new SqlParameter("@CFS",hd.CFS),
  159. new SqlParameter("@CFM",hd.CFM),
  160. new SqlParameter("@CFOF",hd.CFOF),
  161. new SqlParameter("@B",hd.B),
  162. new SqlParameter("@L",hd.L),
  163. new SqlParameter("@D",hd.D),
  164. new SqlParameter("@TBR",hd.TBR),
  165. new SqlParameter("@SGR",hd.SGR),
  166. new SqlParameter("@JS_ES",hd.JS_ES),
  167. new SqlParameter("@Suite",hd.Suite),
  168. new SqlParameter("@ACCON",hd.ACCON),
  169. new SqlParameter("@TV",hd.TV),
  170. new SqlParameter("@IL",hd.iL),
  171. new SqlParameter("@IF",hd.IF),
  172. new SqlParameter("@EF",hd.EF),
  173. new SqlParameter("@B_R_F",hd.B_R_F),
  174. new SqlParameter("@TE",hd.TE),
  175. new SqlParameter("@TGTips",hd.TGTips),
  176. new SqlParameter("@DRVTips",hd.DRVTips),
  177. new SqlParameter("@PC",hd.PC),
  178. new SqlParameter("@TLF",hd.TLF),
  179. new SqlParameter("@ECT",hd.ECT),
  180. new SqlParameter("@Oper",hd.Oper),
  181. new SqlParameter("@OpTime",hd.OpTime),
  182. new SqlParameter("@IsDel",hd.Isdel),
  183. new SqlParameter("@Id",hd.Id)
  184. };
  185. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  186. return true;
  187. return false;
  188. }
  189. /// <summary>
  190. /// 删除
  191. /// </summary>
  192. /// <param name="id"></param>
  193. /// <returns></returns>
  194. public bool DelItaliaTran(int id)
  195. {
  196. if (SqlHelper.ExecuteNonQuery("update GroupCost set IsDel = 1 where Id = @Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  197. return true;
  198. return false;
  199. }
  200. }
  201. }