Няма описание

Rotation.cs 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using CallCenterApi.DB;
  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. using System.Threading.Tasks;
  9. namespace CallCenterApi.DAL
  10. {
  11. public class Rotation
  12. {
  13. /// <summary>
  14. /// 增加一条图片
  15. /// </summary>
  16. /// <param name="model"></param>
  17. /// <returns></returns>
  18. public int Add(Model.Rotation model)
  19. {
  20. StringBuilder strSql = new StringBuilder();
  21. strSql.Append("insert into Rotation(");
  22. strSql.Append("roname,romath,uploadpeo,uploaddate,isEnable)");
  23. strSql.Append(" values (");
  24. strSql.Append("@roname,@romath,@uploadpeo,@uploaddate,@isEnable)");
  25. strSql.Append(";select @@IDENTITY");
  26. SqlParameter[] parameters = {
  27. new SqlParameter("@roname", SqlDbType.NVarChar,100),
  28. new SqlParameter("@romath", SqlDbType.NVarChar,300),
  29. new SqlParameter("@uploadpeo", SqlDbType.NVarChar,100),
  30. new SqlParameter("@uploaddate", SqlDbType.DateTime),
  31. new SqlParameter ("@isEnable",SqlDbType.Int,4)};
  32. parameters[0].Value = model.roname;
  33. parameters[1].Value = model.romath;
  34. parameters[2].Value = model.uploadpeo;
  35. parameters[3].Value = model.uploaddate;
  36. parameters[4].Value = model.isEnable;
  37. object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
  38. if (obj == null)
  39. {
  40. return 0;
  41. }
  42. else
  43. {
  44. return Convert.ToInt32(obj);
  45. }
  46. }
  47. /// <summary>
  48. /// 查询图片信息
  49. /// </summary>
  50. /// <returns></returns>
  51. public DataSet GetList()
  52. {
  53. StringBuilder strSql = new StringBuilder();
  54. strSql.Append("select ");
  55. strSql.Append(" * ");
  56. strSql.Append(" FROM Rotation ");
  57. var ds = DbHelperSQL.Query(strSql.ToString());
  58. return ds;
  59. }
  60. /// <summary>
  61. /// 禁用图片信息
  62. /// </summary>
  63. /// <param name="id"></param>
  64. /// <returns></returns>
  65. public bool delrotation(string id)
  66. {
  67. StringBuilder strSql = new StringBuilder();
  68. strSql.Append("update Rotation set isEnable=1 ");
  69. strSql.Append(" where id in (" + id + ") ");
  70. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  71. if (rows > 0)
  72. {
  73. return true;
  74. }
  75. else
  76. {
  77. return false;
  78. }
  79. }
  80. /// <summary>
  81. /// 启用图片信息
  82. /// </summary>
  83. /// <param name="id"></param>
  84. /// <returns></returns>
  85. public bool poenRotion(string id)
  86. {
  87. StringBuilder strSql = new StringBuilder();
  88. strSql.Append("update Rotation set isEnable=0 ");
  89. strSql.Append(" where id in (" + id + ") ");
  90. int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
  91. if (rows > 0)
  92. {
  93. return true;
  94. }
  95. else
  96. {
  97. return false;
  98. }
  99. }
  100. }
  101. }