|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+using CallCenter.Utility;
|
|
|
2
|
+using CallCenterApi.DB;
|
|
|
3
|
+using CallCenterApi.Interface.Controllers.Base;
|
|
|
4
|
+using System;
|
|
|
5
|
+using System.Collections.Generic;
|
|
|
6
|
+using System.Data;
|
|
|
7
|
+using System.Linq;
|
|
|
8
|
+using System.Web;
|
|
|
9
|
+using System.Web.Mvc;
|
|
|
10
|
+
|
|
|
11
|
+namespace CallCenterApi.Interface.Controllers
|
|
|
12
|
+{
|
|
|
13
|
+ public class QuestionManageController : BaseController
|
|
|
14
|
+ {
|
|
|
15
|
+
|
|
|
16
|
+ /// <summary>
|
|
|
17
|
+ ///获取列表
|
|
|
18
|
+ /// </summary>
|
|
|
19
|
+ /// <returns></returns>
|
|
|
20
|
+ public ActionResult GetList()
|
|
|
21
|
+ {
|
|
|
22
|
+ ActionResult res = NoToken("未知错误,请重新登录");
|
|
|
23
|
+ string sql = " F_IsDelete=0 ";
|
|
|
24
|
+ DataTable dt = new DataTable();
|
|
|
25
|
+
|
|
|
26
|
+ string name = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));
|
|
|
27
|
+ string strpageindex = RequestString.GetQueryString("page");
|
|
|
28
|
+ int pageindex = 1;
|
|
|
29
|
+ string strpagesize = RequestString.GetQueryString("pagesize");
|
|
|
30
|
+ int pagesize = 10;
|
|
|
31
|
+ if (name.Trim() != "")
|
|
|
32
|
+ {
|
|
|
33
|
+ sql += " and F_QuestionName like '%" + name + "%'";
|
|
|
34
|
+ }
|
|
|
35
|
+ if (strpageindex.Trim() != "")
|
|
|
36
|
+ {
|
|
|
37
|
+ pageindex = Convert.ToInt32(strpageindex);
|
|
|
38
|
+ }
|
|
|
39
|
+
|
|
|
40
|
+ if (strpagesize.Trim() != "")
|
|
|
41
|
+ {
|
|
|
42
|
+ pagesize = Convert.ToInt32(strpagesize);
|
|
|
43
|
+ }
|
|
|
44
|
+ int recordCount = 0;
|
|
|
45
|
+ dt = BLL.PagerBLL.GetListPager(
|
|
|
46
|
+ "T_Wo_QuestionManage",
|
|
|
47
|
+ "F_Id",
|
|
|
48
|
+ "*",
|
|
|
49
|
+ sql,
|
|
|
50
|
+ "ORDER BY F_Id desc",
|
|
|
51
|
+ pagesize,
|
|
|
52
|
+ pageindex,
|
|
|
53
|
+ true,
|
|
|
54
|
+ out recordCount);
|
|
|
55
|
+
|
|
|
56
|
+ var obj = new
|
|
|
57
|
+ {
|
|
|
58
|
+ state = "success",
|
|
|
59
|
+ message = "成功",
|
|
|
60
|
+ rows = dt,
|
|
|
61
|
+ total = recordCount
|
|
|
62
|
+ };
|
|
|
63
|
+
|
|
|
64
|
+ res = Content(obj.ToJson());
|
|
|
65
|
+
|
|
|
66
|
+ return res;
|
|
|
67
|
+ }
|
|
|
68
|
+
|
|
|
69
|
+ /// <summary>
|
|
|
70
|
+ /// 添加/修改问题
|
|
|
71
|
+ /// </summary>
|
|
|
72
|
+ /// <returns></returns>
|
|
|
73
|
+ public ActionResult AddQuestion()
|
|
|
74
|
+ {
|
|
|
75
|
+ ActionResult res = NoToken("未知错误,请重新登录");
|
|
|
76
|
+ if (Request.IsAuthenticated)
|
|
|
77
|
+ {
|
|
|
78
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
79
|
+ if (userId != 0)
|
|
|
80
|
+ {
|
|
|
81
|
+ Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
|
|
|
82
|
+ if (ua != null)
|
|
|
83
|
+ {
|
|
|
84
|
+ int id = RequestString.GetInt("id", 0);
|
|
|
85
|
+ string content = RequestString.GetFormString("content");
|
|
|
86
|
+ string type = RequestString.GetFormString("type");
|
|
|
87
|
+ int pid = RequestString.GetInt("pid", 0);
|
|
|
88
|
+ int layer = RequestString.GetInt("layer", 0);
|
|
|
89
|
+ string deal = RequestString.GetFormString("deal");
|
|
|
90
|
+ string remark = RequestString.GetFormString("remark");
|
|
|
91
|
+ string usercode = RequestString.GetFormString("usercode");
|
|
|
92
|
+ string cont = RequestString.GetFormString("cont");
|
|
|
93
|
+
|
|
|
94
|
+ Model.T_Wo_QuestionManage model = new Model.T_Wo_QuestionManage();
|
|
|
95
|
+
|
|
|
96
|
+ if (id == 0)
|
|
|
97
|
+ {
|
|
|
98
|
+ model.F_QuestionName = cont;
|
|
|
99
|
+ model.F_QuestionContent = content;
|
|
|
100
|
+ model.F_ParentId = pid;
|
|
|
101
|
+ model.F_Label = layer.ToString();
|
|
|
102
|
+ model.F_DealMethods = deal;
|
|
|
103
|
+ model.F_Type = type;
|
|
|
104
|
+ model.F_Remark = remark;
|
|
|
105
|
+ model.F_CreateBy = ua.F_UserCode;
|
|
|
106
|
+ model.F_CreateOn = DateTime.Now;
|
|
|
107
|
+ model.F_IsDelete = 0;
|
|
|
108
|
+
|
|
|
109
|
+ if (new BLL.T_Wo_QuestionManage().Add(model) > 0)
|
|
|
110
|
+ {
|
|
|
111
|
+ res = Success("新增成功!");
|
|
|
112
|
+ }
|
|
|
113
|
+ else
|
|
|
114
|
+ {
|
|
|
115
|
+ res = Error("新增失败!");
|
|
|
116
|
+ }
|
|
|
117
|
+ }
|
|
|
118
|
+ else
|
|
|
119
|
+ {
|
|
|
120
|
+ model = new BLL.T_Wo_QuestionManage().GetModel(id);
|
|
|
121
|
+ if (model != null)
|
|
|
122
|
+ {
|
|
|
123
|
+ model.F_QuestionName = cont;
|
|
|
124
|
+ model.F_QuestionContent = content;
|
|
|
125
|
+ model.F_ParentId = pid;
|
|
|
126
|
+ model.F_Label = layer.ToString();
|
|
|
127
|
+ model.F_DealMethods = deal;
|
|
|
128
|
+ model.F_Type = type;
|
|
|
129
|
+ model.F_Remark = remark;
|
|
|
130
|
+ model.F_UpdateBy = ua.F_UserCode;
|
|
|
131
|
+ model.F_UpdateOn = DateTime.Now;
|
|
|
132
|
+ model.F_UpdateCount = model.F_UpdateCount ?? 0 + 1;
|
|
|
133
|
+ if (new BLL.T_Wo_QuestionManage().Update(model))
|
|
|
134
|
+ {
|
|
|
135
|
+ res = Success("修改成功!");
|
|
|
136
|
+ }
|
|
|
137
|
+ else
|
|
|
138
|
+ {
|
|
|
139
|
+ res = Error("修改失败!");
|
|
|
140
|
+ }
|
|
|
141
|
+ }
|
|
|
142
|
+ else
|
|
|
143
|
+ {
|
|
|
144
|
+ res = Error("修改失败!");
|
|
|
145
|
+ }
|
|
|
146
|
+ }
|
|
|
147
|
+ }
|
|
|
148
|
+ }
|
|
|
149
|
+
|
|
|
150
|
+ }
|
|
|
151
|
+ return res;
|
|
|
152
|
+ }
|
|
|
153
|
+
|
|
|
154
|
+
|
|
|
155
|
+ /// <summary>
|
|
|
156
|
+ /// 删除问题
|
|
|
157
|
+ /// </summary>
|
|
|
158
|
+ /// <param name="ids"></param>
|
|
|
159
|
+ /// <returns></returns>
|
|
|
160
|
+ public ActionResult Delete(string[] ids)
|
|
|
161
|
+ {
|
|
|
162
|
+ ActionResult res = NoToken("未知错误,请重新登录");
|
|
|
163
|
+ if (Request.IsAuthenticated)
|
|
|
164
|
+ {
|
|
|
165
|
+
|
|
|
166
|
+ int userId = CurrentUser.UserData.F_UserId;
|
|
|
167
|
+ if (userId != 0)
|
|
|
168
|
+ {
|
|
|
169
|
+ Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
|
|
|
170
|
+ if (ua != null)
|
|
|
171
|
+ {
|
|
|
172
|
+ if (ids != null && ids.Length > 0)
|
|
|
173
|
+ {
|
|
|
174
|
+ string idd = " ";
|
|
|
175
|
+ foreach (string str in ids)
|
|
|
176
|
+ {
|
|
|
177
|
+ idd += str + ",";
|
|
|
178
|
+ }
|
|
|
179
|
+ string sql = "update T_Wo_QuestionManage set F_IsDelete=1,F_DeleteBy='" + ua.F_UserCode + "',F_DeleteOn=getdate() where F_Id in(" + idd.TrimEnd(',') + ")";
|
|
|
180
|
+ if (!string.IsNullOrEmpty(idd.Trim()))
|
|
|
181
|
+ {
|
|
|
182
|
+ if (DbHelperSQL.ExecuteSql(sql) > 0)
|
|
|
183
|
+ {
|
|
|
184
|
+ res = Success("删除成功");
|
|
|
185
|
+ }
|
|
|
186
|
+ else
|
|
|
187
|
+ {
|
|
|
188
|
+ res = Error("删除失败");
|
|
|
189
|
+ }
|
|
|
190
|
+ }
|
|
|
191
|
+ else
|
|
|
192
|
+ {
|
|
|
193
|
+ res = Error("请选择记录");
|
|
|
194
|
+ }
|
|
|
195
|
+ }
|
|
|
196
|
+ else
|
|
|
197
|
+ {
|
|
|
198
|
+ res = Error("获取参数失败");
|
|
|
199
|
+ }
|
|
|
200
|
+ }
|
|
|
201
|
+ }
|
|
|
202
|
+ }
|
|
|
203
|
+ return res;
|
|
|
204
|
+ }
|
|
|
205
|
+
|
|
|
206
|
+
|
|
|
207
|
+ }
|
|
|
208
|
+
|
|
|
209
|
+}
|