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; /// /// 话务-值班号码 /// namespace ZXDT.CallCenter.MVCWeb.Controllers { public class MobileDataController : BaseController { BLL.T_Sys_MobileData busdutyNumber = new BLL.T_Sys_MobileData(); /// /// 电话列表 /// /// public ActionResult GetList() { return View(); } /// /// 添加 视图 /// /// 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("失败"); } } }