zhoufan преди 8 години
родител
ревизия
99d3ffff79

+ 32 - 21
CallCenterApi/CallCenterApi.BLL/T_Sys_MobileData.cs

@@ -1,10 +1,7 @@
1 1
 using System;
2
-using System.Collections.Generic;
3 2
 using System.Data;
4
-using System.Linq;
5
-using System.Text;
6
-using System.Threading.Tasks;
7
-
3
+using System.Collections.Generic;
4
+using CallCenterApi.Model;
8 5
 namespace CallCenterApi.BLL
9 6
 {
10 7
     /// <summary>
@@ -12,22 +9,22 @@ namespace CallCenterApi.BLL
12 9
     /// </summary>
13 10
     public partial class T_Sys_MobileData
14 11
     {
15
-        private readonly DAL.T_Sys_MobileData dal = new DAL.T_Sys_MobileData();
12
+        private readonly CallCenterApi.DAL.T_Sys_MobileData dal = new CallCenterApi.DAL.T_Sys_MobileData();
16 13
         public T_Sys_MobileData()
17 14
         { }
18 15
         #region  BasicMethod
19 16
         /// <summary>
20 17
         /// 是否存在该记录
21 18
         /// </summary>
22
-        public bool Exists(string F_MobileNum)
19
+        public bool Exists(int F_Id)
23 20
         {
24
-            return dal.Exists(F_MobileNum);
21
+            return dal.Exists(F_Id);
25 22
         }
26 23
 
27 24
         /// <summary>
28 25
         /// 增加一条数据
29 26
         /// </summary>
30
-        public bool Add(Model.T_Sys_MobileData model)
27
+        public int Add(CallCenterApi.Model.T_Sys_MobileData model)
31 28
         {
32 29
             return dal.Add(model);
33 30
         }
@@ -35,7 +32,7 @@ namespace CallCenterApi.BLL
35 32
         /// <summary>
36 33
         /// 更新一条数据
37 34
         /// </summary>
38
-        public bool Update(Model.T_Sys_MobileData model)
35
+        public bool Update(CallCenterApi.Model.T_Sys_MobileData model)
39 36
         {
40 37
             return dal.Update(model);
41 38
         }
@@ -43,26 +40,33 @@ namespace CallCenterApi.BLL
43 40
         /// <summary>
44 41
         /// 删除一条数据
45 42
         /// </summary>
46
-        public bool Delete(string F_MobileNum)
43
+        public bool Delete(int F_Id)
47 44
         {
48 45
 
49
-            return dal.Delete(F_MobileNum);
46
+            return dal.Delete(F_Id);
50 47
         }
51 48
         /// <summary>
52 49
         /// 删除一条数据
53 50
         /// </summary>
54
-        public bool DeleteList(string F_MobileNumlist)
51
+        public bool DeleteList(string F_Idlist)
55 52
         {
56
-            return dal.DeleteList(F_MobileNumlist);
53
+            return dal.DeleteList(F_Idlist);
54
+        }
55
+        /// <summary>
56
+        /// 删除一条数据
57
+        /// </summary>
58
+        public bool DeleteList(string F_Idlist, string usercode)
59
+        {
60
+            return dal.DeleteList(F_Idlist, usercode);
57 61
         }
58 62
 
59 63
         /// <summary>
60 64
         /// 得到一个对象实体
61 65
         /// </summary>
62
-        public Model.T_Sys_MobileData GetModel(string F_MobileNum)
66
+        public CallCenterApi.Model.T_Sys_MobileData GetModel(int F_Id)
63 67
         {
64 68
 
65
-            return dal.GetModel(F_MobileNum);
69
+            return dal.GetModel(F_Id);
66 70
         }
67 71
 
68 72
         /// <summary>
@@ -82,7 +86,7 @@ namespace CallCenterApi.BLL
82 86
         /// <summary>
83 87
         /// 获得数据列表
84 88
         /// </summary>
85
-        public List<Model.T_Sys_MobileData> GetModelList(string strWhere)
89
+        public List<CallCenterApi.Model.T_Sys_MobileData> GetModelList(string strWhere)
86 90
         {
87 91
             DataSet ds = dal.GetList(strWhere);
88 92
             return DataTableToList(ds.Tables[0]);
@@ -90,13 +94,13 @@ namespace CallCenterApi.BLL
90 94
         /// <summary>
91 95
         /// 获得数据列表
92 96
         /// </summary>
93
-        public List<Model.T_Sys_MobileData> DataTableToList(DataTable dt)
97
+        public List<CallCenterApi.Model.T_Sys_MobileData> DataTableToList(DataTable dt)
94 98
         {
95
-            List<Model.T_Sys_MobileData> modelList = new List<Model.T_Sys_MobileData>();
99
+            List<CallCenterApi.Model.T_Sys_MobileData> modelList = new List<CallCenterApi.Model.T_Sys_MobileData>();
96 100
             int rowsCount = dt.Rows.Count;
97 101
             if (rowsCount > 0)
98 102
             {
99
-                Model.T_Sys_MobileData model;
103
+                CallCenterApi.Model.T_Sys_MobileData model;
100 104
                 for (int n = 0; n < rowsCount; n++)
101 105
                 {
102 106
                     model = dal.DataRowToModel(dt.Rows[n]);
@@ -131,7 +135,13 @@ namespace CallCenterApi.BLL
131 135
         {
132 136
             return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
133 137
         }
134
-
138
+        /// <summary>
139
+        /// 分页获取数据列表
140
+        /// </summary>
141
+        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
142
+        //{
143
+        //return dal.GetList(PageSize,PageIndex,strWhere);
144
+        //}
135 145
 
136 146
         #endregion  BasicMethod
137 147
         #region  ExtensionMethod
@@ -139,3 +149,4 @@ namespace CallCenterApi.BLL
139 149
         #endregion  ExtensionMethod
140 150
     }
141 151
 }
152
+

+ 0 - 162
CallCenterApi/CallCenterApi.BLL/T_Sys_ModuleFunctions.cs

@@ -1,162 +0,0 @@
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
-    /// T_Sys_ModuleFunctions
12
-    /// </summary>
13
-    public partial class T_Sys_ModuleFunctions
14
-    {
15
-        private readonly DAL.T_Sys_ModuleFunctions dal = new DAL.T_Sys_ModuleFunctions();
16
-        public T_Sys_ModuleFunctions()
17
-        { }
18
-        #region  BasicMethod
19
-        /// <summary>
20
-        /// 是否存在该记录
21
-        /// </summary>
22
-        public bool Exists(int F_FunctionId)
23
-        {
24
-            return dal.Exists(F_FunctionId);
25
-        }
26
-
27
-        /// <summary>
28
-        /// 增加一条数据
29
-        /// </summary>
30
-        public int Add(Model.T_Sys_ModuleFunctions model)
31
-        {
32
-            return dal.Add(model);
33
-        }
34
-
35
-        /// <summary>
36
-        /// 更新一条数据
37
-        /// </summary>
38
-        public bool Update(Model.T_Sys_ModuleFunctions model)
39
-        {
40
-            return dal.Update(model);
41
-        }
42
-
43
-        /// <summary>
44
-        /// 删除一条数据
45
-        /// </summary>
46
-        public bool Delete(int F_FunctionId)
47
-        {
48
-
49
-            return dal.Delete(F_FunctionId);
50
-        }
51
-        /// <summary>
52
-        /// 删除一条数据
53
-        /// </summary>
54
-        public bool DeleteList(string F_FunctionIdlist)
55
-        {
56
-            return dal.DeleteList(F_FunctionIdlist);
57
-        }
58
-
59
-        /// <summary>
60
-        /// 得到一个对象实体
61
-        /// </summary>
62
-        public Model.T_Sys_ModuleFunctions GetModel(int F_FunctionId)
63
-        {
64
-
65
-            return dal.GetModel(F_FunctionId);
66
-        }
67
-        /// <summary>
68
-        /// 得到一个对象实体
69
-        /// </summary>
70
-        public Model.T_Sys_ModuleFunctions GetModel(string controller, string action)
71
-        {
72
-
73
-            return dal.GetModel(controller, action);
74
-        }
75
-        /// <summary>
76
-        /// 得到一个对象实体
77
-        /// </summary>
78
-        public Model.T_Sys_ModuleFunctions GetModel(string url)
79
-        {
80
-
81
-            return dal.GetModel(url);
82
-        }
83
-        /// <summary>
84
-        /// 获得数据列表
85
-        /// </summary>
86
-        public DataSet GetList(string strWhere)
87
-        {
88
-            return dal.GetList(strWhere);
89
-        }
90
-        /// <summary>
91
-        /// 获得前几行数据
92
-        /// </summary>
93
-        public DataSet GetList(int Top, string strWhere, string filedOrder)
94
-        {
95
-            return dal.GetList(Top, strWhere, filedOrder);
96
-        }
97
-        /// <summary>
98
-        /// 获得数据列表
99
-        /// </summary>
100
-        public List<Model.T_Sys_ModuleFunctions> GetModelList(string strWhere)
101
-        {
102
-            DataSet ds = dal.GetList(strWhere);
103
-            return DataTableToList(ds.Tables[0]);
104
-        }
105
-        /// <summary>
106
-        /// 获得数据列表
107
-        /// </summary>
108
-        public List<Model.T_Sys_ModuleFunctions> DataTableToList(DataTable dt)
109
-        {
110
-            List<Model.T_Sys_ModuleFunctions> modelList = new List<Model.T_Sys_ModuleFunctions>();
111
-            int rowsCount = dt.Rows.Count;
112
-            if (rowsCount > 0)
113
-            {
114
-                Model.T_Sys_ModuleFunctions model;
115
-                for (int n = 0; n < rowsCount; n++)
116
-                {
117
-                    model = dal.DataRowToModel(dt.Rows[n]);
118
-                    if (model != null)
119
-                    {
120
-                        modelList.Add(model);
121
-                    }
122
-                }
123
-            }
124
-            return modelList;
125
-        }
126
-
127
-        /// <summary>
128
-        /// 获得数据列表
129
-        /// </summary>
130
-        public DataSet GetAllList()
131
-        {
132
-            return GetList("");
133
-        }
134
-
135
-        /// <summary>
136
-        /// 分页获取数据列表
137
-        /// </summary>
138
-        public int GetRecordCount(string strWhere)
139
-        {
140
-            return dal.GetRecordCount(strWhere);
141
-        }
142
-        /// <summary>
143
-        /// 分页获取数据列表
144
-        /// </summary>
145
-        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
146
-        {
147
-            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
148
-        }
149
-        /// <summary>
150
-        /// 分页获取数据列表
151
-        /// </summary>
152
-        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
153
-        //{
154
-        //return dal.GetList(PageSize,PageIndex,strWhere);
155
-        //}
156
-
157
-        #endregion  BasicMethod
158
-        #region  ExtensionMethod
159
-
160
-        #endregion  ExtensionMethod
161
-    }
162
-}

+ 139 - 45
CallCenterApi/CallCenterApi.DAL/T_Sys_MobileData.cs

@@ -1,11 +1,8 @@
1
-using CallCenterApi.DB;
2
-using System;
3
-using System.Collections.Generic;
1
+using System;
4 2
 using System.Data;
5
-using System.Data.SqlClient;
6
-using System.Linq;
7 3
 using System.Text;
8
-using System.Threading.Tasks;
4
+using System.Data.SqlClient;
5
+using CallCenterApi.DB;
9 6
 
10 7
 namespace CallCenterApi.DAL
11 8
 {
@@ -17,18 +14,18 @@ namespace CallCenterApi.DAL
17 14
         public T_Sys_MobileData()
18 15
         { }
19 16
         #region  BasicMethod
20
-
21 17
         /// <summary>
22 18
         /// 是否存在该记录
23 19
         /// </summary>
24
-        public bool Exists(string F_MobileNum)
20
+        public bool Exists(int F_Id)
25 21
         {
26 22
             StringBuilder strSql = new StringBuilder();
27 23
             strSql.Append("select count(1) from T_Sys_MobileData");
28
-            strSql.Append(" where F_MobileNum=@F_MobileNum ");
24
+            strSql.Append(" where F_Id=@F_Id");
29 25
             SqlParameter[] parameters = {
30
-                    new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20)          };
31
-            parameters[0].Value = F_MobileNum;
26
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
27
+            };
28
+            parameters[0].Value = F_Id;
32 29
 
33 30
             return DbHelperSQL.Exists(strSql.ToString(), parameters);
34 31
         }
@@ -37,53 +34,82 @@ namespace CallCenterApi.DAL
37 34
         /// <summary>
38 35
         /// 增加一条数据
39 36
         /// </summary>
40
-        public bool Add(Model.T_Sys_MobileData model)
37
+        public int Add(CallCenterApi.Model.T_Sys_MobileData model)
41 38
         {
42 39
             StringBuilder strSql = new StringBuilder();
43 40
             strSql.Append("insert into T_Sys_MobileData(");
44
-            strSql.Append("F_MobileNum,F_ZipCode,F_CityDes,F_CardDes)");
41
+            strSql.Append("F_MobileNum,F_ZipCode,F_CityDes,F_CardDes,F_CreateUser,F_CreateTime,F_IsDelete,F_DeleteUser,F_DeleteTime)");
45 42
             strSql.Append(" values (");
46
-            strSql.Append("@F_MobileNum,@F_ZipCode,@F_CityDes,@F_CardDes)");
43
+            strSql.Append("@F_MobileNum,@F_ZipCode,@F_CityDes,@F_CardDes,@F_CreateUser,@F_CreateTime,@F_IsDelete,@F_DeleteUser,@F_DeleteTime)");
44
+            strSql.Append(";select @@IDENTITY");
47 45
             SqlParameter[] parameters = {
48 46
                     new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20),
49 47
                     new SqlParameter("@F_ZipCode", SqlDbType.VarChar,10),
50 48
                     new SqlParameter("@F_CityDes", SqlDbType.VarChar,50),
51
-                    new SqlParameter("@F_CardDes", SqlDbType.VarChar,50)};
49
+                    new SqlParameter("@F_CardDes", SqlDbType.VarChar,50),
50
+                    new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
51
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
52
+                    new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
53
+                    new SqlParameter("@F_DeleteUser", SqlDbType.VarChar,50),
54
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime)};
52 55
             parameters[0].Value = model.F_MobileNum;
