| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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 YTSoft.BaseCallCenter.Model;
- using YTSoft.BaseCallCenter.MVCWeb.Models;
- /// <summary>
- /// 话务-值班号码
- /// </summary>
- namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
- {
- public class DutyNumberController : BaseController
- {
- BLL.T_HW_DutyNumber busdutyNumber = new BLL.T_HW_DutyNumber();
- /// <summary>
- /// 值班电话列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetList()
- {
- return View();
- }
- /// <summary>
- /// 添加 视图
- /// </summary>
- /// <returns></returns>
- public ActionResult Add()
- {
- return View();
- }
- /// <summary>
- /// 修改 视图
- /// </summary>
- /// <returns></returns>
- public ActionResult Edit()
- {
- return View();
- }
- [ActionName("GetListData")]
- public string GetListData(string phone="",string name="",int page=0,int limit = 20)
- {
- string strWhere = " 1=1 ";
- if (!string.IsNullOrEmpty(phone))
- {
- strWhere += string.Format(" and F_DutyNumber='{0}'", phone);
- }
- if (!string.IsNullOrEmpty(name))
- {
- strWhere += string.Format(" and F_Remark like '%{0}%'", name);
- }
- DataTable dt = busdutyNumber.GetListByPage(strWhere,"", (page - 1)* limit + 1, page * limit).Tables[0];
- int count = busdutyNumber.GetRecordCount(strWhere);
- return Success("成功", dt, count);
- }
- [ActionName("GetData")]
- public string GettData(int id = 0)
- {
- if(id==0)
- return Error("请输入ID");
- Model.T_HW_DutyNumber model = busdutyNumber.GetModel(id);
- return Success("成功", model, 1);
- }
- [ActionName("adddata")]
- public string AddData(string phone = "", string name = "")
- {
- string strWhere = " 1=1 ";
- if (string.IsNullOrEmpty(phone))
- {
- return Error("请输入值班电话");
- }
- else {
- strWhere += string.Format(" and F_DutyNumber='{0}'", phone);
- }
- int count = busdutyNumber.GetRecordCount(strWhere);
- if (count > 0)
- {
- return Error("值班电话已存在");
- }
- Model.T_HW_DutyNumber model = new T_HW_DutyNumber();
- model.F_AddTime = DateTime.Now;
- model.F_AddUser = F_UserCode;
- model.F_DutyNumber = phone;
- model.F_Remark = name;
- model.F_State = 0;
- model.F_Group = "";
- model.F_Groupid = 0;
- int n = busdutyNumber.Add(model);
- if(n>0)
- return Success("成功", model, n);
- else
- return Error("失败");
- }
- [ActionName("editdata")]
- public string EditData(string phone = "", string name = "",int id=0)
- {
- string strWhere = " 1=1 ";
- if (string.IsNullOrEmpty(phone))
- {
- return Error("请输入值班电话");
- }
- else
- {
- strWhere += string.Format(" and F_ID!={1} and F_DutyNumber='{0}'", phone, id);
- }
- if (id==0)
- {
- return Error("请输入id");
- }
- int count = busdutyNumber.GetRecordCount(strWhere);
- if (count > 0)
- {
- return Error("值班电话已存在");
- }
- Model.T_HW_DutyNumber model = busdutyNumber.GetModel(id);
- model.F_AddTime = DateTime.Now;
- model.F_AddUser = F_UserCode;
- model.F_DutyNumber = phone;
- model.F_Remark = name;
- model.F_State = 0;
- model.F_Group = "";
- model.F_Groupid = 0;
- if (busdutyNumber.Update(model))
- return Success("成功");
- else
- return Error("失败");
- }
- [ActionName("deletedata")]
- public string DeleteData( int id = 0)
- {
- if (busdutyNumber.Delete(id))
- return Success("删除成功");
- else
- return Error("失败");
- }
- }
- }
|