zhengbingbing лет назад: 7
Родитель
Сommit
86f5b8351e

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

@@ -76,10 +76,12 @@
76 76
     <Compile Include="T_SMS_SendSMSTask.cs" />
77 77
     <Compile Include="T_SMS_SentSMS.cs" />
78 78
     <Compile Include="T_SMS_Template.cs" />
79
+    <Compile Include="T_Sys_Accessories.cs" />
79 80
     <Compile Include="T_Sys_CallOptLogs.cs" />
80 81
     <Compile Include="T_Sys_Department.cs" />
81 82
     <Compile Include="T_Sys_DictionaryBase.cs" />
82 83
     <Compile Include="T_Sys_DictionaryValue.cs" />
84
+    <Compile Include="T_Sys_IVRWords.cs" />
83 85
     <Compile Include="T_Sys_LoginLogs.cs" />
84 86
     <Compile Include="T_Sys_MobileData.cs" />
85 87
     <Compile Include="T_Sys_ModuleInfo.cs" />

+ 147 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Sys_Accessories.cs

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

+ 140 - 0
codegit/CallCenterApi/CallCenterApi.BLL/T_Sys_IVRWords.cs

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

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

@@ -76,10 +76,12 @@
76 76
     <Compile Include="T_SMS_SendSMSTask.cs" />
77 77
     <Compile Include="T_SMS_SentSMS.cs" />
78 78
     <Compile Include="T_SMS_Template.cs" />
79
+    <Compile Include="T_Sys_Accessories.cs" />
79 80
     <Compile Include="T_Sys_CallOptLogs.cs" />
80 81
     <Compile Include="T_Sys_Department.cs" />
81 82
     <Compile Include="T_Sys_DictionaryBase.cs" />
82 83
     <Compile Include="T_Sys_DictionaryValue.cs" />
84
+    <Compile Include="T_Sys_IVRWords.cs" />
83 85
     <Compile Include="T_Sys_LoginLogs.cs" />
84 86
     <Compile Include="T_Sys_MobileData.cs" />
85 87
     <Compile Include="T_Sys_ModuleInfo.cs" />

+ 337 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Sys_Accessories.cs

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

+ 420 - 0
codegit/CallCenterApi/CallCenterApi.DAL/T_Sys_IVRWords.cs

