DeleProgressService.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 DeleProgressService
  11. {
  12. List<DeleProgress> excuteSql(string sql, params SqlParameter[] param)
  13. {
  14. return ServiceBase<DeleProgress>.excuteSql(new DeleProgress(), "DeleProgress", sql, CommandType.Text, param);
  15. }
  16. DeleProgress excuteType(string sql, params SqlParameter[] param)
  17. {
  18. //查询结果放入对象集合
  19. List<DeleProgress> 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(DeleProgress Dov)
  29. {
  30. string sql = "insert into DeleProgress values(@Diid,@BP_GetReady,@BP_GetReadyTime,@BP_Work,@BP_WorkTime,@HZ_Work,@HZ_WorkTime,"
  31. + "@QZ_Work,@QZ_WorkTime,@SQ_Work,@SQ_WorkTime,@CQ,@CQTime,@XQH,@XQHTime,@SJ,@SJTime,@OPer,@OPDate);SELECT @@IDENTITY";
  32. SqlParameter[] parameter = new SqlParameter[]{
  33. new SqlParameter("@Diid",Dov.Diid),
  34. new SqlParameter("@BP_GetReady",Dov.BP_GetReady),
  35. new SqlParameter("@BP_GetReadyTime",Dov.BP_GetReadyTime),
  36. new SqlParameter("@BP_Work",Dov.BP_Work),
  37. new SqlParameter("@BP_WorkTime",Dov.BP_WorkTime),
  38. new SqlParameter("@HZ_Work",Dov.HZ_Work),
  39. new SqlParameter("@HZ_WorkTime",Dov.HZ_WorkTime),
  40. new SqlParameter("@QZ_Work",Dov.QZ_Work),
  41. new SqlParameter("@QZ_WorkTime",Dov.QZ_WorkTime),
  42. new SqlParameter("@SQ_Work",Dov.SQ_Work),
  43. new SqlParameter("@SQ_WorkTime",Dov.SQ_WorkTime),
  44. new SqlParameter("@CQ",Dov.CQ),
  45. new SqlParameter("@CQTime",Dov.CQTime),
  46. new SqlParameter("@XQH",Dov.XQH),
  47. new SqlParameter("@XQHTime",Dov.XQHTime),
  48. new SqlParameter("@SJ",Dov.SJ),
  49. new SqlParameter("@SJTime",Dov.SJTime),
  50. new SqlParameter("@OPer",Dov.OPer),
  51. new SqlParameter("@OPDate",Dov.OPDate)
  52. };
  53. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  54. return true;
  55. return false;
  56. }
  57. //改Update
  58. public bool Edit(DeleProgress Dov)
  59. {
  60. string sql = "update DeleProgress set Diid=@Diid,BP_GetReady=@BP_GetReady,BP_GetReadyTime=@BP_GetReadyTime,"
  61. + "BP_Work=@BP_Work,BP_WorkTime=@BP_WorkTime,HZ_Work=@HZ_Work,HZ_WorkTime=@HZ_WorkTime,"
  62. + "QZ_Work=@QZ_Work,QZ_WorkTime=@QZ_WorkTime,SQ_Work=@SQ_Work,SQ_WorkTime=@SQ_WorkTime,"
  63. + "CQ=@CQ,CQTime=@CQTime,XQH=@XQH,XQHTime=@XQHTime,SJ=@SJ,SJTime=@SJTime,"
  64. + "OPer=@OPer,OPDate=@OPDate where Id = @Id";
  65. SqlParameter[] parameter = new SqlParameter[]{
  66. new SqlParameter("@Diid",Dov.Diid),
  67. new SqlParameter("@BP_GetReady",Dov.BP_GetReady),
  68. new SqlParameter("@BP_GetReadyTime",Dov.BP_GetReadyTime),
  69. new SqlParameter("@BP_Work",Dov.BP_Work),
  70. new SqlParameter("@BP_WorkTime",Dov.BP_WorkTime),
  71. new SqlParameter("@HZ_Work",Dov.HZ_Work),
  72. new SqlParameter("@HZ_WorkTime",Dov.HZ_WorkTime),
  73. new SqlParameter("@QZ_Work",Dov.QZ_Work),
  74. new SqlParameter("@QZ_WorkTime",Dov.QZ_WorkTime),
  75. new SqlParameter("@SQ_Work",Dov.SQ_Work),
  76. new SqlParameter("@SQ_WorkTime",Dov.SQ_WorkTime),
  77. new SqlParameter("@CQ",Dov.CQ),
  78. new SqlParameter("@CQTime",Dov.CQTime),
  79. new SqlParameter("@XQH",Dov.XQH),
  80. new SqlParameter("@XQHTime",Dov.XQHTime),
  81. new SqlParameter("@SJ",Dov.SJ),
  82. new SqlParameter("@SJTime",Dov.SJTime),
  83. new SqlParameter("@OPer",Dov.OPer),
  84. new SqlParameter("@OPDate",Dov.OPDate),
  85. new SqlParameter("@Id",Dov.Id)
  86. };
  87. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  88. return true;
  89. return false;
  90. }
  91. public DeleProgress getByDiid(string Diid)
  92. {
  93. return excuteType("select * from DeleProgress where Diid =@Diid", new SqlParameter("@Diid", Diid));
  94. }
  95. }
  96. }