53 56
             parameters[1].Value = model.F_ZipCode;
54 57
             parameters[2].Value = model.F_CityDes;
55 58
             parameters[3].Value = model.F_CardDes;
59
+            parameters[4].Value = model.F_CreateUser;
60
+            parameters[5].Value = model.F_CreateTime;
61
+            parameters[6].Value = model.F_IsDelete;
62
+            parameters[7].Value = model.F_DeleteUser;
63
+            parameters[8].Value = model.F_DeleteTime;
56 64
 
57
-            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
58
-            if (rows > 0)
65
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
66
+            if (obj == null)
59 67
             {
60
-                return true;
68
+                return 0;
61 69
             }
62 70
             else
63 71
             {
64
-                return false;
72
+                return Convert.ToInt32(obj);
65 73
             }
66 74
         }
67 75
         /// <summary>
68 76
         /// 更新一条数据
69 77
         /// </summary>
70
-        public bool Update(Model.T_Sys_MobileData model)
78
+        public bool Update(CallCenterApi.Model.T_Sys_MobileData model)
71 79
         {
72 80
             StringBuilder strSql = new StringBuilder();
73 81
             strSql.Append("update T_Sys_MobileData set ");
82
+            strSql.Append("F_MobileNum=@F_MobileNum,");
74 83
             strSql.Append("F_ZipCode=@F_ZipCode,");
75 84
             strSql.Append("F_CityDes=@F_CityDes,");
76
-            strSql.Append("F_CardDes=@F_CardDes");
77
-            strSql.Append(" where F_MobileNum=@F_MobileNum ");
85
+            strSql.Append("F_CardDes=@F_CardDes,");
86
+            strSql.Append("F_CreateUser=@F_CreateUser,");
87
+            strSql.Append("F_CreateTime=@F_CreateTime,");
88
+            strSql.Append("F_IsDelete=@F_IsDelete,");
89
+            strSql.Append("F_DeleteUser=@F_DeleteUser,");
90
+            strSql.Append("F_DeleteTime=@F_DeleteTime");
91
+            strSql.Append(" where F_Id=@F_Id");
78 92
             SqlParameter[] parameters = {
93
+                    new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20),
79 94
                     new SqlParameter("@F_ZipCode", SqlDbType.VarChar,10),
80 95
                     new SqlParameter("@F_CityDes", SqlDbType.VarChar,50),
81 96
                     new SqlParameter("@F_CardDes", SqlDbType.VarChar,50),
82
-                    new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20)};
83
-            parameters[0].Value = model.F_ZipCode;
84
-            parameters[1].Value = model.F_CityDes;
85
-            parameters[2].Value = model.F_CardDes;
86
-            parameters[3].Value = model.F_MobileNum;
97
+                    new SqlParameter("@F_CreateUser", SqlDbType.VarChar,50),
98
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
99
+                    new SqlParameter("@F_IsDelete", SqlDbType.Int,4),
100
+                    new SqlParameter("@F_DeleteUser", SqlDbType.VarChar,50),
101
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime),
102
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)};
103
+            parameters[0].Value = model.F_MobileNum;
104
+            parameters[1].Value = model.F_ZipCode;
105
+            parameters[2].Value = model.F_CityDes;
106
+            parameters[3].Value = model.F_CardDes;
107
+            parameters[4].Value = model.F_CreateUser;
108
+            parameters[5].Value = model.F_CreateTime;
109
+            parameters[6].Value = model.F_IsDelete;
110
+            parameters[7].Value = model.F_DeleteUser;
111
+            parameters[8].Value = model.F_DeleteTime;
112
+            parameters[9].Value = model.F_Id;
87 113
 
