BackProgressService.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 BackProgressService
  11. {
  12. List<BackProgress> excuteSql(string sql, params SqlParameter[] param)
  13. {
  14. return ServiceBase<BackProgress>.excuteSql(new BackProgress(), "BackProgress", sql, CommandType.Text, param);
  15. }
  16. BackProgress excuteType(string sql, params SqlParameter[] param)
  17. {
  18. //查询结果放入对象集合
  19. List<BackProgress> 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(BackProgress Dov)
  29. {
  30. string sql = "insert into BackProgress values(@Diid,@BPTime,@BPRemark,@SQTime,@SQRemark,@CPJTime,@CPJRemark,"
  31. + "@HZTime,@HZRemark,@QZTime,@QZRemark,@SQQZTime,@SQQZRemark,@CQTime,@CQRemark,@XQHTime,@XQHRemark,@SJTime,"
  32. + "@SJRemark,@OPer,@OPDate,@Isdel);SELECT @@IDENTITY";
  33. SqlParameter[] parameter = new SqlParameter[]{
  34. new SqlParameter("@Diid",Dov.Diid),
  35. new SqlParameter("@BPTime",Dov.BPTime),
  36. new SqlParameter("@BPRemark",Dov.BPRemark),
  37. new SqlParameter("@SQTime",Dov.SQTime),
  38. new SqlParameter("@SQRemark",Dov.SQRemark),
  39. new SqlParameter("@CPJTime",Dov.CPJTime),
  40. new SqlParameter("@CPJRemark",Dov.CPJRemark),
  41. new SqlParameter("@HZTime",Dov.HZTime),
  42. new SqlParameter("@HZRemark",Dov.HZRemark),
  43. new SqlParameter("@QZTime",Dov.QZTime),
  44. new SqlParameter("@QZRemark",Dov.QZRemark),
  45. new SqlParameter("@SQQZTime",Dov.SQQZTime),
  46. new SqlParameter("@SQQZRemark",Dov.SQQZRemark),
  47. new SqlParameter("@CQTime",Dov.CQTime),
  48. new SqlParameter("@CQRemark",Dov.CQRemark),
  49. new SqlParameter("@XQHTime",Dov.XQHTime),
  50. new SqlParameter("@XQHRemark",Dov.XQHRemark),
  51. new SqlParameter("@SJTime",Dov.SJTime),
  52. new SqlParameter("@SJRemark",Dov.SJRemark),
  53. new SqlParameter("@OPer",Dov.OPer),
  54. new SqlParameter("@OPDate",Dov.OPDate),
  55. new SqlParameter("@Isdel",Dov.Isdel)
  56. };
  57. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  58. return true;
  59. return false;
  60. }
  61. //改Update
  62. public bool Edit(BackProgress Dov)
  63. {
  64. string sql = "update BackProgress set Diid=@Diid,BPTime=@BPTime,BPRemark=@BPRemark,SQTime=@SQTime,SQRemark=@SQRemark,CPJTime=@CPJTime,"
  65. +"CPJRemark=@CPJRemark,HZTime=@HZTime,HZRemark=@HZRemark,QZTime=@QZTime,QZRemark=@QZRemark,SQQZTime=@SQQZTime,SQQZRemark=@SQQZRemark,"
  66. +"CQTime=@CQTime,CQRemark=@CQRemark,XQHTime=@XQHTime,XQHRemark=@XQHRemark,SJTime=@SJTime,SJRemark=@SJRemark,OPer=@OPer,"
  67. +"OPDate=@OPDate,Isdel=@Isdel where Id = @Id";
  68. SqlParameter[] parameter = new SqlParameter[]{
  69. new SqlParameter("@Diid",Dov.Diid),
  70. new SqlParameter("@BPTime",Dov.BPTime),
  71. new SqlParameter("@BPRemark",Dov.BPRemark),
  72. new SqlParameter("@SQTime",Dov.SQTime),
  73. new SqlParameter("@SQRemark",Dov.SQRemark),
  74. new SqlParameter("@CPJTime",Dov.CPJTime),
  75. new SqlParameter("@CPJRemark",Dov.CPJRemark),
  76. new SqlParameter("@HZTime",Dov.HZTime),
  77. new SqlParameter("@HZRemark",Dov.HZRemark),
  78. new SqlParameter("@QZTime",Dov.QZTime),
  79. new SqlParameter("@QZRemark",Dov.QZRemark),
  80. new SqlParameter("@SQQZTime",Dov.SQQZTime),
  81. new SqlParameter("@SQQZRemark",Dov.SQQZRemark),
  82. new SqlParameter("@CQTime",Dov.CQTime),
  83. new SqlParameter("@CQRemark",Dov.CQRemark),
  84. new SqlParameter("@XQHTime",Dov.XQHTime),
  85. new SqlParameter("@XQHRemark",Dov.XQHRemark),
  86. new SqlParameter("@SJTime",Dov.SJTime),
  87. new SqlParameter("@SJRemark",Dov.SJRemark),
  88. new SqlParameter("@OPer",Dov.OPer),
  89. new SqlParameter("@OPDate",Dov.OPDate),
  90. new SqlParameter("@Isdel",Dov.Isdel),
  91. new SqlParameter("@Id",Dov.Id)
  92. };
  93. if (SqlHelper.ExecuteNonQuery(sql, CommandType.Text, parameter) > 0)
  94. return true;
  95. return false;
  96. }
  97. //删
  98. public bool delOA(int id)
  99. {
  100. if (SqlHelper.ExecuteNonQuery("update BackProgress set Isdel=1 where Id=@Id", CommandType.Text, new SqlParameter("@Id", id)) > 0)
  101. return true;
  102. return false;
  103. }
  104. public BackProgress getById(int id)
  105. {
  106. return excuteType("select * from BackProgress where Isdel=0 and Id=@id", new SqlParameter("@id", id));
  107. }
  108. public BackProgress getByDiid(string Diid)
  109. {
  110. return excuteType("select * from BackProgress where Isdel=0 and Diid =@Diid", new SqlParameter("@Diid", Diid));
  111. }
  112. }
  113. }