@@ -0,0 +1,420 @@
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
+    /// <summary>
13
+	/// 数据访问类:T_Sys_IVRWords
14
+	/// </summary>
15
+	public partial class T_Sys_IVRWords
16
+    {
17
+        public T_Sys_IVRWords()
18
+        { }
19
+        #region  BasicMethod
20
+
21
+
22
+        /// <summary>
23
+        /// 增加一条数据
24
+        /// </summary>
25
+        public int Add(CallCenterApi.Model.T_Sys_IVRWords model)
26
+        {
27
+            StringBuilder strSql = new StringBuilder();
28
+            strSql.Append("insert into T_Sys_IVRWords(");
29
+            strSql.Append("F_Item,F_ItemID,F_Content,F_Type,F_WavFileName,F_WavLoadPath,F_WavPath,F_StartDate,F_EndDate,F_Remark,F_IsState,F_CreateTime,F_CreateUser,F_IsDel,F_DeleteBy,F_DeleteTime)");
30
+            strSql.Append(" values (");
31
+            strSql.Append("@F_Item,@F_ItemID,@F_Content,@F_Type,@F_WavFileName,@F_WavLoadPath,@F_WavPath,@F_StartDate,@F_EndDate,@F_Remark,@F_IsState,@F_CreateTime,@F_CreateUser,@F_IsDel,@F_DeleteBy,@F_DeleteTime)");
32
+            strSql.Append(";select @@IDENTITY");
33
+            SqlParameter[] parameters = {
34
+                    new SqlParameter("@F_Item", SqlDbType.NVarChar,500),
35
+                    new SqlParameter("@F_ItemID", SqlDbType.Int,4),
36
+                    new SqlParameter("@F_Content", SqlDbType.NText),
37
+                    new SqlParameter("@F_Type", SqlDbType.Int,4),
38
+                    new SqlParameter("@F_WavFileName", SqlDbType.NVarChar,500),
39
+                    new SqlParameter("@F_WavLoadPath", SqlDbType.NVarChar,500),
40
+                    new SqlParameter("@F_WavPath", SqlDbType.NText),
41
+                    new SqlParameter("@F_StartDate", SqlDbType.DateTime),
42
+                    new SqlParameter("@F_EndDate", SqlDbType.DateTime),
43
+                    new SqlParameter("@F_Remark", SqlDbType.NText),
44
+                    new SqlParameter("@F_IsState", SqlDbType.Int,4),
45
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
46
+                    new SqlParameter("@F_CreateUser", SqlDbType.NVarChar,50),
47
+                    new SqlParameter("@F_IsDel", SqlDbType.Int,4),
48
+                    new SqlParameter("@F_DeleteBy", SqlDbType.NVarChar,200),
49
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime)};
50
+            parameters[0].Value = model.F_Item;
51
+            parameters[1].Value = model.F_ItemID;
52
+            parameters[2].Value = model.F_Content;
53
+            parameters[3].Value = model.F_Type;
54
+            parameters[4].Value = model.F_WavFileName;
55
+            parameters[5].Value = model.F_WavLoadPath;
56
+            parameters[6].Value = model.F_WavPath;
57
+            parameters[7].Value = model.F_StartDate;
58
+            parameters[8].Value = model.F_EndDate;
59
+            parameters[9].Value = model.F_Remark;
60
+            parameters[10].Value = model.F_IsState;
61
+            parameters[11].Value = model.F_CreateTime;
62
+            parameters[12].Value = model.F_CreateUser;
63
+            parameters[13].Value = model.F_IsDel;
64
+            parameters[14].Value = model.F_DeleteBy;
65
+            parameters[15].Value = model.F_DeleteTime;
66
+
67
+            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
68
+            if (obj == null)
69
+            {
70
+                return 0;
71
+            }
72
+            else
73
+            {
74
+                return Convert.ToInt32(obj);
75
+            }
76
+        }
77
+        /// <summary>
78
+        /// 更新一条数据
79
+        /// </summary>
80
+        public bool Update(CallCenterApi.Model.T_Sys_IVRWords model)
81
+        {
82
+            StringBuilder strSql = new StringBuilder();
83
+            strSql.Append("update T_Sys_IVRWords set ");
84
+            strSql.Append("F_Item=@F_Item,");
85
+            strSql.Append("F_ItemID=@F_ItemID,");
86
+            strSql.Append("F_Content=@F_Content,");
87
+            strSql.Append("F_Type=@F_Type,");
88
+            strSql.Append("F_WavFileName=@F_WavFileName,");
89
+            strSql.Append("F_WavLoadPath=@F_WavLoadPath,");
90
+            strSql.Append("F_WavPath=@F_WavPath,");
91
+            strSql.Append("F_StartDate=@F_StartDate,");
92
+            strSql.Append("F_EndDate=@F_EndDate,");
93
+            strSql.Append("F_Remark=@F_Remark,");
94
+            strSql.Append("F_IsState=@F_IsState,");
95
+            strSql.Append("F_CreateTime=@F_CreateTime,");
96
+            strSql.Append("F_CreateUser=@F_CreateUser,");
97
+            strSql.Append("F_IsDel=@F_IsDel,");
98
+            strSql.Append("F_DeleteBy=@F_DeleteBy,");
99
+            strSql.Append("F_DeleteTime=@F_DeleteTime");
100
+            strSql.Append(" where F_ID=@F_ID");
101
+            SqlParameter[] parameters = {
102
+                    new SqlParameter("@F_Item", SqlDbType.NVarChar,500),
103
+                    new SqlParameter("@F_ItemID", SqlDbType.Int,4),
104
+                    new SqlParameter("@F_Content", SqlDbType.NText),
105
+                    new SqlParameter("@F_Type", SqlDbType.Int,4),
106
+                    new SqlParameter("@F_WavFileName", SqlDbType.NVarChar,500),
107
+                    new SqlParameter("@F_WavLoadPath", SqlDbType.NVarChar,500),
108
+                    new SqlParameter("@F_WavPath", SqlDbType.NText),
109
+                    new SqlParameter("@F_StartDate", SqlDbType.DateTime),
110
+                    new SqlParameter("@F_EndDate", SqlDbType.DateTime),
111
+                    new SqlParameter("@F_Remark", SqlDbType.NText),
112
+                    new SqlParameter("@F_IsState", SqlDbType.Int,4),
113
+                    new SqlParameter("@F_CreateTime", SqlDbType.DateTime),
114
+                    new SqlParameter("@F_CreateUser", SqlDbType.NVarChar,50),
115
+                    new SqlParameter("@F_IsDel", SqlDbType.Int,4),
116
+                    new SqlParameter("@F_DeleteBy", SqlDbType.NVarChar,200),
117
+                    new SqlParameter("@F_DeleteTime", SqlDbType.DateTime),
118
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)};
119
+            parameters[0].Value = model.F_Item;
120
+            parameters[1].Value = model.F_ItemID;
121
+            parameters[2].Value = model.F_Content;
122
+            parameters[3].Value = model.F_Type;
123
+            parameters[4].Value = model.F_WavFileName;
124
+            parameters[5].Value = model.F_WavLoadPath;
125
+            parameters[6].Value = model.F_WavPath;
126
+            parameters[7].Value = model.F_StartDate;
127
+            parameters[8].Value = model.F_EndDate;
128
+            parameters[9].Value = model.F_Remark;
129
+            parameters[10].Value = model.F_IsState;
130
+            parameters[11].Value = model.F_CreateTime;
131
+            parameters[12].Value = model.F_CreateUser;
132
+            parameters[13].Value = model.F_IsDel;
133
+            parameters[14].Value = model.F_DeleteBy;
134
+            parameters[15].Value = model.F_DeleteTime;
135
+            parameters[16].Value = model.F_ID;
136
+
137
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
138
+            if (rows > 0)
139
+            {
140
+                return true;
141
+            }
142
+            else
143
+            {
144
+                return false;
145
+            }
146
+        }
147
+
148
+        /// <summary>
149
+        /// 删除一条数据
150
+        /// </summary>
151
+        public bool Delete(int F_ID,string deluser)
152
+        {
153
+
154
+            StringBuilder strSql = new StringBuilder();
155
+            //strSql.Append("delete from T_Sys_IVRWords ");
156
+            strSql.Append("update T_Sys_IVRWords set F_IsDel=1, ");
157
+            strSql.Append("F_DeleteBy=@F_DeleteBy, ");
158
+            strSql.Append("F_DeleteTime=getdate() ");
159
+            strSql.Append(" where F_ID=@F_ID");
160
+            SqlParameter[] parameters = {
161
+                    new SqlParameter("@F_ID", SqlDbType.Int,4),
162
+                    new SqlParameter("@F_DeleteBy", SqlDbType.NVarChar,200),
163
+            };
164
+            parameters[0].Value = F_ID;
165
+            parameters[1].Value = deluser;
166
+
167
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
168
+            if (rows > 0)
169
+            {
170
+                return true;
171
+            }
172
+            else
173
+            {
174
+                return false;
175
+            }
176
+        }
177
+        /// <summary>
178
+        /// 批量删除数据
179
+        /// </summary>
180
+        public bool DeleteList(string F_IDlist, string deluser)
181
+        {
182
+            StringBuilder strSql = new StringBuilder();
183
+            //strSql.Append("delete from T_Sys_IVRWords ");
184
+            strSql.Append("update T_Sys_IVRWords set F_IsDel=1, ");
185
+            strSql.Append("F_DeleteBy='"+ deluser + "', ");
186
+            strSql.Append("F_DeleteTime=getdate() ");
187
+            strSql.Append(" where F_ID in (" + F_IDlist + ")  ");
188
+            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
189
+            if (rows > 0)
190
+            {
191
+                return true;
192
+            }
193
+            else
194
+            {
195
+                return false;
196
+            }
197
+        }
198
+
199
+
200
+        /// <summary>
201
+        /// 得到一个对象实体
202
+        /// </summary>
203
+        public CallCenterApi.Model.T_Sys_IVRWords GetModel(int F_ID)
204
+        {
205
+
206
+            StringBuilder strSql = new StringBuilder();
207
+            strSql.Append("select  top 1 * from T_Sys_IVRWords ");
208
+            strSql.Append(" where F_ID=@F_ID");
209
+            SqlParameter[] parameters = {
210
+                    new SqlParameter("@F_ID", SqlDbType.Int,4)
211
+            };
212
+            parameters[0].Value = F_ID;
213
+
214
+            CallCenterApi.Model.T_Sys_IVRWords model = new CallCenterApi.Model.T_Sys_IVRWords();
215
+            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
216
+            if (ds.Tables[0].Rows.Count > 0)
217
+            {
218
+                return DataRowToModel(ds.Tables[0].Rows[0]);
219
+            }
220
+            else
221
+            {
222
+                return null;
223
+            }
224
+        }
225
+
226
+
227
+        /// <summary>
228
+        /// 得到一个对象实体
229
+        /// </summary>
230
+        public CallCenterApi.Model.T_Sys_IVRWords DataRowToModel(DataRow row)
231
+        {
232
+            CallCenterApi.Model.T_Sys_IVRWords model = new CallCenterApi.Model.T_Sys_IVRWords();
233
+            if (row != null)
234
+            {
235
+                if (row["F_ID"] != null && row["F_ID"].ToString() != "")
236
+                {
237
+                    model.F_ID = int.Parse(row["F_ID"].ToString());
238
+                }
239
+                if (row["F_Item"] != null)
240
+                {
241
+                    model.F_Item = row["F_Item"].ToString();
242
+                }
243
+                if (row["F_ItemID"] != null && row["F_ItemID"].ToString() != "")
244
+                {
245
+                    model.F_ItemID = int.Parse(row["F_ItemID"].ToString());
246
+                }
247
+                if (row["F_Content"] != null)
248
+                {
249
+                    model.F_Content = row["F_Content"].ToString();
250
+                }
251
+                if (row["F_Type"] != null && row["F_Type"].ToString() != "")
252
+                {
253
+                    model.F_Type = int.Parse(row["F_Type"].ToString());
254
+                }
255
+                if (row["F_WavFileName"] != null)
256
+                {
257
+                    model.F_WavFileName = row["F_WavFileName"].ToString();
258
+                }
259
+                if (row["F_WavLoadPath"] != null)
260
+                {
261
+                    model.F_WavLoadPath = row["F_WavLoadPath"].ToString();
262
+                }
263
+                if (row["F_WavPath"] != null)
264
+                {
265
+                    model.F_WavPath = row["F_WavPath"].ToString();
266
+                }
267
+                if (row["F_StartDate"] != null && row["F_StartDate"].ToString() != "")
268
+                {
269
+                    model.F_StartDate = DateTime.Parse(row["F_StartDate"].ToString());
270
+                }
271
+                if (row["F_EndDate"] != null && row["F_EndDate"].ToString() != "")
272
+                {
273
+                    model.F_EndDate = DateTime.Parse(row["F_EndDate"].ToString());
274
+                }
275
+                if (row["F_Remark"] != null)
276
+                {
277
+                    model.F_Remark = row["F_Remark"].ToString();
278
+                }
279
+                if (row["F_IsState"] != null && row["F_IsState"].ToString() != "")
280
+                {
281
+                    model.F_IsState = int.Parse(row["F_IsState"].ToString());
282
+                }
283
+                if (row["F_CreateTime"] != null && row["F_CreateTime"].ToString() != "")
284
+                {
285
+                    model.F_CreateTime = DateTime.Parse(row["F_CreateTime"].ToString());
286
+                }
287
+                if (row["F_CreateUser"] != null)
288
+                {
289
+                    model.F_CreateUser = row["F_CreateUser"].ToString();
290
+                }
291
+                if (row["F_IsDel"] != null && row["F_IsDel"].ToString() != "")
292
+                {
293
+                    model.F_IsDel = int.Parse(row["F_IsDel"].ToString());
294
+                }
295
+                if (row["F_DeleteBy"] != null)
296
+                {
297
+                    model.F_DeleteBy = row["F_DeleteBy"].ToString();
298
+                }
299
+                if (row["F_DeleteTime"] != null && row["F_DeleteTime"].ToString() != "")
300
+                {
301
+                    model.F_DeleteTime = DateTime.Parse(row["F_DeleteTime"].ToString());
302
+                }
303
+            }
304
+            return model;
305
+        }
306
+
307
+        /// <summary>
308
+        /// 获得数据列表
309
+        /// </summary>
310
+        public DataSet GetList(string strWhere)
311
+        {
312
+            StringBuilder strSql = new StringBuilder();
313
+            strSql.Append("select * ");
314
+            strSql.Append(" FROM T_Sys_IVRWords ");
315
+            if (strWhere.Trim() != "")
316
+            {
317
+                strSql.Append(" where " + strWhere);
318
+            }
319
+            return DbHelperSQL.Query(strSql.ToString());
320
+        }
321
+
322
+        /// <summary>
323
+        /// 获得前几行数据
324
+        /// </summary>
325
+        public DataSet GetList(int Top, string strWhere, string filedOrder)
326
+        {
327
+            StringBuilder strSql = new StringBuilder();
328
+            strSql.Append("select ");
329
+            if (Top > 0)
330
+            {
331
+                strSql.Append(" top " + Top.ToString());
332
+            }
333
+            strSql.Append(" * ");
334
+            strSql.Append(" FROM T_Sys_IVRWords ");
335
+            if (strWhere.Trim() != "")
336
+            {
337
+                strSql.Append(" where " + strWhere);
338
+            }
339
+            strSql.Append(" order by " + filedOrder);
340
+            return DbHelperSQL.Query(strSql.ToString());
341
+        }
342
+
343
+        /// <summary>
344
+        /// 获取记录总数
345
+        /// </summary>
346
+        public int GetRecordCount(string strWhere)
347
+        {
348
+            StringBuilder strSql = new StringBuilder();
349
+            strSql.Append("select count(1) FROM T_Sys_IVRWords ");
350
+            if (strWhere.Trim() != "")
351
+            {
352
+                strSql.Append(" where " + strWhere);
353
+            }
354
+            object obj = DbHelperSQL.GetSingle(strSql.ToString());
355
+            if (obj == null)
356
+            {
357
+                return 0;
358
+            }
359
+            else
360
+            {
361
+                return Convert.ToInt32(obj);
362
+            }
363
+        }
364
+        /// <summary>
365
+        /// 分页获取数据列表
366
+        /// </summary>
367
+        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
368
+        {
369
+            StringBuilder strSql = new StringBuilder();
370
+            strSql.Append("SELECT * FROM ( ");
371
+            strSql.Append(" SELECT ROW_NUMBER() OVER (");
372
+            if (!string.IsNullOrEmpty(orderby.Trim()))
373
+            {
374
+                strSql.Append("order by T." + orderby);
375
+            }
376
+            else
377
+            {
378
+                strSql.Append("order by T.F_ID desc");
379
+            }
380
+            strSql.Append(")AS Row, T.*  from T_Sys_IVRWords T ");
381
+            if (!string.IsNullOrEmpty(strWhere.Trim()))
382
+            {
383
+                strSql.Append(" WHERE " + strWhere);
384
+            }
385
+            strSql.Append(" ) TT");
386
+            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
387
+            return DbHelperSQL.Query(strSql.ToString());
388
+        }
389
+
390
+        /*
391
+		/// <summary>
392
+		/// 分页获取数据列表
393
+		/// </summary>
394
+		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
395
+		{
396
+			SqlParameter[] parameters = {
397
+					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
398
+					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
399
+					new SqlParameter("@PageSize", SqlDbType.Int),
400
+					new SqlParameter("@PageIndex", SqlDbType.Int),
401
+					new SqlParameter("@IsReCount", SqlDbType.Bit),
402
+					new SqlParameter("@OrderType", SqlDbType.Bit),
403
+					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
404
+					};
405
+			parameters[0].Value = "T_Sys_IVRWords";
406
+			parameters[1].Value = "F_ID";
407
+			parameters[2].Value = PageSize;
408
+			parameters[3].Value = PageIndex;
409
+			parameters[4].Value = 0;
410
+			parameters[5].Value = 0;
411
+			parameters[6].Value = strWhere;	
412
+			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
413
+		}*/
414
+
415
+        #endregion  BasicMethod
416
+        #region  ExtensionMethod
417
+
418
+        #endregion  ExtensionMethod
419
+    }
420
+}

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

