|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+using Newtonsoft.Json;
|
|
|
2
|
+using System;
|
|
|
3
|
+using System.Collections.Generic;
|
|
|
4
|
+using System.Data;
|
|
|
5
|
+using System.IO;
|
|
|
6
|
+using System.Linq;
|
|
|
7
|
+using System.Web;
|
|
|
8
|
+using System.Web.Mvc;
|
|
|
9
|
+using YTSoft.BaseCallCenter.Model;
|
|
|
10
|
+using YTSoft.BaseCallCenter.MVCWeb.Models;
|
|
|
11
|
+
|
|
|
12
|
+/// <summary>
|
|
|
13
|
+/// 话务-值班号码
|
|
|
14
|
+/// </summary>
|
|
|
15
|
+namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
|
|
|
16
|
+{
|
|
|
17
|
+ public class MobileDataController : BaseController
|
|
|
18
|
+ {
|
|
|
19
|
+ BLL.T_Sys_MobileData busdutyNumber = new BLL.T_Sys_MobileData();
|
|
|
20
|
+
|
|
|
21
|
+ /// <summary>
|
|
|
22
|
+ /// 电话列表
|
|
|
23
|
+ /// </summary>
|
|
|
24
|
+ /// <returns></returns>
|
|
|
25
|
+ public ActionResult GetList()
|
|
|
26
|
+ {
|
|
|
27
|
+ return View();
|
|
|
28
|
+ }
|
|
|
29
|
+
|
|
|
30
|
+ /// <summary>
|
|
|
31
|
+ /// 添加 视图
|
|
|
32
|
+ /// </summary>
|
|
|
33
|
+ /// <returns></returns>
|
|
|
34
|
+ public ActionResult Add()
|
|
|
35
|
+ {
|
|
|
36
|
+ return View();
|
|
|
37
|
+ }
|
|
|
38
|
+
|
|
|
39
|
+
|
|
|
40
|
+ [ActionName("GetListData")]
|
|
|
41
|
+ public string GetListData(string phone="")
|
|
|
42
|
+ {
|
|
|
43
|
+ DataTable dt = null;
|
|
|
44
|
+ int count = 0;
|
|
|
45
|
+ if (string.IsNullOrEmpty(phone))
|
|
|
46
|
+ {
|
|
|
47
|
+ return Success("成功", dt, count);
|
|
|
48
|
+ }
|
|
|
49
|
+ AddAction("T_Sys_MobileData", "page", "查询列表", string.Format(" 获取前50条 phone={0}", phone));
|
|
|
50
|
+ string strWhere = " 1=1 ";
|
|
|
51
|
+ if (!string.IsNullOrEmpty(phone))
|
|
|
52
|
+ {
|
|
|
53
|
+ strWhere += string.Format(" and F_MobileNum like '%{0}%'", phone);
|
|
|
54
|
+ }
|
|
|
55
|
+
|
|
|
56
|
+ dt = busdutyNumber.GetList(50,strWhere, " F_MobileNum ASC").Tables[0];
|
|
|
57
|
+ if (dt != null && dt.Rows.Count > 0)
|
|
|
58
|
+ {
|
|
|
59
|
+ count = dt.Rows.Count;
|
|
|
60
|
+ }
|
|
|
61
|
+ return Success("成功", dt, count);
|
|
|
62
|
+ }
|
|
|
63
|
+
|
|
|
64
|
+ [ActionName("GetData")]
|
|
|
65
|
+ public string GettData(string id = "")
|
|
|
66
|
+ {
|
|
|
67
|
+ if(id.Length!=7)
|
|
|
68
|
+ return Error("请输入ID");
|
|
|
69
|
+
|
|
|
70
|
+ Model.T_Sys_MobileData model = busdutyNumber.GetModel(id);
|
|
|
71
|
+ return Success("成功", model, 1);
|
|
|
72
|
+ }
|
|
|
73
|
+
|
|
|
74
|
+ [ActionName("adddata")]
|
|
|
75
|
+ public string AddData(string phone = "", string ZipCode = "",string CityDes="未知",string CardDes="未知")
|
|
|
76
|
+ {
|
|
|
77
|
+ string strWhere = " 1=1 ";
|
|
|
78
|
+ if (string.IsNullOrEmpty(phone))
|
|
|
79
|
+ {
|
|
|
80
|
+ return Error("请输入号码前七位");
|
|
|
81
|
+ }
|
|
|
82
|
+ else if (string.IsNullOrEmpty(ZipCode))
|
|
|
83
|
+ {
|
|
|
84
|
+ return Error("请输入城市固话区号");
|
|
|
85
|
+ }
|
|
|
86
|
+ else if (phone.Length != 7)
|
|
|
87
|
+ {
|
|
|
88
|
+ return Error("请输入号码前七位");
|
|
|
89
|
+ }
|
|
|
90
|
+ else
|
|
|
91
|
+ {
|
|
|
92
|
+ strWhere += string.Format(" and F_MobileNum='{0}'", phone);
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ int count = busdutyNumber.GetRecordCount(strWhere);
|
|
|
96
|
+ if (count > 0)
|
|
|
97
|
+ {
|
|
|
98
|
+ return Error("号码已存在");
|
|
|
99
|
+ }
|
|
|
100
|
+
|
|
|
101
|
+ Model.T_Sys_MobileData model = new T_Sys_MobileData();
|
|
|
102
|
+ model.F_MobileNum = phone;
|
|
|
103
|
+ model.F_ZipCode = ZipCode;
|
|
|
104
|
+ model.F_CityDes = CityDes;
|
|
|
105
|
+ model.F_CardDes = CardDes;
|
|
|
106
|
+
|
|
|
107
|
+ if (busdutyNumber.Add(model))
|
|
|
108
|
+ {
|
|
|
109
|
+ AddAction("T_Sys_MobileData", phone, "新增电话库", phone);
|
|
|
110
|
+ return Success("成功", model);
|
|
|
111
|
+ }
|
|
|
112
|
+ else
|
|
|
113
|
+ return Error("失败");
|
|
|
114
|
+ }
|
|
|
115
|
+
|
|
|
116
|
+ [ActionName("deletedata")]
|
|
|
117
|
+ public string DeleteData( string phone)
|
|
|
118
|
+ {
|
|
|
119
|
+ if (string.IsNullOrEmpty(phone))
|
|
|
120
|
+ {
|
|
|
121
|
+ return Error("请输入ID");
|
|
|
122
|
+ }
|
|
|
123
|
+ Model.T_Sys_MobileData model = busdutyNumber.GetModel(phone);
|
|
|
124
|
+ if (busdutyNumber.Delete(phone))
|
|
|
125
|
+ {
|
|
|
126
|
+ AddAction("T_Sys_MobileData", phone.ToMyString(), "删除电话库",JsonConvert.SerializeObject(model),"敏感信息");
|
|
|
127
|
+ AddAction("T_Sys_MobileData", phone.ToMyString(), "删除电话库");
|
|
|
128
|
+ return Success("删除成功");
|
|
|
129
|
+ }
|
|
|
130
|
+ else
|
|
|
131
|
+ return Error("失败");
|
|
|
132
|
+ }
|
|
|
133
|
+ }
|
|
|
134
|
+}
|