88 114
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
89 115
             if (rows > 0)
@@ -99,15 +125,16 @@ namespace CallCenterApi.DAL
99 125
         /// <summary>
100 126
         /// 删除一条数据
101 127
         /// </summary>
102
-        public bool Delete(string F_MobileNum)
128
+        public bool Delete(int F_Id)
103 129
         {
104 130
 
105 131
             StringBuilder strSql = new StringBuilder();
106 132
             strSql.Append("delete from T_Sys_MobileData ");
107
-            strSql.Append(" where F_MobileNum=@F_MobileNum ");
133
+            strSql.Append(" where F_Id=@F_Id");
108 134
             SqlParameter[] parameters = {
109
-                    new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20)          };
110
-            parameters[0].Value = F_MobileNum;
135
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
136
+            };
137
+            parameters[0].Value = F_Id;
111 138
 
112 139
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
113 140
             if (rows > 0)
@@ -122,11 +149,11 @@ namespace CallCenterApi.DAL
122 149
         /// <summary>
123 150
         /// 批量删除数据
124 151
         /// </summary>
125
-        public bool DeleteList(string F_MobileNumlist)
152
+        public bool DeleteList(string F_Idlist)
126 153
         {
127 154
             StringBuilder strSql = new StringBuilder();
128 155
             strSql.Append("delete from T_Sys_MobileData ");
129
-            strSql.Append(" where F_MobileNum in (" + F_MobileNumlist + ")  ");
156
+            strSql.Append(" where F_Id in (" + F_Idlist + ")  ");
130 157
             int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
131 158
             if (rows > 0)
132 159
             {
@@ -138,21 +165,40 @@ namespace CallCenterApi.DAL
138 165
             }
139 166
         }
