lihai лет назад: 8
Родитель
Сommit
be746d74dd

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.BLL/CallCenterApi.BLL.csproj

@@ -68,6 +68,7 @@
68 68
     <Compile Include="T_Cus_CustomerBase.cs" />
69 69
     <Compile Include="T_Cus_CustomerExpand.cs" />
70 70
     <Compile Include="T_Msg_List.cs" />
71
+    <Compile Include="T_Msg_NoticeInfo.cs" />
71 72
     <Compile Include="T_QC_IndexBase.cs" />
72 73
     <Compile Include="T_QC_IndexCategory.cs" />
73 74
     <Compile Include="T_QC_IndexRes.cs" />

+ 132 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Msg_NoticeInfo.cs

@@ -0,0 +1,132 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace CallCenterApi.BLL
9
+{
10
+    /// <summary>
11
+    /// 公告信息表
12
+    /// </summary>
13
+    public partial class T_Msg_NoticeInfo
14
+    {
15
+        private readonly CallCenterApi.DAL.T_Msg_NoticeInfo dal = new CallCenterApi.DAL.T_Msg_NoticeInfo();
16
+        public T_Msg_NoticeInfo()
17
+        { }
18
+        #region  BasicMethod
19
+        /// <summary>
20
+        /// 增加一条数据
21
+        /// </summary>
22
+        public int Add(CallCenterApi.Model.T_Msg_NoticeInfo model)
23
+        {
24
+            return dal.Add(model);
25
+        }
26
+
27
+        /// <summary>
28
+        /// 更新一条数据
29
+        /// </summary>
30
+        public bool Update(CallCenterApi.Model.T_Msg_NoticeInfo model)
31
+        {
32
+            return dal.Update(model);
33
+        }
34
+
35
+        /// <summary>
36
+        /// 删除一条数据
37
+        /// </summary>
38
+        public bool Delete(int F_NoticeId)
39
+        {
40
+
41
+            return dal.Delete(F_NoticeId);
42
+        }
43
+        /// <summary>
44
+        /// 删除一条数据
45
+        /// </summary>
46
+        public bool DeleteList(string F_NoticeIdlist)
47
+        {
48
+            return dal.DeleteList(F_NoticeIdlist);
49
+        }
50
+
51
+        /// <summary>
52
+        /// 得到一个对象实体
53
+        /// </summary>
54
+        public CallCenterApi.Model.T_Msg_NoticeInfo GetModel(int F_NoticeId)
55
+        {
56
+
57
+            return dal.GetModel(F_NoticeId);
58
+        }
59
+
60
+        /// <summary>
61
+        /// 获得数据列表
62
+        /// </summary>
63
+        public DataSet GetList(string strWhere)
64
+        {
65
+            return dal.GetList(strWhere);
66
+        }
67
+        /// <summary>
68
+        /// 获得前几行数据
69
+        /// </summary>
70
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
71
+        {
72
+            return dal.GetList(Top, strWhere, filedOrder);
73
+        }
74
+        /// <summary>
75
+        /// 获得数据列表
76
+        /// </summary>
77
+        public List<CallCenterApi.Model.T_Msg_NoticeInfo> GetModelList(string strWhere)
78
+        {
79
+            DataSet ds = dal.GetList(strWhere);
80
+            return DataTableToList(ds.Tables[0]);
81
+        }
82
+        /// <summary>
83
+        /// 获得数据列表
84
+        /// </summary>
85
+        public List<CallCenterApi.Model.T_Msg_NoticeInfo> DataTableToList(DataTable dt)
86
+        {
87
+            List<CallCenterApi.Model.T_Msg_NoticeInfo> modelList = new List<CallCenterApi.Model.T_Msg_NoticeInfo>();
88
+            int rowsCount = dt.Rows.Count;
89
+            if (rowsCount > 0)
90
+            {
91
+                CallCenterApi.Model.T_Msg_NoticeInfo model;
92
+                for (int n = 0; n < rowsCount; n++)
93
+                {
94
+                    model = dal.DataRowToModel(dt.Rows[n]);
95
+                    if (model != null)
96
+                    {
97
+                        modelList.Add(model);
98
+                    }
99
+                }
100
+            }
101
+            return modelList;
102
+        }
103
+
104
+        /// <summary>
105
+        /// 获得数据列表
106
+        /// </summary>
107
+        public DataSet GetAllList()
108
+        {
109
+            return GetList("");
110
+        }
111
+
112
+        /// <summary>
113
+        /// 分页获取数据列表
114
+        /// </summary>
115
+        public int GetRecordCount(string strWhere)
116
+        {
117
+            return dal.GetRecordCount(strWhere);
118
+        }
119
+        /// <summary>
120
+        /// 分页获取数据列表
121
+        /// </summary>
122
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
123
+        {
124
+            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
125
+        }
126
+
127
+        #endregion  BasicMethod
128
+        #region  ExtensionMethod
129
+
130
+        #endregion  ExtensionMethod
131
+    }
132
+}

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.DAL/CallCenterApi.DAL.csproj

