zhaozhiqiang лет назад: 5
Родитель
Сommit
f868012eb0

+ 38 - 0
codegit/CallCenterApi/CallCenterApi.BLL/Rotation.cs

@@ -1,5 +1,6 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3
+using System.Data;
3 4
 using System.Linq;
4 5
 using System.Text;
5 6
 using System.Threading.Tasks;
@@ -8,5 +9,42 @@ namespace CallCenterApi.BLL
8 9
 {
9 10
    public  class Rotation
10 11
     {
12
+        DAL.Rotation dal = new DAL.Rotation();
13
+        /// <summary>
14
+        /// 增加一条图片
15
+        /// </summary>
16
+        /// <param name="model"></param>
17
+        /// <returns></returns>
18
+        public int Add(Model.Rotation model)
19
+        {
20
+            return dal.Add(model);
21
+        }
22
+        /// <summary>
23
+        /// 查询图片信息
24
+        /// </summary>
25
+        /// <returns></returns>
26
+        public DataSet GetList()
27
+        {
28
+            return dal.GetList();
29
+        }
30
+        /// <summary>
31
+        /// 禁用图片信息
32
+        /// </summary>
33
+        /// <param name="id"></param>
34
+        /// <returns></returns>
35
+        public bool delrotation(string  id)
36
+        {
37
+            return dal.delrotation(id);
38
+        }
39
+        /// <summary>
40
+        /// 启用图片信息
41
+        /// </summary>
42
+        /// <param name="id"></param>
43
+        /// <returns></returns>
44
+        public bool poenRotion(string id)
45
+        {
46
+            return dal.poenRotion(id);
47
+
48
+        }
11 49
     }
12 50
 }

+ 97 - 1
codegit/CallCenterApi/CallCenterApi.DAL/Rotation.cs

@@ -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
 }

+ 4 - 0
codegit/CallCenterApi/CallCenterApi.Model/Rotation.cs

@@ -28,5 +28,9 @@ namespace CallCenterApi.Model
28 28
         /// 操作时间
29 29
         /// </summary>
30 30
         public DateTime uploaddate { get; set; }
31
+        /// <summary>
32
+        /// 是否启用
33
+        /// </summary>
34
+        public int isEnable { get; set; }
31 35
     }
32 36
 }