140 167
 
168
+        /// <summary>
169
+        /// 批量删除数据
170
+        /// </summary>
171
+        public bool DeleteList(string F_Idlist, string usercode)
172
+        {
173
+            StringBuilder strSql = new StringBuilder();
174
+            strSql.Append("update T_Sys_MobileData set F_IsDelete=1,F_DeleteUser='" + usercode + "',F_DeleteTime=getdate() ");
175
+            strSql.Append(" where F_Id in (" + F_Idlist + ")  ");
176
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
177
+            if (rows > 0)
178
+            {
179
+                return true;
180
+            }
181
+            else
182
+            {
183
+                return false;
184
+            }
185
+        }
141 186
 
142 187
         /// <summary>
143 188
         /// 得到一个对象实体
144 189
         /// </summary>
145
-        public Model.T_Sys_MobileData GetModel(string F_MobileNum)
190
+        public CallCenterApi.Model.T_Sys_MobileData GetModel(int F_Id)
146 191
         {
147 192
 
148 193
             StringBuilder strSql = new StringBuilder();
149
-            strSql.Append("select  top 1 F_MobileNum,F_ZipCode,F_CityDes,F_CardDes from T_Sys_MobileData ");
150
-            strSql.Append(" where F_MobileNum=@F_MobileNum ");
194
+            strSql.Append("select  top 1 F_Id,F_MobileNum,F_ZipCode,F_CityDes,F_CardDes,F_CreateUser,F_CreateTime,F_IsDelete,F_DeleteUser,F_DeleteTime from T_Sys_MobileData ");
195
+            strSql.Append(" where F_Id=@F_Id");
151 196
             SqlParameter[] parameters = {
152
-                    new SqlParameter("@F_MobileNum", SqlDbType.VarChar,20)          };
153
-            parameters[0].Value = F_MobileNum;
197
+                    new SqlParameter("@F_Id", SqlDbType.Int,4)
198
+            };
199
+            parameters[0].Value = F_Id;
154 200
 
155
-            Model.T_Sys_MobileData model = new Model.T_Sys_MobileData();
201
+            CallCenterApi.Model.T_Sys_MobileData model = new CallCenterApi.Model.T_Sys_MobileData();
156 202
             DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
157 203
             if (ds.Tables[0].Rows.Count > 0)