@@ -68,6 +68,7 @@
68 68
     <Compile Include="T_Cus_CustomerBase.cs" />
69 69
     <Compile Include="T_Cus_CustomerExpand.cs" />
70 70
     <Compile Include="T_Msg_List.cs" />
71
+    <Compile Include="T_Msg_NoticeInfo.cs" />
71 72
     <Compile Include="T_QC_IndexBase.cs" />
72 73
     <Compile Include="T_QC_IndexCategory.cs" />
73 74
     <Compile Include="T_QC_IndexRes.cs" />

+ 311 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Msg_NoticeInfo.cs

@@ -0,0 +1,311 @@
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
+
10
+namespace CallCenterApi.DAL
11
+{
12
+    public partial class T_Msg_NoticeInfo
13
+    {
14
+        public T_Msg_NoticeInfo()
15
+        { }
16
+        #region  BasicMethod
17
+
18
+        /// <summary>
19
+        /// 增加一条数据
20
+        /// </summary>
21
+        public int Add(CallCenterApi.Model.T_Msg_NoticeInfo model)
22
+        {
23
+            StringBuilder strSql = new StringBuilder();
24
+            strSql.Append("insert into T_Msg_NoticeInfo(");
25
+            strSql.Append("F_Title,F_Content,F_StartDate,F_EndDate,F_CreateOn,F_CreateBy,F_ModifyBy,F_ModifyDate)");
26
+            strSql.Append(" values (");
27
+            strSql.Append("@F_Title,@F_Content,@F_StartDate,@F_EndDate,@F_CreateOn,@F_CreateBy,@F_ModifyBy,@F_ModifyDate)");
28
+            strSql.Append(";select @@IDENTITY");
29
+            SqlParameter[] parameters = {
30
+                    new SqlParameter("@F_Title", SqlDbType.NVarChar,100),
31
+                    new SqlParameter("@F_Content", SqlDbType.NText),
32
+                    new SqlParameter("@F_StartDate", SqlDbType.DateTime),
33
+                    new SqlParameter("@F_EndDate", SqlDbType.DateTime),
34
+                    new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
35
+                    new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
36
+                    new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
37
+                    new SqlParameter("@F_ModifyDate", SqlDbType.DateTime)};
38
+            parameters[0].Value = model.F_Title;
39
+            parameters[1].Value = model.F_Content;
40
+            parameters[2].Value = model.F_StartDate;
41
+            parameters[3].Value = model.F_EndDate;
42
+            parameters[4].Value = model.F_CreateOn;
43
+            parameters[5].Value = model.F_CreateBy;
44
+            parameters[6].Value = model.F_ModifyBy;
45
+            parameters[7].Value = model.F_ModifyDate;
46
+
47
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
48
+            if (obj == null)
49
+            {
50
+                return 0;
51
+            }
52
+            else
53
+            {
54
+                return Convert.ToInt32(obj);
55
+            }
56
+        }
57
+        /// <summary>
58
+        /// 更新一条数据
59
+        /// </summary>
60
+        public bool Update(CallCenterApi.Model.T_Msg_NoticeInfo model)
61
+        {
62
+            StringBuilder strSql = new StringBuilder();
63
+            strSql.Append("update T_Msg_NoticeInfo set ");
64
+            strSql.Append("F_Title=@F_Title,");
65
+            strSql.Append("F_Content=@F_Content,");
66
+            strSql.Append("F_StartDate=@F_StartDate,");
67
+            strSql.Append("F_EndDate=@F_EndDate,");
68
+            strSql.Append("F_CreateOn=@F_CreateOn,");
69
+            strSql.Append("F_CreateBy=@F_CreateBy,");
70
+            strSql.Append("F_ModifyBy=@F_ModifyBy,");
71
+            strSql.Append("F_ModifyDate=@F_ModifyDate");
72
+            strSql.Append(" where F_NoticeId=@F_NoticeId");
73
+            SqlParameter[] parameters = {
74
+                    new SqlParameter("@F_Title", SqlDbType.NVarChar,100),
75
+                    new SqlParameter("@F_Content", SqlDbType.NText),
76
+                    new SqlParameter("@F_StartDate", SqlDbType.DateTime),
77
+                    new SqlParameter("@F_EndDate", SqlDbType.DateTime),
78
+                    new SqlParameter("@F_CreateOn", SqlDbType.DateTime),
79
+                    new SqlParameter("@F_CreateBy", SqlDbType.Int,4),
80
+                    new SqlParameter("@F_ModifyBy", SqlDbType.Int,4),
81
+                    new SqlParameter("@F_ModifyDate", SqlDbType.DateTime),
82
+                    new SqlParameter("@F_NoticeId", SqlDbType.Int,4)};
83
+            parameters[0].Value = model.F_Title;
84
+            parameters[1].Value = model.F_Content;
85
+            parameters[2].Value = model.F_StartDate;
86
+            parameters[3].Value = model.F_EndDate;
87
+            parameters[4].Value = model.F_CreateOn;
88
+            parameters[5].Value = model.F_CreateBy;
89
+            parameters[6].Value = model.F_ModifyBy;
90
+            parameters[7].Value = model.F_ModifyDate;
91
+            parameters[8].Value = model.F_NoticeId;
92
+
93
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
94
+            if (rows > 0)
95
+            {
96
+                return true;
97
+            }
98
+            else
99
+            {
100
+                return false;
101
+            }
102
+        }
103
+
104
+        /// <summary>
105
+        /// 删除一条数据
106
+        /// </summary>
107
+        public bool Delete(int F_NoticeId)
108
+        {
109
+
110
+            StringBuilder strSql = new StringBuilder();
111
+            strSql.Append("delete from T_Msg_NoticeInfo ");
112
+            strSql.Append(" where F_NoticeId=@F_NoticeId");
113
+            SqlParameter[] parameters = {
114
+                    new SqlParameter("@F_NoticeId", SqlDbType.Int,4)
115
+            };
116
+            parameters[0].Value = F_NoticeId;
117
+
118
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
119
+            if (rows > 0)
120
+            {
121
+                return true;
122
+            }
123
+            else
124
+            {
125
+                return false;
126
+            }
127
+        }
128
+        /// <summary>
129
+        /// 批量删除数据
130
+        /// </summary>
131
+        public bool DeleteList(string F_NoticeIdlist)
132
+        {
133
+            StringBuilder strSql = new StringBuilder();
134
+            strSql.Append("delete from T_Msg_NoticeInfo ");
135
+            strSql.Append(" where F_NoticeId in (" + F_NoticeIdlist + ")  ");
136
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
137
+            if (rows > 0)
138
+            {
139
+                return true;
140
+            }
141
+            else
142
+            {
143
+                return false;
144
+            }
145
+        }
146
+
147
+
148
+        /// <summary>
149
+        /// 得到一个对象实体
150
+        /// </summary>
151
+        public CallCenterApi.Model.T_Msg_NoticeInfo GetModel(int F_NoticeId)
152
+        {
153
+
154
+            StringBuilder strSql = new StringBuilder();
155
+            strSql.Append("select  top 1 F_NoticeId,F_Title,F_Content,F_StartDate,F_EndDate,F_CreateOn,F_CreateBy,F_ModifyBy,F_ModifyDate from T_Msg_NoticeInfo ");
156
+            strSql.Append(" where F_NoticeId=@F_NoticeId");
157
+            SqlParameter[] parameters = {
158
+                    new SqlParameter("@F_NoticeId", SqlDbType.Int,4)
159
+            };
160
+            parameters[0].Value = F_NoticeId;
161
+
162
+            CallCenterApi.Model.T_Msg_NoticeInfo model = new CallCenterApi.Model.T_Msg_NoticeInfo();
163
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
164
+            if (ds.Tables[0].Rows.Count > 0)
165
+            {
166
+                return DataRowToModel(ds.Tables[0].Rows[0]);
167
+            }
168
+            else
169
+            {
170
+                return null;
171
+            }
172
+        }
173
+
174
+
175
+        /// <summary>
176
+        /// 得到一个对象实体
177
+        /// </summary>
178
+        public CallCenterApi.Model.T_Msg_NoticeInfo DataRowToModel(DataRow row)
179
+        {
180
+            CallCenterApi.Model.T_Msg_NoticeInfo model = new CallCenterApi.Model.T_Msg_NoticeInfo();
181
+            if (row != null)
182
+            {
183
+                if (row["F_NoticeId"] != null && row["F_NoticeId"].ToString() != "")
184
+                {
185
+                    model.F_NoticeId = int.Parse(row["F_NoticeId"].ToString());
186
+                }
187
+                if (row["F_Title"] != null)
188
+                {
189
+                    model.F_Title = row["F_Title"].ToString();
190
+                }
191
+                if (row["F_Content"] != null)
192
+                {
193
+                    model.F_Content = row["F_Content"].ToString();
194
+                }
195
+                if (row["F_StartDate"] != null && row["F_StartDate"].ToString() != "")
196
+                {
197
+                    model.F_StartDate = DateTime.Parse(row["F_StartDate"].ToString());
198
+                }
199
+                if (row["F_EndDate"] != null && row["F_EndDate"].ToString() != "")
200
+                {
201
+                    model.F_EndDate = DateTime.Parse(row["F_EndDate"].ToString());
202
+                }
203
+                if (row["F_CreateOn"] != null && row["F_CreateOn"].ToString() != "")
204
+                {
205
+                    model.F_CreateOn = DateTime.Parse(row["F_CreateOn"].ToString());
206
+                }
207
+                if (row["F_CreateBy"] != null && row["F_CreateBy"].ToString() != "")
208
+                {
209
+                    model.F_CreateBy = int.Parse(row["F_CreateBy"].ToString());
210
+                }
211
+                if (row["F_ModifyBy"] != null && row["F_ModifyBy"].ToString() != "")
212
+                {
213
+                    model.F_ModifyBy = int.Parse(row["F_ModifyBy"].ToString());
214
+                }
215
+                if (row["F_ModifyDate"] != null && row["F_ModifyDate"].ToString() != "")
216
+                {
217
+                    model.F_ModifyDate = DateTime.Parse(row["F_ModifyDate"].ToString());
218
+                }
219
+            }
220
+            return model;
221
+        }
222
+
223
+        /// <summary>
224
+        /// 获得数据列表
225
+        /// </summary>
226
+        public DataSet GetList(string strWhere)
227
+        {
228
+            StringBuilder strSql = new StringBuilder();
229
+            strSql.Append("select F_NoticeId,F_Title,F_Content,F_StartDate,F_EndDate,F_CreateOn,F_CreateBy,F_ModifyBy,F_ModifyDate ");
230
+            strSql.Append(" FROM T_Msg_NoticeInfo ");
231
+            if (strWhere.Trim() != "")
232
+            {
233
+                strSql.Append(" where " + strWhere);
234
+            }
235
+            return DbHelperSQL.Query(strSql.ToString());
236
+        }
237
+
238
+        /// <summary>
239
+        /// 获得前几行数据
240
+        /// </summary>
241
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
242
+        {
243
+            StringBuilder strSql = new StringBuilder();
244
+            strSql.Append("select ");
245
+            if (Top > 0)
246
+            {
247
+                strSql.Append(" top " + Top.ToString());
248
+            }
249
+            strSql.Append(" F_NoticeId,F_Title,F_Content,F_StartDate,F_EndDate,F_CreateOn,F_CreateBy,F_ModifyBy,F_ModifyDate ");
250
+            strSql.Append(" FROM T_Msg_NoticeInfo ");
251
+            if (strWhere.Trim() != "")
252
+            {
253
+                strSql.Append(" where " + strWhere);
254
+            }
255
+            strSql.Append(" order by " + filedOrder);
256
+            return DbHelperSQL.Query(strSql.ToString());
257
+        }
258
+
259
+        /// <summary>
260
+        /// 获取记录总数
261
+        /// </summary>
262
+        public int GetRecordCount(string strWhere)
263
+        {
264
+            StringBuilder strSql = new StringBuilder();
265
+            strSql.Append("select count(1) FROM T_Msg_NoticeInfo ");
266
+            if (strWhere.Trim() != "")
267
+            {
268
+                strSql.Append(" where " + strWhere);
269
+            }
270
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
271
+            if (obj == null)
272
+            {
273
+                return 0;
274
+            }
275
+            else
276
+            {
277
+                return Convert.ToInt32(obj);
278
+            }
279
+        }
280
+        /// <summary>
281
+        /// 分页获取数据列表
282
+        /// </summary>
283
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
284
+        {
285
+            StringBuilder strSql = new StringBuilder();
286
+            strSql.Append("SELECT * FROM ( ");
287
+            strSql.Append(" SELECT ROW_NUMBER() OVER (");
288
+            if (!string.IsNullOrEmpty(orderby.Trim()))
289
+            {
290
+                strSql.Append("order by T." + orderby);
291
+            }
292
+            else
293
+            {
294
+                strSql.Append("order by T.F_NoticeId desc");
295
+            }
296
+            strSql.Append(")AS Row, T.*  from T_Msg_NoticeInfo T ");
297
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
298
+            {
299
+                strSql.Append(" WHERE " + strWhere);
300
+            }
301
+            strSql.Append(" ) TT");
302
+            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
303
+            return DbHelperSQL.Query(strSql.ToString());
304
+        }
305
+
306
+        #endregion  BasicMethod
307
+        #region  ExtensionMethod
308
+
309
+        #endregion  ExtensionMethod
310
+    }
311
+}