@@ -179,6 +179,7 @@
179 179
     <Compile Include="Controllers\HomeController.cs" />
180 180
     <Compile Include="Controllers\IndexController.cs" />
181 181
     <Compile Include="Controllers\InfoController.cs" />
182
+    <Compile Include="Controllers\IVRWelcomeController.cs" />
182 183
     <Compile Include="Controllers\knowledge\KnowledgeClassController.cs" />
183 184
     <Compile Include="Controllers\knowledge\KnowledgeController.cs" />
184 185
     <Compile Include="Controllers\LogController.cs" />
@@ -341,6 +342,7 @@
341 342
     <Folder Include="Views\Index\" />
342 343
     <Folder Include="Views\Info\" />
343 344
     <Folder Include="Views\InputDXTel\" />
345
+    <Folder Include="Views\IVRWelcome\" />
344 346
     <Folder Include="Views\KnowledgeClass\" />
345 347
     <Folder Include="Views\Knowledge\" />
346 348
     <Folder Include="Views\Login\" />

+ 12 - 3
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Configs/system.config

@@ -19,8 +19,17 @@
19 19
   <!-- 设置邮箱主机 -->
20 20
   <add key="MailHost" value="smtp.ym.163.com" />
21 21
   <!-- ================== 3:微信配置参数 ================== -->