158 204
             {
@@ -168,11 +214,15 @@ namespace CallCenterApi.DAL
168 214
         /// <summary>
169 215
         /// 得到一个对象实体
170 216
         /// </summary>
171
-        public Model.T_Sys_MobileData DataRowToModel(DataRow row)
217
+        public CallCenterApi.Model.T_Sys_MobileData DataRowToModel(DataRow row)
172 218
         {
173
-            Model.T_Sys_MobileData model = new Model.T_Sys_MobileData();
219
+            CallCenterApi.Model.T_Sys_MobileData model = new CallCenterApi.Model.T_Sys_MobileData();
174 220
             if (row != null)
175 221
             {
222
+                if (row["F_Id"] != null && row["F_Id"].ToString() != "")
223
+                {
224
+                    model.F_Id = int.Parse(row["F_Id"].ToString());
225
+                }
176 226
                 if (row["F_MobileNum"] != null)
177 227
                 {
178 228
                     model.F_MobileNum = row["F_MobileNum"].ToString();
@@ -189,6 +239,26 @@ namespace CallCenterApi.DAL
189 239
                 {
190 240
                     model.F_CardDes = row["F_CardDes"].ToString();
191 241
                 }
242
+                if (row["F_CreateUser"] != null)
243
+                {
244
+                    model.F_CreateUser = row["F_CreateUser"].ToString();
245
+                }
246
+                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
247
+                {
248
+                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
249
+                }
250
+                if (row["F_IsDelete"] != null && row["F_IsDelete"].ToString() != "")
251
+                {
252
+                    model.F_IsDelete = int.Parse(row["F_IsDelete"].ToString());
253
+                }
254
+                if (row["F_DeleteUser"] != null)
255
+                {
256
+                    model.F_DeleteUser = row["F_DeleteUser"].ToString();
257
+                }
258
+                if (row["F_DeleteTime"] != null && row["F_DeleteTime"].ToString() != "")
259
+                {
260
+                    model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
261
+                }
192 262
             }
193 263
             return model;
194 264
         }
@@ -199,7 +269,7 @@ namespace CallCenterApi.DAL
199 269
         public DataSet GetList(string strWhere)
200 270
         {
201 271
             StringBuilder strSql = new StringBuilder();
202
-            strSql.Append("select F_MobileNum,F_ZipCode,F_CityDes,F_CardDes ");
272
+            strSql.Append("select F_Id,F_MobileNum,F_ZipCode,F_CityDes,F_CardDes,F_CreateUser,F_CreateTime,F_IsDelete,F_DeleteUser,F_DeleteTime ");
203 273
             strSql.Append(" FROM T_Sys_MobileData ");
204 274
             if (strWhere.Trim() != "")
205 275
             {
@@ -219,7 +289,7 @@ namespace CallCenterApi.DAL
219 289
             {
220 290
                 strSql.Append(" top " + Top.ToString());
221 291
             }
222
-            strSql.Append(" F_MobileNum,F_ZipCode,F_CityDes,F_CardDes ");
292
+            strSql.Append(" F_Id,F_MobileNum,F_ZipCode,F_CityDes,F_CardDes,F_CreateUser,F_CreateTime,F_IsDelete,F_DeleteUser,F_DeleteTime ");
223 293
             strSql.Append(" FROM T_Sys_MobileData ");
224 294
             if (strWhere.Trim() != "")
225 295
             {
@@ -264,7 +334,7 @@ namespace CallCenterApi.DAL
264 334
             }
265 335
             else
266 336
             {
267
-                strSql.Append("order by T.F_MobileNum desc");
337
+                strSql.Append("order by T.F_Id desc");
268 338
             }
269 339
             strSql.Append(")AS Row, T.*  from T_Sys_MobileData T ");
270 340
             if (!string.IsNullOrEmpty(strWhere.Trim()))
@@ -276,7 +346,30 @@ namespace CallCenterApi.DAL
276 346
             return DbHelperSQL.Query(strSql.ToString());
277 347
         }
278 348
 
279
-
349
+        /*
350
+		/// <summary>
351
+		/// 分页获取数据列表
352
+		/// </summary>
353
+		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
354
+		{
355
+			SqlParameter[] parameters = {
356
+					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
357
+					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
358
+					new SqlParameter("@PageSize", SqlDbType.Int),
359
+					new SqlParameter("@PageIndex", SqlDbType.Int),
360
+					new SqlParameter("@IsReCount", SqlDbType.Bit),
361
+					new SqlParameter("@OrderType", SqlDbType.Bit),
362
+					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
363
+					};
364
+			parameters[0].Value = "T_Sys_MobileData";
365
+			parameters[1].Value = "F_Id";
366
+			parameters[2].Value = PageSize;
367
+			parameters[3].Value = PageIndex;
368
+			parameters[4].Value = 0;
369
+			parameters[5].Value = 0;
370
+			parameters[6].Value = strWhere;	
371
+			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
372
+		}*/
280 373
 
281 374
         #endregion  BasicMethod
282 375
         #region  ExtensionMethod
@@ -284,3 +377,4 @@ namespace CallCenterApi.DAL
284 377
         #endregion  ExtensionMethod
285 378
     }
286 379
 }
380
+

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/CallOutOptController.cs

@@ -60,7 +60,7 @@ namespace CallCenterApi.Interface.Controllers
60 60
                 if (phone.Trim().Length == 11 && phone[0] == '1')
61 61
                 {//号码为11位,首位是1,为手机号
62 62
                     BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
63
-                    Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(phone.Substring(0, 7));
63
+                    Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList(" F_MobileNum = '" + phone.Substring(0, 7) + "'").FirstOrDefault();
64 64
                     if (mobileModel != null)
65 65
                     {
66 66
                         if (mobileModel.F_ZipCode.Equals(zipcode))

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/InfoController.cs

@@ -1137,7 +1137,7 @@ namespace CallCenterApi.Interface.Controllers
1137 1137
                 if (end == null) { end = DateTime.Now; }
1138 1138
                 where += $" and datediff(day,F_CreateTime,'{start.Value.ToString("yyyy-MM-dd")}')<=0 and datediff(day,F_CreateTime,'{end.Value.ToString("yyyy-MM-dd")}')>=0 ";
1139 1139
             }
1140
-            string sql = "select * from (select F_ValueId Id,F_Value TypeName,(select COUNT(1) from T_Bus_WorkOrder where F_IsDelete=0 "
1140
+            string sql = "select * from (select F_ValueId Id,F_Value TypeName,(select COUNT(1) from T_Bus_WorkOrder where F_IsDelete=0 "+ where
1141 1141
                        + "and ','+F_Key+',' like '%,'+CONVERT(varchar(100),F_ValueId)+',%') Count "
1142 1142
                        + "from dbo.T_Sys_DictionaryValue where F_ItemId = 3 and F_State = 0) a order by a.Count desc ";
1143 1143
             DataTable dt = DbHelperSQL.Query(sql).Tables[0];

+ 1 - 1
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/CallInScreenController.cs

@@ -169,7 +169,7 @@ namespace CallCenterApi.Interface.Controllers.tel
169 169
             if (tel.Trim().Length == 11 && tel.Substring(0, 1) != "0")
170 170
             {
171 171
                 BLL.T_Sys_MobileData mobile_Bll = new BLL.T_Sys_MobileData();
172
-                Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModel(tel.Substring(0, 7));
172
+                Model.T_Sys_MobileData mobileModel = mobile_Bll.GetModelList(" F_MobileNum = '" + tel.Substring(0, 7) + "'").FirstOrDefault(); 
173 173
 
174 174
                 if (mobileModel != null)
175 175
                 {

+ 170 - 122
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/tel/MobiledataController.cs

@@ -1,4 +1,5 @@
1 1
 using CallCenter.Utility;
2
+using CallCenterApi.Common;
2 3
 using CallCenterApi.Interface.Controllers.Base;
3 4
 using System;
4 5
 using System.Collections.Generic;
@@ -9,172 +10,219 @@ using System.Web.Mvc;
9 10
 
10 11
 namespace CallCenterApi.Interface.Controllers.tel
11 12
 {
12
-    [Authority]
13 13
     public class MobiledataController : BaseController
14 14
     {
15 15
         //获取号码归属地列表
16 16
         public ActionResult GetList(string strtelnum)
17 17
         {
18
-            string sql = "";
19
-            DataTable dt = new DataTable();
20
-
21
-            string strpageindex = RequestString.GetQueryString("page");
22
-            int pageindex = 1;
23
-            string strpagesize = RequestString.GetQueryString("pagesize");
24
-            int pagesize = 10;
25
-
26
-            if (strtelnum != null && strtelnum.Trim() != "")
27
-            {
28
-                sql += " and (F_MobileNum= '" + strtelnum.Trim() + "' or F_ZipCode like '%" + strtelnum.Trim()
29
-                    + "%' or F_CityDes like '%" + strtelnum.Trim() + "%'or F_CardDes like '%" + strtelnum.Trim() + "%')";
30
-            }
31
-
32
-            if (strpageindex.Trim() != "")
33
-            {
34
-                pageindex = Convert.ToInt32(strpageindex);
35
-            }
36
-
37
-            if (strpagesize.Trim() != "")
18
+            ActionResult res = NoToken("未知错误,请重新登录");
19
+            if (Request.IsAuthenticated)
38 20
             {
39
-                pagesize = Convert.ToInt32(strpagesize);
40
-            }
41
-            int recordCount = 0;
42
-            dt = BLL.PagerBLL.GetListPager(
43
-                "T_Sys_MobileData",
44
-                "F_MobileNum",
45
-                "*",
46
-                sql,
47
-                "ORDER BY F_MobileNum desc",
48
-                pagesize,
49
-                pageindex,
50
-                true,
51
-                out recordCount);
52
-
53
-            var obj = new
54
-            {
55
-                state = "success",
56
-                message = "成功",
57
-                rows = dt,
58
-                total = recordCount
59
-            };
21
+                string sql = " and F_IsDelete=0";
22
+                DataTable dt = new DataTable();
60 23
 
61
-            return Content(obj.ToJson());
24
+                string strpageindex = RequestString.GetQueryString("page");
25
+                int pageindex = 1;
26
+                string strpagesize = RequestString.GetQueryString("pagesize");
27
+                int pagesize = 10;
62 28
 
63
-        }
29
+                if (strtelnum != null && strtelnum.Trim() != "")
30
+                {
31
+                    sql += " and (F_MobileNum= '" + strtelnum.Trim() + "' or F_ZipCode like '%" + strtelnum.Trim()
32
+                        + "%' or F_CityDes like '%" + strtelnum.Trim() + "%'or F_CardDes like '%" + strtelnum.Trim() + "%')";
33
+                }
64 34
 
65
-        //获取号码归属地
66
-        public ActionResult GetMobiledata(string mobileNum)
67
-        {
68
-            if (mobileNum != null && mobileNum.Trim() != "")
69
-            {
70
-                BLL.T_Sys_MobileData dBLL = new BLL.T_Sys_MobileData();
71
-                Model.T_Sys_MobileData dModel = dBLL.GetModel(mobileNum.Trim());
72
-                if (dModel != null)
35
+                if (strpageindex.Trim() != "")
73 36
                 {
74
-                    return Success("获取号码归属地成功", dModel);
37
+                    pageindex = Convert.ToInt32(strpageindex);
75 38
                 }
76
-                else
39
+
40
+                if (strpagesize.Trim() != "")
77 41
                 {
78
-                    return Error("获取号码归属地失败");
42
+                    pagesize = Convert.ToInt32(strpagesize);
79 43
                 }
44
+                int recordCount = 0;
45
+                dt = BLL.PagerBLL.GetListPager(
46
+                    "T_Sys_MobileData",
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
+
80 66
             }
81
-            else
67
+            return res;
68
+        }
69
+        public ActionResult GetMobiledata(int id)
70
+        {
71
+            ActionResult res = NoToken("未知错误,请重新登录");
72
+            if (Request.IsAuthenticated)
82 73
             {
83
-                return Error("获取参数失败");
74
+                BLL.T_Sys_MobileData dBLL = new BLL.T_Sys_MobileData();
75
+                Model.T_Sys_MobileData dModel = dBLL.GetModel(id);
76
+                res = Success("获取号码归属地成功", dModel);
84 77
             }
85
-
78
+            return res;
86 79
         }
87 80
 
88
-        //添加/编辑号码归属地
89
-        public ActionResult AddMobiledata(string mobileNum, string zipCode, string cityDes, string cardDes)
81
+        //获取号码归属地
82
+        public ActionResult GetMobiledataByNum(string mobileNum)
90 83
         {
91
-            BLL.T_Sys_MobileData dBLL = new BLL.T_Sys_MobileData();
92
-            Model.T_Sys_MobileData dModel = dBLL.GetModel(mobileNum);
93
-            if (dModel != null)
84
+            ActionResult res = NoToken("未知错误,请重新登录");
85
+            if (Request.IsAuthenticated)
94 86
             {
95
-                if (!string.IsNullOrWhiteSpace(mobileNum.Trim()))
96
-                {
97
-                    dModel.F_MobileNum = mobileNum.Trim();
98
-                }
99
-                if (!string.IsNullOrWhiteSpace(zipCode.Trim()))
100
-                {
101
-                    dModel.F_ZipCode = zipCode.Trim();
102
-                }
103
-                if (!string.IsNullOrWhiteSpace(cityDes.Trim()))
104
-                {
105
-                    dModel.F_CityDes = cityDes.Trim();
106
-                }
107
-                if (!string.IsNullOrWhiteSpace(cardDes.Trim()))
108
-                {
109
-                    dModel.F_CardDes = cardDes.Trim();
110
-                }
111 87
 
112
-                bool b = dBLL.Update(dModel);
113
-                if (b)
88
+                if (mobileNum != null && mobileNum.Trim() != "")
114 89
                 {
115
-                    return Success("编辑成功");
90
+                    BLL.T_Sys_MobileData dBLL = new BLL.T_Sys_MobileData();
91
+                    Model.T_Sys_MobileData dModel = dBLL.GetModelList(" F_MobileNum='" + mobileNum.Trim() + "' ").FirstOrDefault();
92
+                    if (dModel != null)
93
+                    {
94
+                        res = Success("获取号码归属地成功", dModel);
95
+                    }
96
+                    else
97
+                    {
98
+                        res = Error("获取号码归属地失败");
99
+                    }
116 100
                 }
117 101
                 else
118 102
                 {
119
-                    return Success("编辑失败");
103
+                    res = Error("获取参数失败");
120 104
                 }
105
+
121 106
             }
107
+            return res;
108
+        }
122 109
 
123
-            else
110
+        //添加/编辑号码归属地
111
+        public ActionResult AddMobiledata(string mobileNum, string zipCode, string cityDes, string cardDes, int id = 0)
112
+        {
113
+            ActionResult res = NoToken("未知错误,请重新登录");
114
+            if (Request.IsAuthenticated)
124 115
             {
125
-                dModel = new Model.T_Sys_MobileData();
126
-
127
-                if (!string.IsNullOrWhiteSpace(mobileNum.Trim()))
128
-                {
129
-                    dModel.F_MobileNum = mobileNum.Trim();
130
-                }
131
-                if (!string.IsNullOrWhiteSpace(zipCode.Trim()))
132
-                {
133
-                    dModel.F_ZipCode = zipCode.Trim();
134
-                }
135
-                if (!string.IsNullOrWhiteSpace(cityDes.Trim()))
136
-                {
137
-                    dModel.F_CityDes = cityDes.Trim();
138
-                }
139
-                if (!string.IsNullOrWhiteSpace(cardDes.Trim()))
140
-                {
141
-                    dModel.F_CardDes = cardDes.Trim();
142
-                }
143
-                bool b = new BLL.T_Sys_MobileData().Add(dModel);
144
-                if (b)
145
-                {
146
-                    return Success("添加成功");
116
+                int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
117
+                Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
118
+                BLL.T_Sys_MobileData dBLL = new BLL.T_Sys_MobileData();
119
+                Model.T_Sys_MobileData dModel = new Model.T_Sys_MobileData();
120
+
121
+                if (id != 0)
122
+                {
123
+
124
+                    dModel = dBLL.GetModel(id);
125
+                    if (dModel != null)
126
+                    {
127
+                        if (!string.IsNullOrWhiteSpace(mobileNum.Trim()))
128
+                        {
129
+                            dModel.F_MobileNum = mobileNum.Trim();
130
+                        }
131
+                        if (!string.IsNullOrWhiteSpace(zipCode.Trim()))
132
+                        {
133
+                            dModel.F_ZipCode = zipCode.Trim();
134
+                        }
135
+                        if (!string.IsNullOrWhiteSpace(cityDes.Trim()))
136
+                        {
137
+                            dModel.F_CityDes = cityDes.Trim();
138
+                        }
139
+                        if (!string.IsNullOrWhiteSpace(cardDes.Trim()))
140
+                        {
141
+                            dModel.F_CardDes = cardDes.Trim();
142
+                        }
143
+
144
+                        bool b = dBLL.Update(dModel);
145
+                        if (b)
146
+                        {
147
+                            res = Success("编辑成功");
148
+                        }
149
+                        else
150
+                        {
151
+                            res = Error("编辑失败");
152
+                        }
153
+                    }
154
+                    else
155
+                    {
156
+                        res = Error("编辑失败");
157
+                    }
147 158
                 }
148 159
                 else
149 160
                 {
150
-                    return Success("添加失败");
161
+                    dModel = new Model.T_Sys_MobileData();
162
+
163
+                    if (!string.IsNullOrWhiteSpace(mobileNum.Trim()))
164
+                    {
165
+                        dModel.F_MobileNum = mobileNum.Trim();
166
+                    }
167
+                    if (!string.IsNullOrWhiteSpace(zipCode.Trim()))
168
+                    {
169
+                        dModel.F_ZipCode = zipCode.Trim();
170
+                    }
171
+                    if (!string.IsNullOrWhiteSpace(cityDes.Trim()))
172
+                    {
173
+                        dModel.F_CityDes = cityDes.Trim();
174
+                    }
175
+                    if (!string.IsNullOrWhiteSpace(cardDes.Trim()))
176
+                    {
177
+                        dModel.F_CardDes = cardDes.Trim();
178
+                    }
179
+                    dModel.F_IsDelete = 0;
180
+                    dModel.F_CreateUser = ua.F_UserCode;
181
+                    dModel.F_CreateTime = DateTime.Now;
182
+                    int n = new BLL.T_Sys_MobileData().Add(dModel);
183
+                    if (n > 0)
184
+                    {
185
+                        res = Success("添加成功", n);
186
+                    }
187
+                    else
188
+                    {
189
+                        res = Error("添加失败");
190
+                    }
151 191
                 }
152
-            }
153 192
 
193
+            }
194
+            return res;
154 195
         }
155 196
 
156 197
         //删除号码归属地记录
157 198
         public ActionResult DelMobiledata(string[] nums)
158 199
         {
159
-            if (nums != null && nums.Length > 0)
200
+            ActionResult res = NoToken("未知错误,请重新登录");
201
+            if (Request.IsAuthenticated)
160 202
             {
161
-                string idd = " ";
162
-                foreach (string str in nums)
163
-                {
164
-                    idd += "'" + str + "',";
203
+                int userId = Utils.StrToInt(User.UserData["F_UserID"], 0);
204
+                Model.T_Sys_UserAccount ua = new BLL.T_Sys_UserAccount().GetModel(userId);
205
+                if (nums != null && nums.Length > 0)
206
+                {
207
+                    string idd = " ";
208
+                    foreach (string str in nums)
209
+                    {
210
+                        idd += "'" + str + "',";
211
+                    }
212
+                    if (new BLL.T_Sys_MobileData().DeleteList(idd.TrimEnd(','), ua.F_UserCode))
213
+                    {
214
+                        res = Success("删除成功");
215
+                    }
216
+                    else
217
+                        res = Error("删除失败");
165 218
                 }
166
-                if (new BLL.T_Sys_MobileData().DeleteList(idd.TrimEnd(',')))
219
+                else
167 220
                 {
168
-                    return Success("删除成功");
221
+                    res = Error("请选择要删除的记录");
169 222
                 }
170
-                else
171
-                    return Error("删除失败");
172
-            }
173
-            else
174
-            {
175
-                return Error("请选择要删除的记录");
176
-            }
177 223
 
224
+            }
225
+            return res;
178 226
         }
179 227
     }
180 228
 }

+ 56 - 5
CallCenterApi/CallCenterApi.Model/T_Sys_MobileData.cs

@@ -1,9 +1,4 @@
1 1
 using System;
2
-using System.Collections.Generic;
3
-using System.Linq;
4
-using System.Text;
5
-using System.Threading.Tasks;
6
-
7 2
 namespace CallCenterApi.Model
8 3
 {
9 4
     /// <summary>
@@ -15,10 +10,24 @@ namespace CallCenterApi.Model
15 10
         public T_Sys_MobileData()
16 11
         { }
17 12
         #region Model
13
+        private int _f_id;
18 14
         private string _f_mobilenum;
19 15
         private string _f_zipcode;
20 16
         private string _f_citydes;
21 17
         private string _f_carddes;
18
+        private string _f_createuser;
19
+        private DateTime? _f_createtime;
20
+        private int? _f_isdelete;
21
+        private string _f_deleteuser;
22
+        private DateTime? _f_deletetime;
23
+        /// <summary>
24
+        /// 
25
+        /// </summary>
26
+        public int F_Id
27
+        {
28
+            set { _f_id = value; }
29
+            get { return _f_id; }
30
+        }
22 31
         /// <summary>
23 32
         /// 
24 33
         /// </summary>
@@ -51,6 +60,48 @@ namespace CallCenterApi.Model
51 60
             set { _f_carddes = value; }
52 61
             get { return _f_carddes; }
53 62
         }
63
+        /// <summary>
64
+        /// 
65
+        /// </summary>
66
+        public string F_CreateUser
67
+        {
68
+            set { _f_createuser = value; }
69
+            get { return _f_createuser; }
70
+        }
71
+        /// <summary>
72
+        /// 
73
+        /// </summary>
74
+        public DateTime? F_CreateTime
75
+        {
76
+            set { _f_createtime = value; }
77
+            get { return _f_createtime; }
78
+        }
79
+        /// <summary>
80
+        /// 
81
+        /// </summary>
82
+        public int? F_IsDelete
83
+        {
84
+            set { _f_isdelete = value; }
85
+            get { return _f_isdelete; }
86
+        }
87
+        /// <summary>
88
+        /// 
89
+        /// </summary>
90
+        public string F_DeleteUser
91
+        {
92
+            set { _f_deleteuser = value; }
93
+            get { return _f_deleteuser; }
94
+        }
95
+        /// <summary>
96
+        /// 
97
+        /// </summary>
98
+        public DateTime? F_DeleteTime
99
+        {
100
+            set { _f_deletetime = value; }
101
+            get { return _f_deletetime; }
102
+        }
54 103
         #endregion Model
104
+
55 105
     }
56 106
 }
107
+