+ 2 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/CallCenterApi.Interface.csproj

@@ -215,6 +215,7 @@
215 215
     <Compile Include="Controllers\HomeController.cs" />
216 216
     <Compile Include="Controllers\IndexController.cs" />
217 217
     <Compile Include="Controllers\InfoController.cs" />
218
+    <Compile Include="Controllers\Information\NoticeController.cs" />
218 219
     <Compile Include="Controllers\knowledge\KnowledgeClassController.cs" />
219 220
     <Compile Include="Controllers\knowledge\KnowledgeController.cs" />
220 221
     <Compile Include="Controllers\LogController.cs" />
@@ -377,6 +378,7 @@
377 378
     <Folder Include="Views\Mobiledata\" />
378 379
     <Folder Include="Views\Module\" />
379 380
     <Folder Include="Views\Msg\" />
381
+    <Folder Include="Views\Notice\" />
380 382
     <Folder Include="Views\Order\" />
381 383
     <Folder Include="Views\Product\" />
382 384
     <Folder Include="Views\QCManage\" />

+ 7 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Base/BaseController.cs

@@ -17,6 +17,13 @@ namespace CallCenterApi.Interface.Controllers.Base
17 17
                 return (FormsPrincipal<Cache.Models.CurrentUserInfo>)base.User;