22
-  <!-- 设置微信appid -->
22
+  <!-- 设置微信appid --><!--
23 23
   <add key="WechatAppid" value="wx957c2297c315e6a5" />
24
-  <!-- 设置微信appsecret -->
25
-  <add key="WechatAppsecret" value="6c2d1f9fd32f906c315f03398800d474" />
24
+  --><!-- 设置微信appsecret --><!--
25
+  <add key="WechatAppsecret" value="6c2d1f9fd32f906c315f03398800d474" />-->
26
+  <!-- ================== 4:IVR文件上传FTP配置参数 ================== -->
27
+  <!-- 设置FTP -->
28
+  <add key="ftp" value="192.168.4.200" />
29
+  <!-- 设置账户名 -->
30
+  <add key="account" value="ftpupload" />
31
+  <!-- 设置密码 -->
32
+  <add key="password" value="ftp2018!" />
33
+  <!-- 文件保存位置 -->
34
+  <add key="saveloc" value="D:\\data\ftpvoice" />
26 35
 </appSettings>

+ 352 - 0
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/IVRWelcomeController.cs

@@ -0,0 +1,352 @@
1
+using CallCenter.Utility;
2
+using CallCenterApi.Common;
3
+using CallCenterApi.DB;
4
+using CallCenterApi.Interface.Controllers.Base;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Data;
8
+using System.Linq;
9
+using System.Web;
10
+using System.Web.Mvc;
11
+
12
+namespace CallCenterApi.Interface.Controllers
13
+{
14
+    public class IVRWelcomeController : BaseController
15
+    {
16
+        BLL.T_Sys_IVRWords dBLL = new BLL.T_Sys_IVRWords();
17
+        //获取IVR欢迎词列表
18
+        public ActionResult GetList()
19
+        {
20
+            string sql = " and F_IsDel = 0 ";
21
+            upstate();//更新过期的为失效状态
22
+            DataTable dt = new DataTable();
23
+            #region 获取参数
24
+            string key = HttpUtility.UrlDecode(RequestString.GetQueryString("key"));
25
+            string itemid = HttpUtility.UrlDecode(RequestString.GetQueryString("itemid"));
26
+            string strbtime = HttpUtility.UrlDecode(RequestString.GetQueryString("btime"));
27
+            string stretime = HttpUtility.UrlDecode(RequestString.GetQueryString("etime"));
28
+
29
+            string strybtime = HttpUtility.UrlDecode(RequestString.GetQueryString("bytime"));
30
+            string stryetime = HttpUtility.UrlDecode(RequestString.GetQueryString("eytime"));
31
+            string state = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));
32
+
33
+            string strpageindex = RequestString.GetQueryString("page");
34
+            int pageindex = 1;
35
+            string strpagesize = RequestString.GetQueryString("pagesize");
36
+            int pagesize = 10;
37
+            #endregion
38
+            #region 条件筛选
39
+            if (key.Trim() != "" && key != "undefined")
40
+            {
41
+                sql += " and (F_Item like '%" + key.Trim() + "%' or F_Content like '%" + key.Trim() + "%' )";
42
+            }
43
+            if (itemid.Trim() != "" && itemid != "undefined")
44
+            {
45
+                sql += " and F_ItemID=" + itemid;
46
+            }
47
+            if (strbtime.Trim() != "" && strbtime != "undefined")
48
+            {
49
+                sql += " and F_CreateTime >= '" + Convert.ToDateTime(strbtime.Trim()).ToString("yyyy-MM-dd 00:00:00") + "' ";
50
+            }
51
+            if (stretime.Trim() != "" && stretime != "undefined")
52
+            {
53
+                sql += " and F_CreateTime <= '" + Convert.ToDateTime(stretime.Trim()).ToString("yyyy-MM-dd 23:59:59") + "' ";
54
+            }
55
+            if (state.Trim() != "" && state != "undefined")
56
+            {
57
+                //0未启动,1生效中,2已失效
58
+                sql += " and F_IsState=" + state;
59
+            }
60
+            #region 有效期添加
61
+            var sqlwb = "";
62
+            var sqlwe = "";
63
+            if (strybtime.Trim() != "" && strybtime != "undefined")
64
+            {
65
+                sqlwb = "  ('" + strybtime.Trim() + "' between F_StartDate and F_EndDate) ";
66
+            }
67
+            if (stryetime.Trim() != "" && stryetime != "undefined")
68
+            {
69
+                sqlwe = "  ('" + stryetime.Trim() + "' between F_StartDate and F_EndDate) ";
70
+            }
71
+
72
+            if (sqlwb != "" && sqlwe != "")
73
+            {
74
+                sql += " and (" + sqlwb + " or " + sqlwe + ")";
75
+            }
76
+            else
77
+            {
78
+                if (sqlwb != "")
79
+                {
80
+                    sql += " and (" + sqlwb + ")";
81
+                }
82
+                else if (sqlwe != "")
83
+                {
84
+                    sql += " and (" + sqlwe + ")";
85
+                }
86
+            }
87
+            #endregion
88
+            #endregion
89
+            if (strpageindex.Trim() != "")
90
+            {
91
+                pageindex = Convert.ToInt32(strpageindex);
92
+            }
93
+
94
+            if (strpagesize.Trim() != "")
95
+            {
96
+                pagesize = Convert.ToInt32(strpagesize);
97
+            }
98
+            int recordCount = 0;
99
+            dt = BLL.PagerBLL.GetListPager(
100
+           "T_Sys_IVRWords",
101
+           "F_ID",
102
+           "*",
103
+           sql,
104
+           "ORDER BY F_ID desc",
105
+           pagesize,
106
+           pageindex,
107
+           true,
108
+           out recordCount);
109
+
110
+            var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='ftpvoice' ").FirstOrDefault();
111
+            foreach (DataRow dr in dt.Rows)
112
+            {
113
+                string path = dr["F_WavFileName"] != null ? dr["F_WavFileName"].ToString() : "";
114
+                if (path != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
115
+                {
116
+                    dr["F_WavPath"] = config.F_ParamValue + dr["F_WavFileName"].ToString();
117
+                }
118
+            }
119
+
120
+            var obj = new
121
+            {
122
+                state = "success",
123
+                message = "成功",
124
+                rows = dt,
125
+                total = recordCount
126
+            };
127
+
128
+            return Content(obj.ToJson());
129
+
130
+        }
131
+
132
+        //获取IVR欢迎词
133
+        public ActionResult GetIVRWords(string id)
134
+        {
135
+            if (id != null && id.Trim() != "")
136
+            {
137
+
138
+                Model.T_Sys_IVRWords dModel = dBLL.GetModel(int.Parse(id.Trim()));
139
+                var config = new BLL.T_Sys_SystemConfig().GetModelList(" F_ParamCode='ftpvoice' ").FirstOrDefault();
140
+
141
+                if (dModel.F_WavFileName != "" && config != null && !string.IsNullOrEmpty(config.F_ParamValue))
142
+                {
143
+                    dModel.F_WavPath = config.F_ParamValue + dModel.F_WavFileName;
144
+                }
145
+
146
+                if (dModel != null)
147
+                {
148
+                    return Success("获取IVR欢迎词成功", dModel);
149
+                }
150
+                else
151
+                {
152
+                    return Error("获取IVR欢迎词失败");
153
+                }
154
+            }
155
+            else
156
+            {
157
+                return Error("获取参数失败");
158
+            }
159
+
160
+        }
161
+
162
+        //添加IVR欢迎词
163
+        public ActionResult AddIVRWords(string id,string itemid, string item, 
164
+            string sdate, string edate, string remark, 
165
+            string filename, string loadpath, string path, int type=2, int isstate=0)
166
+        {
167
+            bool res = false;
168
+            int iss = returnisadd(id, itemid, sdate, edate);
169
+            if (iss <= 0)
170
+            {
171
+                Model.T_Sys_IVRWords dModel = new Model.T_Sys_IVRWords();
172
+                if (id != null && id.Trim() != "")
173
+                {
174
+                    dModel = dBLL.GetModel(int.Parse(id.Trim()));
175
+                    if (dModel == null)
176
+                    {
177
+                        return Error("此对象获取失败,请刷新后再试!");
178
+                    }
179
+                }
180
+                dModel.F_Item = item.Trim();
181
+                dModel.F_ItemID = Utils.StrToInt(itemid, 0);
182
+               // dModel.F_Content = content.Trim();
183
+                dModel.F_IsState = isstate;
184
+                dModel.F_StartDate = Utils.StrToDateTime(sdate, DateTime.Now);
185
+                dModel.F_EndDate = Utils.StrToDateTime(edate, DateTime.Now);
186
+                dModel.F_Remark = remark.Trim();
187
+                dModel.F_Type = 2;//1文本,2语音文件
188
+                if (type == 2)
189
+                {
190
+                    dModel.F_WavFileName = filename;
191
+                    dModel.F_WavLoadPath = loadpath;
192
+                    dModel.F_WavPath = path;
193
+                }
194
+                if (id != null && id.Trim() != "")
195
+                {
196
+                    res = dBLL.Update(dModel);
197
+                }
198
+                else
199
+                {
200
+                    dModel.F_IsDel = 0;
201
+                    dModel.F_CreateUser = CurrentUser.UserData.F_UserCode;
202
+                    dModel.F_CreateTime = DateTime.Now;
203
+                    int b = dBLL.Add(dModel);
204
+                    res = b > 0;
205
+                }
206
+            }
207
+            if (res)
208
+            {
209
+                return Success("保存IVR欢迎词成功");
210
+            }
211
+            else
212
+            {
213
+                if (iss > 0)
214
+                {
215
+                    return Error("存在已启动的IVR欢迎词在此有效期间,请查看记录后另外选择有效期!");
216
+                }
217
+                else
218
+                {
219
+                    return Error("保存IVR欢迎词失败");
220
+                }
221
+            }
222
+        }
223
+
224
+        //删除IVR欢迎词
225
+        public ActionResult DelIVRWords(string[] ids)
226
+        {
227
+            if (ids != null && ids.Length > 0)
228
+            {
229
+                string idd = " ";
230
+                foreach (string str in ids)
231
+                {
232
+                    idd += str + ",";
233
+                }
234
+                if (dBLL.DeleteList(idd.TrimEnd(','), CurrentUser.UserData.F_UserCode))
235
+                {
236
+                    return Success("删除成功");
237
+                }
238
+                else
239
+                    return Error("删除失败");
240
+            }
241
+            else
242
+            {
243
+                return Error("请选择要删除的记录");
244
+            }
245
+
246
+        }
247
+
248
+        //获取ivr欢迎词是否有添加权限
249
+        private int returnisadd(string id,string itemid, string sdate, string edate)
250
+        {
251
+
252
+            DateTime ssdate = Utils.StrToDateTime(sdate, DateTime.Now);
253
+            DateTime eedate = Utils.StrToDateTime(edate, DateTime.Now);
254
+            string sql = " isnull(F_IsState,0)=1 and F_IsDel = 0 ";//生效中状态
255
+            if (id != null && id != "")
256
+            {
257
+                sql += " and F_ID<>" + id;
258
+            }
259
+            if (itemid != null && itemid != "")
260
+            {
261
+                sql += " and F_ItemID<>" + itemid;
262
+            }
263
+            sql += " and( "
264
+                + "('" + ssdate.ToString("yyyy-MM-dd HH:mm:ss") + "' between F_StartDate and F_EndDate) "
265
+                + "or ('" + eedate.ToString("yyyy-MM-dd HH:mm:ss") + "' between F_StartDate and F_EndDate) "
266
+                + ")";
267
+            return dBLL.GetRecordCount(sql);
268
+        }
269
+
270
+        private void upstate()
271
+        {
272
+            string sql = " update T_Sys_IVRWords set F_IsState=2 ";
273
+            sql += " where isnull(F_IsState,0)=1 and F_IsDel = 0 ";//启动状态
274
+            sql += " and F_EndDate<getdate()";
275
+            DbHelperSQL.ExecuteSql(sql);
276
+        }
277
+
278
+        //上传音频文件,并修改为系统需要的格式
279
+        public ActionResult UploadWav()
280
+        {
281
+            HttpPostedFile _upFile = RequestString.GetFile("upFile");
282
+            if (_upFile != null)
283
+            {
284
+
285
+                string datename = DateTime.Now.ToString("yyyyMMddHHMMss");
286
+                string fullFileName = datename + "_" + _upFile.FileName;
287
+                string ffmpegLocation = Server.MapPath("~/");
288
+
289
+                #region 读取配置的上传路径-原文件和修改过格式的文件均上传至此
290
+                string savedir = Configs.GetValue("saveloc");
291
+                if (!System.IO.Directory.Exists(savedir))
292
+                {
293
+                    System.IO.Directory.CreateDirectory(savedir);
294
+                }
295
+                #endregion
296
+
297
+                #region 保存原文件到项目中
298
+                string path = this.Request.ApplicationPath + "/uploadwav/" + fullFileName;
299
+                if (!System.IO.Directory.Exists(Server.MapPath(this.Request.ApplicationPath + "/uploadwav/")))
300
+                {
301
+                    System.IO.Directory.CreateDirectory(Server.MapPath(this.Request.ApplicationPath + "/uploadwav/"));
302
+                }
303
+                string physicalpath = Server.MapPath(path);
304
+                _upFile.SaveAs(physicalpath);
305
+                #endregion
306
+
307
+                #region 保存文件到指定目录中和项目中
308
+                if (!string.IsNullOrEmpty(physicalpath))
309
+                {
310
+                    #region 上传
311
+                    uploadFile upfile = new uploadFile();
312
+                    //通过读取配置文件,获取数据库
313
+                    string _ftp = Configs.GetValue("ftp");
314
+                    string _acc = Configs.GetValue("account");
315
+                    string _pwd = Configs.GetValue("password");
316
+
317
+                    upfile.ftpPath = _ftp;
318
+                    upfile.ftpUserID = _acc;
319
+                    upfile.ftpPassword = _pwd;
320
+                    string uploadBeforres = upfile.UploadLocalToFtp(physicalpath);
321
+                    if (uploadBeforres == "上传成功!")
322
+                    {
323
+                        #region 写入日志
324
+                        Model.T_Sys_Accessories model_T_Sys_Accessories = new Model.T_Sys_Accessories();
325
+                        model_T_Sys_Accessories.F_AddTime = DateTime.Now;//上传时间
326
+                        model_T_Sys_Accessories.F_FileName = fullFileName;//附件名称
327
+                        model_T_Sys_Accessories.F_FileType = ".wav";//附件类型
328
+                        model_T_Sys_Accessories.F_FileUrl = savedir + fullFileName + ".wav";//附件地址
329
+                        //model_T_Sys_Accessories.F_Size = size;
330
+                        model_T_Sys_Accessories.F_UserCode = CurrentUser.UserData.F_UserCode;//上传人  
331
+                        int fid = new BLL.T_Sys_Accessories().Add(model_T_Sys_Accessories);
332
+                        #endregion
333
+                        var obj = new
334
+                        {
335
+                            filename = fullFileName,
336
+                            loadpath = path + ".wav",
337
+                            wavpath = savedir + fullFileName + ".wav"
338
+                        };
339
+                        return Success("文件上传成功", obj);
340
+                    }
341
+                    else
342
+                        return Error("文件上传失败,请重新上传::::::::uploadBeforres::" + uploadBeforres);
343
+                    #endregion
344
+                }
345
+                else
346
+                    return Error("格式修改出错,请重新上传");
347
+                #endregion
348
+            }
349
+            return Error("参数传入失败");
350
+        }
351
+    }
352
+}

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

