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