18 18
             }
19 19
         }
20
+        public new FormsPrincipal<Dictionary<string, string>> User
21
+        {
22
+            get
23
+            {
24
+                return (FormsPrincipal<Dictionary<string, string>>)base.User;
25
+            }
26
+        }
20 27
         /// <summary>
21 28
         /// Log4net 日志
22 29
         /// </summary>

+ 268 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/Information/NoticeController.cs

@@ -0,0 +1,268 @@
1
+using CallCenter.Utility;
2
+using CallCenterApi.Interface.Controllers.Base;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.Data;
6
+using System.Linq;
7
+using System.Web;
8
+using System.Web.Mvc;
9
+
10
+namespace CallCenterApi.Interface.Controllers.Information
11
+{
12
+    public class NoticeController : BaseController
13
+    {
14
+        BLL.T_Msg_NoticeInfo dBLL = new BLL.T_Msg_NoticeInfo();
15
+        // 获取公告列表
16
+        public ActionResult GetList(string datetime)
17
+        {
18
+            ActionResult res = NoToken("未知错误,请重新登录");
19
+            if (Request.IsAuthenticated)
20
+            {
21
+                DataTable dt = new DataTable();
22
+                string strpageindex = RequestString.GetQueryString("page");
23
+                int pageindex = 1;
24
+                string strpagesize = RequestString.GetQueryString("pagesize");
25
+                int pagesize = 10;
26
+                string sql = "";
27
+                if (datetime != null && datetime.Trim() != "")
28
+                {
29
+                    sql += " and Datediff(day,F_Startdate,'" + datetime.Trim() + "')>=0";
30
+                    sql += " and Datediff(day,F_Enddate,'" + datetime.Trim() + "')<=0";
31
+                }
32
+                //else
33
+                //{
34
+                //    sql += " and Datediff(day,F_Startdate,getdate())>=0";
35
+                //    sql += " and Datediff(day,F_Enddate,getdate())<=0";
36
+                //}
37
+
38
+                if (strpageindex.Trim() != "")
39
+                {
40
+                    pageindex = Convert.ToInt32(strpageindex);
41
+                }
42
+                if (strpagesize.Trim() != "")
43
+                {
44
+                    pagesize = Convert.ToInt32(strpagesize);
45
+                }
46
+                int recordCount = 0;
47
+                dt = BLL.PagerBLL.GetListPager(
48
+                    "T_Msg_NoticeInfo",
49
+                    "F_NoticeId",
50
+                    "*",
51
+                    sql,
52
+                    "ORDER BY F_NoticeId desc",
53
+                    pagesize,
54
+                    pageindex,
55
+                    true,
56
+                    out recordCount);
57
+                List<Model.T_Msg_NoticeInfo> msgList = new BLL.T_Msg_NoticeInfo().DataTableToList(dt);
58
+                List<Model.T_Sys_UserAccount> userList = new BLL.T_Sys_UserAccount().GetModelList("");
59
+                var obj = new
60
+                {
61
+                    rows = msgList.Select(m => {
62
+                        Model.T_Sys_UserAccount usermodel = userList.Where(u => u.F_UserId == m.F_CreateBy.Value).FirstOrDefault();
63
+                        var uname = ""; var sdate = ""; var edate = "";
64
+                        if (usermodel != null)
65
+                            uname = usermodel.F_UserName;
66
+                        if (m.F_StartDate != null)
67
+                            sdate = m.F_StartDate.Value.ToString("yyyy-MM-dd");
68
+                        if (m.F_EndDate != null)
69
+                            edate = m.F_EndDate.Value.ToString("yyyy-MM-dd");
70
+                        return new
71
+                        {
72
+                            F_NoticeId = m.F_NoticeId,
73
+                            F_Title = m.F_Title,
74
+                            F_Content = m.F_Content,
75
+                            F_StartDate = sdate,
76
+                            F_EndDate = edate,
77
+                            F_CreateOn = m.F_CreateOn,
78
+                            F_CreateBy = m.F_CreateBy,
79
+                            F_CreateByName = uname
80
+                        };
81
+                    }),
82
+                    total = recordCount
83
+                };
84
+
85
+                res = Content(obj.ToJson());
86
+            }
87
+            return res;
88
+        }
89
+
90
+        //首页获取公告
91
+        public ActionResult GetListTop(int top)
92
+        {
93
+            ActionResult res = NoToken("未知错误,请重新登录");
94
+            if (Request.IsAuthenticated)
95
+            {
96
+                DataTable dt = new DataTable();
97
+                string sql = " 1=1 ";
98
+                sql += " and Datediff(day,F_Startdate,getdate())>=0";
99
+                sql += " and Datediff(day,F_Enddate,getdate())<=0";
100
+                dt = new BLL.T_Msg_NoticeInfo().GetList(top, sql, " F_NoticeId desc ").Tables[0];
101
+                int recordCount = dt.Rows.Count;
102
+                var obj = new
103
+                {
104
+                    rows = dt,
105
+                    total = recordCount
106
+                };
107
+                res = Content(obj.ToJson());
108
+            }
109
+            return res;
110
+        }
111
+
112
+        //获取公告
113
+        public ActionResult GetNotice(string noticeid)
114
+        {
115
+            ActionResult res = NoToken("未知错误,请重新登录");
116
+
117
+            if (noticeid != null && noticeid.Trim() != "")
118
+            {
119
+                Model.T_Sys_UserAccount userModel = new Model.T_Sys_UserAccount();
120
+                Model.T_Msg_NoticeInfo dModel = dBLL.GetModel(int.Parse(noticeid.Trim()));
121
+                if (dModel != null)
122
+                {
123
+                    if (dModel.F_CreateBy != null)
124
+                        userModel = new BLL.T_Sys_UserAccount().GetModel(dModel.F_CreateBy.Value);
125
+                    var uname = ""; var sdate = ""; var edate = "";
126
+                    if (userModel != null)
127
+                        uname = userModel.F_UserName;
128
+                    if (dModel.F_StartDate != null)
129
+                        sdate = dModel.F_StartDate.Value.ToString("yyyy-MM-dd");
130
+                    if (dModel.F_EndDate != null)
131
+                        edate = dModel.F_EndDate.Value.ToString("yyyy-MM-dd");
132
+                    var obj = new
133
+                    {
134
+                        F_NoticeId = dModel.F_NoticeId,
135
+                        F_Title = dModel.F_Title,
136
+                        F_Content = dModel.F_Content,
137
+                        F_StartDate = sdate,
138
+                        F_EndDate = edate,
139
+                        F_CreateOn = dModel.F_CreateOn,
140
+                        F_CreateBy = dModel.F_CreateBy,
141
+                        F_CreateByName = uname
142
+                    };
143
+                    res = Success("获取公告信息成功", obj);
144
+                }
145
+                else
146
+                {
147
+                    res = Error("获取公告信息失败");
148
+                }
149
+            }
150
+            else
151
+            {
152
+                res = Error("获取参数失败");
153
+            }
154
+
155
+            return res;
156
+        }
157
+        [Authority]
158
+        //添加公告
159
+        public ActionResult AddNotice(string title, string content, string stime, string etime)
160
+        {
161
+            ActionResult res = NoToken("未知错误,请重新登录");
162
+            if (Request.IsAuthenticated)
163
+            {
164
+
165
+                Model.T_Msg_NoticeInfo dModel = new Model.T_Msg_NoticeInfo();
166
+
167
+                if (title != null)
168
+                    dModel.F_Title = title.Trim();
169
+                if (content != null)
170
+                    dModel.F_Content = content.Trim();
171
+                if (stime != null)
172
+                    dModel.F_StartDate = DateTime.Parse(stime);
173
+                if (etime != null)
174
+                    dModel.F_EndDate = DateTime.Parse(etime);
175
+
176
+                dModel.F_CreateOn = DateTime.Now;
177
+                dModel.F_CreateBy = int.Parse(User.UserData["F_UserID"]);
178
+
179
+                int b = dBLL.Add(dModel);
180
+                if (b > 0)
181
+                {
182
+                    res = Success("添加成功");
183
+                }
184
+                else
185
+                {
186
+                    res = Success("添加失败");
187
+                }
188
+
189
+            }
190
+            return res;
191
+        }
192
+        [Authority]
193
+        //编辑公告
194
+        public ActionResult EditNotice(string nid, string title, string content, string stime, string etime)
195
+        {
196
+            ActionResult res = NoToken("未知错误,请重新登录");
197
+            if (Request.IsAuthenticated)
198
+            {
199
+
200
+                if (nid != null && nid.Trim() != "")
201
+                {
202
+                    Model.T_Msg_NoticeInfo dModel = dBLL.GetModel(int.Parse(nid.Trim()));
203
+                    if (dModel != null)
204
+                    {
205
+                        if (title != null)
206
+                            dModel.F_Title = title.Trim();
207
+                        if (content != null)
208
+                            dModel.F_Content = content.Trim();
209
+                        if (stime != null)
210
+                            dModel.F_StartDate = DateTime.Parse(stime);
211
+                        if (etime != null)
212
+                            dModel.F_EndDate = DateTime.Parse(etime);
213
+
214
+                        dModel.F_ModifyDate = DateTime.Now;
215
+                        dModel.F_ModifyBy = int.Parse(User.UserData["F_UserID"]);
216
+
217
+                        bool b = dBLL.Update(dModel);
218
+                        if (b)
219
+                        {
220
+                            res = Success("编辑成功");
221
+                        }
222
+                        else
223
+                        {
224
+                            res = Success("编辑失败");
225
+                        }
226
+                    }
227
+                    else
228
+                        res = Error("获取信息失败");
229
+                }
230
+                else
231
+                {
232
+                    res = Error("请选择要编辑的知识库分类");
233
+                }
234
+
235
+            }
236
+            return res;
237
+        }
238
+        [Authority]
239
+        //删除公告
240
+        public ActionResult DelNotice(string[] ids)
241
+        {
242
+            ActionResult res = NoToken("未知错误,请重新登录");
243
+
244
+            if (ids != null && ids.Length > 0)
245
+            {
246
+                string idds = "";
247
+                for (int i = 0; i < ids.Length; i++)
248
+                {
249
+                    idds += ids[i] + ",";
250
+                }
251
+                bool r = dBLL.DeleteList(idds.Trim(','));
252
+
253
+                if (r)
254
+                    res = Success("删除成功");
255
+                else
256
+                {
257
+                    res = Error("删除失败");
258
+                }
259
+            }
260
+            else
261
+            {
262
+                res = Error("获取参数失败");
263
+            }
264
+
265
+            return res;
266
+        }
267
+    }
268
+}