@@ -81,10 +81,12 @@
81 81
     <Compile Include="T_SMS_SendSMSTask.cs" />
82 82
     <Compile Include="T_SMS_SentSMS.cs" />
83 83
     <Compile Include="T_SMS_Template.cs" />
84
+    <Compile Include="T_Sys_Accessories.cs" />
84 85
     <Compile Include="T_Sys_CallOptLogs.cs" />
85 86
     <Compile Include="T_Sys_Department.cs" />
86 87
     <Compile Include="T_Sys_DictionaryBase.cs" />
87 88
     <Compile Include="T_Sys_DictionaryValue.cs" />
89
+    <Compile Include="T_Sys_IVRWords.cs" />
88 90
     <Compile Include="T_Sys_LoginLogs.cs" />
89 91
     <Compile Include="T_Sys_MobileData.cs" />
90 92
     <Compile Include="T_Sys_ModuleFunctions.cs" />

+ 83 - 0
codegit/CallCenterApi/CallCenterApi.Model/T_Sys_Accessories.cs

@@ -0,0 +1,83 @@
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
+	[Serializable]
13
+    public partial class T_Sys_Accessories
14
+    {
15
+        public T_Sys_Accessories()
16
+        { }
17
+        #region Model
18
+        private int _f_fileid;
19
+        private string _f_filename;
20
+        private string _f_filetype;
21
+        private string _f_fileurl;
22
+        private string _f_usercode;
23
+        private DateTime? _f_addtime;
24
+        private long? _f_size;
25
+        /// <summary>
26
+        /// 附件id
27
+        /// </summary>
28
+        public int F_FileId
29
+        {
30
+            set { _f_fileid = value; }
31
+            get { return _f_fileid; }
32
+        }
33
+        /// <summary>
34
+        /// 附件名称
35
+        /// </summary>
36
+        public string F_FileName
37
+        {
38
+            set { _f_filename = value; }
39
+            get { return _f_filename; }
40
+        }
41
+        /// <summary>
42
+        /// 附件类型(后缀名)
43
+        /// </summary>
44
+        public string F_FileType
45
+        {
46
+            set { _f_filetype = value; }
47
+            get { return _f_filetype; }
48
+        }
49
+        /// <summary>
50
+        /// 上传路径
51
+        /// </summary>
52
+        public string F_FileUrl
53
+        {
54
+            set { _f_fileurl = value; }
55
+            get { return _f_fileurl; }
56
+        }
57
+        /// <summary>
58
+        /// 添加人工号
59
+        /// </summary>
60
+        public string F_UserCode
61
+        {
62
+            set { _f_usercode = value; }
63
+            get { return _f_usercode; }
64
+        }
65
+        /// <summary>
66
+        /// 上传时间
67
+        /// </summary>
68
+        public DateTime? F_AddTime
69
+        {
70
+            set { _f_addtime = value; }
71
+            get { return _f_addtime; }
72
+        }
73
+        /// <summary>
74
+        /// 附件大小
75
+        /// </summary>
76
+        public long? F_Size
77
+        {
78
+            set { _f_size = value; }
79
+            get { return _f_size; }
80
+        }
81
+        #endregion Model
82
+    }
83
+}

