| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using ZXDT.CallCenter.Model;
- using ZXDT.CallCenter.MVCWeb.Models;
- /// <summary>
- /// 话务-值班号码
- /// </summary>
- namespace ZXDT.CallCenter.MVCWeb.Controllers
- {
- public class MobileDataController : BaseController
- {
- BLL.T_Sys_MobileData busdutyNumber = new BLL.T_Sys_MobileData();
- /// <summary>
- /// 电话列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetList()
- {
- return View();
- }
- /// <summary>
- /// 添加 视图
- /// </summary>
- /// <returns></returns>
- public ActionResult Add()
- {
- return View();
- }
- [ActionName("GetListData")]
- public string GetListData(string phone="")
- {
- DataTable dt = null;
- int count = 0;
- //if (string.IsNullOrEmpty(phone))
- //{
- // return Success("成功", dt, count);
- //}
- AddAction("T_Sys_MobileData", "page", "查询列表", string.Format(" 获取前50条 phone={0}", phone));
- string strWhere = " 1=1 ";
- if (!string.IsNullOrEmpty(phone))
- {
- strWhere += string.Format(" and F_MobileNum like '%{0}%'", phone);
- }
- dt = busdutyNumber.GetList(50,strWhere, " F_MobileNum ASC").Tables[0];
- if (dt != null && dt.Rows.Count > 0)
- {
- count = dt.Rows.Count;
- }
- return Success("成功", dt, count);
- }
- [ActionName("GetData")]
- public string GettData(string id = "")
- {
- if(id.Length!=7)
- return Error("请输入ID");
- Model.T_Sys_MobileData model = busdutyNumber.GetModel(id);
- return Success("成功", model, 1);
- }
- [ActionName("adddata")]
- public string AddData(string phone = "", string ZipCode = "",string CityDes="未知",string CardDes="未知")
- {
- string strWhere = " 1=1 ";
- if (string.IsNullOrEmpty(phone))
- {
- return Error("请输入号码前七位");
- }
- else if (string.IsNullOrEmpty(ZipCode))
- {
- return Error("请输入城市固话区号");
- }
- else if (phone.Length != 7)
- {
- return Error("请输入号码前七位");
- }
- else
- {
- strWhere += string.Format(" and F_MobileNum='{0}'", phone);
- }
- int count = busdutyNumber.GetRecordCount(strWhere);
- if (count > 0)
- {
- return Error("号码已存在");
- }
- Model.T_Sys_MobileData model = new T_Sys_MobileData();
- model.F_MobileNum = phone;
- model.F_ZipCode = ZipCode;
- model.F_CityDes = CityDes;
- model.F_CardDes = CardDes;
- if (busdutyNumber.Add(model))
- {
- AddAction("T_Sys_MobileData", phone, "新增电话库", phone);
- return Success("成功", model);
- }
- else
- return Error("失败");
- }
- [ActionName("deletedata")]
- public string DeleteData( string phone)
- {
- if (string.IsNullOrEmpty(phone))
- {
- return Error("请输入ID");
- }
- Model.T_Sys_MobileData model = busdutyNumber.GetModel(phone);
- if (busdutyNumber.Delete(phone))
- {
- AddAction("T_Sys_MobileData", phone.ToMyString(), "删除电话库",JsonConvert.SerializeObject(model),"敏感信息");
- AddAction("T_Sys_MobileData", phone.ToMyString(), "删除电话库");
- return Success("删除成功");
- }
- else
- return Error("失败");
- }
- }
- }
|