+ 1 - 0
codegit/CallCenterApi/CallCenterApi.Model/CallCenterApi.Model.csproj

@@ -74,6 +74,7 @@
74 74
     <Compile Include="T_Cus_CustomerBase.cs" />
75 75
     <Compile Include="T_Cus_CustomerExpand.cs" />
76 76
     <Compile Include="T_Msg_List.cs" />
77
+    <Compile Include="T_Msg_NoticeInfo.cs" />
77 78
     <Compile Include="T_QC_IndexBase.cs" />
78 79
     <Compile Include="T_QC_IndexCategory.cs" />
79 80
     <Compile Include="T_QC_IndexRes.cs" />

+ 100 - 0
codegit/CallCenterApi/CallCenterApi.Model/T_Msg_NoticeInfo.cs

@@ -0,0 +1,100 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace CallCenterApi.Model
8
+{
9
+    /// <summary>
10
+    /// 公告信息表
11
+    /// </summary>
12
+    public partial class T_Msg_NoticeInfo
13
+    {
14
+        public T_Msg_NoticeInfo()
15
+        { }
16
+        #region Model
17
+        private int _f_noticeid;
18
+        private string _f_title;
19
+        private string _f_content;
20
+        private DateTime? _f_startdate;
21
+        private DateTime? _f_enddate;
22
+        private DateTime? _f_createon = DateTime.Now;
23
+        private int? _f_createby;
24
+        private int? _f_modifyby;
25
+        private DateTime? _f_modifydate = DateTime.Now;
26
+        /// <summary>
27
+        /// 公告Id
28
+        /// </summary>
29
+        public int F_NoticeId
30
+        {
31
+            set { _f_noticeid = value; }
32
+            get { return _f_noticeid; }
33
+        }
34
+        /// <summary>
35
+        /// 公告标题
36
+        /// </summary>
37
+        public string F_Title
38
+        {
39
+            set { _f_title = value; }
40
+            get { return _f_title; }
41
+        }
42
+        /// <summary>
43
+        /// 公告内容
44
+        /// </summary>
45
+        public string F_Content
46
+        {
47
+            set { _f_content = value; }
48
+            get { return _f_content; }
49
+        }
50
+        /// <summary>
51
+        /// 有效期开始时间
52
+        /// </summary>
53
+        public DateTime? F_StartDate
54
+        {
55
+            set { _f_startdate = value; }
56
+            get { return _f_startdate; }
57
+        }
58
+        /// <summary>
59
+        /// 有效期结束时间
60
+        /// </summary>
61
+        public DateTime? F_EndDate
62
+        {
63
+            set { _f_enddate = value; }
64
+            get { return _f_enddate; }
65
+        }
66
+        /// <summary>
67
+        /// 添加时间
68
+        /// </summary>
69
+        public DateTime? F_CreateOn
70
+        {
71
+            set { _f_createon = value; }
72
+            get { return _f_createon; }
73
+        }
74
+        /// <summary>
75
+        /// 添加人Id
76
+        /// </summary>
77
+        public int? F_CreateBy
78
+        {
79
+            set { _f_createby = value; }
80
+            get { return _f_createby; }
81
+        }
82
+        /// <summary>
83
+        /// 修改人Id
84
+        /// </summary>
85
+        public int? F_ModifyBy
86
+        {
87
+            set { _f_modifyby = value; }
88
+            get { return _f_modifyby; }
89
+        }
90
+        /// <summary>
91
+        /// 修改时间
92
+        /// </summary>
93
+        public DateTime? F_ModifyDate
94
+        {
95
+            set { _f_modifydate = value; }
96
+            get { return _f_modifydate; }
97
+        }
98
+        #endregion Model
99
+    }
100
+}