+ 173 - 0
codegit/CallCenterApi/CallCenterApi.Model/T_Sys_IVRWords.cs

@@ -0,0 +1,173 @@
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
+	/// IVR语音文件表
11
+	/// </summary>
12
+	[Serializable]
13
+    public partial class T_Sys_IVRWords
14
+    {
15
+        public T_Sys_IVRWords()
16
+        { }
17
+        #region Model
18
+        private int _f_id;
19
+        private string _f_item;
20
+        private int? _f_itemid;
21
+        private string _f_content;
22
+        private int? _f_type;
23
+        private string _f_wavfilename;
24
+        private string _f_wavloadpath;
25
+        private string _f_wavpath;
26
+        private DateTime? _f_startdate = DateTime.Now;
27
+        private DateTime? _f_enddate = DateTime.Now;
28
+        private string _f_remark;
29
+        private int? _f_isstate = 0;
30
+        private DateTime? _f_createtime = DateTime.Now;
31
+        private string _f_createuser;
32
+        private int? _f_isdel = 0;
33
+        private string _f_deleteby;
34
+        private DateTime? _f_deletetime;
35
+        /// <summary>
36
+        /// 自增ID
37
+        /// </summary>
38
+        public int F_ID
39
+        {
40
+            set { _f_id = value; }
41
+            get { return _f_id; }
42
+        }
43
+        /// <summary>
44
+        /// 项目
45
+        /// </summary>
46
+        public string F_Item
47
+        {
48
+            set { _f_item = value; }
49
+            get { return _f_item; }
50
+        }
51
+        /// <summary>
52
+        /// 项目ID
53
+        /// </summary>
54
+        public int? F_ItemID
55
+        {
56
+            set { _f_itemid = value; }
57
+            get { return _f_itemid; }
58
+        }
59
+        /// <summary>
60
+        /// 内容
61
+        /// </summary>
62
+        public string F_Content
63
+        {
64
+            set { _f_content = value; }
65
+            get { return _f_content; }
66
+        }
67
+        /// <summary>
68
+        /// 类型:1文本,2语音文件
69
+        /// </summary>
70
+        public int? F_Type
71
+        {
72
+            set { _f_type = value; }
73
+            get { return _f_type; }
74
+        }
75
+        /// <summary>
76
+        /// 语音文件名称
77
+        /// </summary>
78
+        public string F_WavFileName
79
+        {
80
+            set { _f_wavfilename = value; }
81
+            get { return _f_wavfilename; }
82
+        }
83
+        /// <summary>
84
+        /// 语音文件本地路径
85
+        /// </summary>
86
+        public string F_WavLoadPath
87
+        {
88
+            set { _f_wavloadpath = value; }
89
+            get { return _f_wavloadpath; }
90
+        }
91
+        /// <summary>
92
+        /// 语音文件路径
93
+        /// </summary>
94
+        public string F_WavPath
95
+        {
96
+            set { _f_wavpath = value; }
97
+            get { return _f_wavpath; }
98
+        }
99
+        /// <summary>
100
+        /// 生效时间
101
+        /// </summary>
102
+        public DateTime? F_StartDate
103
+        {
104
+            set { _f_startdate = value; }
105
+            get { return _f_startdate; }
106
+        }
107
+        /// <summary>
108
+        /// 失效时间
109
+        /// </summary>
110
+        public DateTime? F_EndDate
111
+        {
112
+            set { _f_enddate = value; }
113
+            get { return _f_enddate; }
114
+        }
115
+        /// <summary>
116
+        /// 备注
117
+        /// </summary>
118
+        public string F_Remark
119
+        {
120
+            set { _f_remark = value; }
121
+            get { return _f_remark; }
122
+        }
123
+        /// <summary>
124
+        /// 状态:1启动,0不启动
125
+        /// </summary>
126
+        public int? F_IsState
127
+        {
128
+            set { _f_isstate = value; }
129
+            get { return _f_isstate; }
130
+        }
131
+        /// <summary>
132
+        /// 添加时间
133
+        /// </summary>
134
+        public DateTime? F_CreateTime
135
+        {
136
+            set { _f_createtime = value; }
137
+            get { return _f_createtime; }
138
+        }
139
+        /// <summary>
140
+        /// 添加人
141
+        /// </summary>
142
+        public string F_CreateUser
143
+        {
144
+            set { _f_createuser = value; }
145
+            get { return _f_createuser; }
146
+        }
147
+        /// <summary>
148
+        /// 是否删除:0未删除,1已删除
149
+        /// </summary>
150
+        public int? F_IsDel
151
+        {
152
+            set { _f_isdel = value; }
153
+            get { return _f_isdel; }
154
+        }
155
+        /// <summary>
156
+        /// 
157
+        /// </summary>
158
+        public string F_DeleteBy
159
+        {
160
+            set { _f_deleteby = value; }
161
+            get { return _f_deleteby; }
162
+        }
163
+        /// <summary>
164
+        /// 
165
+        /// </summary>
166
+        public DateTime? F_DeleteTime
167
+        {
168
+            set { _f_deletetime = value; }
169
+            get { return _f_deletetime; }
170
+        }
171
+        #endregion Model
172
+    }
173
+}

+ 1 - 0
codegit/CallCenterCommon/CallCenter.Utility/CallCenter.Utility.csproj

@@ -79,6 +79,7 @@
79 79
     <Compile Include="SaltAndHashHelper.cs" />
80 80
     <Compile Include="SysInformationHelper.cs" />
81 81
     <Compile Include="Time\DateTimeConvert.cs" />
82
+    <Compile Include="uploadFile.cs" />
82 83
     <Compile Include="VerifyCode\VerifyCode.cs" />
83 84
     <Compile Include="Web\TreeGrid\TreeGrid.cs" />
84 85
     <Compile Include="Web\TreeGrid\TreeGridModel.cs" />

+ 167 - 0
codegit/CallCenterCommon/CallCenter.Utility/uploadFile.cs

@@ -0,0 +1,167 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Linq;
5
+using System.Net;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+namespace CallCenter.Utility
10
+{
11
+    public class uploadFile
12
+    {
13
+        public string ftpPath;
14
+        public string ftpUserID;
15
+        public string ftpPassword;
16
+
17
+        /// <summary>
18
+        /// 上传文件
19
+        /// </summary>
20
+        /// <param name="fileinfo">需要上传的文件</param>
21
+        public string UploadLocalToFtp(string localFile)
22
+        {
23
+            string res = "";
24
+            if (!File.Exists(localFile))
25
+            {
26
+                res = "文件:“" + localFile + "” 不存在!";
27
+                return res;
28
+            }
29
+            FileInfo fileInf = new FileInfo(localFile);
30
+            //改后文件
31
+            #region 改后文件
32
+            string temp_filename = localFile.Split('\\').Last().Split('.')[0] + "_temp";
33
+            string localfileAft = Path.GetDirectoryName(localFile) + "\\" + temp_filename + ".wav";
34
+            FileInfo fileInfAft = new FileInfo(localfileAft);
35
+            #endregion
36
+            string ftpURI = "ftp://" + ftpPath + "/";
37
+            string uri = ftpURI + fileInf.Name;
38
+            string uriAft = ftpURI + fileInfAft.Name;
39
+            FtpWebRequest reqFTP;
40
+            reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));// 根据uri创建FtpWebRequest对象   
41
+            reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);// ftp用户名和密码  
42
+            reqFTP.KeepAlive = false;// 默认为true,连接不会被关闭 // 在一个命令之后被执行  
43
+            reqFTP.Method = WebRequestMethods.Ftp.UploadFile;// 指定执行什么命令  
44
+            reqFTP.UseBinary = true;// 指定数据传输类型  
45
+            reqFTP.UsePassive = true;
46
+            reqFTP.ContentLength = fileInf.Length;// 上传文件时通知服务器文件的大小  
47
+            int buffLength = 2048;// 缓冲大小设置为2kb  
48
+            byte[] buff = new byte[buffLength];
49
+            int contentLen;
50
+
51
+            // 打开一个文件流 (System.IO.FileStream) 去读上传的文件  
52
+            using (FileStream fs = new FileStream(localFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
53
+            {
54
+                try
55
+                {
56
+                    res += uri + localFile;
57
+                    using (Stream strm = reqFTP.GetRequestStream())// 把上传的文件写入流
58
+                    {
59
+                        contentLen = fs.Read(buff, 0, buffLength);// 每次读文件流的2kb 
60
+                        while (contentLen != 0)// 流内容没有结束  
61
+                        {
62
+                            // 把内容从file stream 写入 upload stream  
63
+                            strm.Write(buff, 0, contentLen);
64
+                            contentLen = fs.Read(buff, 0, buffLength);
65
+                        }
66
+                    }
67
+                    // 关闭流  
68
+                    fs.Close();
69
+                    res = "上传成功!";
70
+                }
71
+                catch (Exception ex)
72
+                {
73
+                    res += "上传文件【" + ftpPath + "/" + fileInf.Name + "】时,发生错误:" + ex.Message + "<br/>。路径:" + localFile;
74
+                }
75
+            }
76
+            FtpWebRequest reqFTP1;
77
+            reqFTP1 = (FtpWebRequest)FtpWebRequest.Create(new Uri(uriAft));// 根据uri创建FtpWebRequest对象   
78
+            reqFTP1.Credentials = new NetworkCredential(ftpUserID, ftpPassword);// ftp用户名和密码  
79
+            reqFTP1.KeepAlive = false;// 默认为true,连接不会被关闭 // 在一个命令之后被执行  
80
+            reqFTP1.Method = WebRequestMethods.Ftp.UploadFile;// 指定执行什么命令  
81
+            reqFTP1.UseBinary = true;// 指定数据传输类型  
82
+            reqFTP1.UsePassive = true;
83
+            reqFTP1.ContentLength = fileInfAft.Length;// 上传文件时通知服务器文件的大小  
84
+            int buffLengthaft = 2048;// 缓冲大小设置为2kb  
85
+            byte[] buffaft = new byte[buffLengthaft];
86
+            int contentLenaft;
87
+
88
+            // 打开一个文件流 (System.IO.FileStream) 去读上传的文件  
89
+            using (FileStream fs1 = new FileStream(localfileAft, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
90
+            {
91
+                try
92
+                {
93
+                    res += uriAft + localfileAft;
94
+                    using (Stream strm1 = reqFTP1.GetRequestStream())// 把上传的文件写入流
95
+                    {
96
+                        contentLenaft = fs1.Read(buffaft, 0, buffLengthaft);// 每次读文件流的2kb 
97
+                        while (contentLenaft != 0)// 流内容没有结束  
98
+                        {
99
+                            // 把内容从file stream 写入 upload stream  
100
+                            strm1.Write(buffaft, 0, contentLenaft);
101
+                            contentLenaft = fs1.Read(buffaft, 0, buffLengthaft);
102
+                        }
103
+                    }
104
+                    // 关闭流  
105
+                    fs1.Close();
106
+                    res = "上传成功!";
107
+                }
108
+                catch (Exception ex)
109
+                {
110
+                    res += "上传文件【" + ftpPath + "/" + fileInf.Name + "】时,发生错误:" + ex.Message + "<br/>。路径:" + localFile;
111
+                }
112
+            }
113
+            return res;
114
+        }
115
+
116
+        /// <summary>  
117
+        /// 判断ftp服务器上该目录是否存在  
118
+        /// </summary>  
119
+        /// <param name="ftpPath">FTP路径目录</param>  
120
+        /// <param name="dirName">目录上的文件夹名称</param>  
121
+        /// <returns></returns>  
122
+        private bool CheckDirectoryExist(string ftpPath, string dirName)
123
+        {
124
+            bool flag = true;
125
+            try
126
+            {
127
+                //实例化FTP连接  
128
+                FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpPath + dirName);
129
+                ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
130
+                ftp.Method = WebRequestMethods.Ftp.ListDirectory;
131
+                FtpWebResponse response = (FtpWebResponse)ftp.GetResponse();
132
+                response.Close();
133
+            }
134
+            catch (Exception)
135
+            {
136
+                flag = false;
137
+            }
138
+            return flag;
139
+        }
140
+
141
+        /// <summary>  
142
+        /// 创建文件夹    
143
+        /// </summary>    
144
+        /// <param name="ftpPath">FTP路径</param>    
145
+        /// <param name="dirName">创建文件夹名称</param>    
146
+        public void MakeDir(string ftpPath, string dirName)
147
+        {
148
+            FtpWebRequest reqFTP;
149
+            try
150
+            {
151
+                string ui = (ftpPath + dirName).Trim();
152
+                reqFTP = (FtpWebRequest)FtpWebRequest.Create(ui);
153
+                reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
154
+                reqFTP.UseBinary = true;
155
+                reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
156
+                FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
157
+                Stream ftpStream = response.GetResponseStream();
158
+                ftpStream.Close();
159
+                response.Close();
160
+            }
161
+            catch (Exception ex)
162
+            {
163
+            }
164
+
165
+        }
166
+    }
167
+}