| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.Interface.Controllers.Base;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.tel
- {
- public class DutyPhoneController : BaseController
- {
- //获取值班电话列表
- public ActionResult GetList()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- string sql = "";
- DataTable dt = new DataTable();
- string strtelnum = HttpUtility.UrlDecode(RequestString.GetQueryString("telnum"));
- string strbtime = HttpUtility.UrlDecode(RequestString.GetQueryString("btime"));
- string stretime = HttpUtility.UrlDecode(RequestString.GetQueryString("etime"));
- int zxzid = RequestString.GetQueryInt("zxzid", 0);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strtelnum.Trim() != "" && strtelnum != "undefined")
- {
- sql += " and F_ZBDH like '%" + strtelnum.Trim() + "%' ";
- }
- if (strbtime.Trim() != "" && strbtime != "undefined")
- {
- sql += " and T_Call_ZBDH.F_CreateTime >= '" + Convert.ToDateTime(strbtime.Trim() + " 00:00:00") + "' ";
- }
- if (stretime.Trim() != "" && stretime != "undefined")
- {
- sql += " and T_Call_ZBDH.F_CreateTime <= '" + Convert.ToDateTime(stretime.Trim() + " 23:59:59") + "' ";
- }
- if (zxzid != 0)
- {
- sql += " and F_Groupid=" + zxzid;
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Call_ZBDH left join T_Sys_SeatGroup on T_Call_ZBDH.F_Groupid=T_Sys_SeatGroup.F_ZXZID",
- "F_ZBID",
- "T_Call_ZBDH.*,T_Sys_SeatGroup.F_ZXZName",
- sql,
- "ORDER BY F_ZBID desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- res = Content(obj.ToJson());
- }
- return res;
- }
- //获取值班电话
- public ActionResult GetDutyPhone(string zbid)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- if (zbid != null && zbid.Trim() != "")
- {
- BLL.T_Call_ZBDH dBLL = new BLL.T_Call_ZBDH();
- Model.T_Call_ZBDH dModel = dBLL.GetModel(int.Parse(zbid.Trim()));
- if (dModel != null)
- {
- res = Success("获取值班电话成功", dModel);
- }
- else
- {
- res = Error("获取值班电话失败");
- }
- }
- else
- {
- res = Error("获取参数失败");
- }
- }
- return res;
- }
- //添加值班电话
- public ActionResult AddDutyPhone(string zbid, string telphone, string des, string groupid)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- res = Error("操作失败");
- if (zbid != null && zbid.Trim() != "")
- {
- BLL.T_Call_ZBDH dBLL = new BLL.T_Call_ZBDH();
- Model.T_Call_ZBDH dModel = dBLL.GetModel(int.Parse(zbid.Trim()));
- if (dModel != null)
- {
- dModel.F_ZBDH = telphone.Trim();
- dModel.F_Remark = des.Trim();
- var gid = int.Parse(groupid.Trim());
- dModel.F_Groupid = gid;
- var gname = new BLL.T_Sys_SeatGroup().GetModel(gid) == null ? "" : new BLL.T_Sys_SeatGroup().GetModel(gid).F_ZXZName;
- dModel.F_GroupName = gname;
- bool b = dBLL.Update(dModel);
- if (b)
- {
- res = Success("编辑成功");
- }
- else
- {
- res = Error("编辑失败");
- }
- }
- }
- else
- {
- Model.T_Call_ZBDH dModel = new Model.T_Call_ZBDH();
- dModel.F_ZBDH = telphone.Trim();
- dModel.F_Remark = des.Trim();
- dModel.F_CreateBy = CurrentUser.UserData.F_UserName;
- dModel.F_CreateID = CurrentUser.UserData.F_UserId;
- dModel.F_CreateTime = DateTime.Now;
- var gid = int.Parse(groupid.Trim());
- dModel.F_Groupid = gid;
- var gname = new BLL.T_Sys_SeatGroup().GetModel(gid).F_ZXZName;
- dModel.F_GroupName = gname;
- int b = new BLL.T_Call_ZBDH().Add(dModel);
- if (b > 0)
- {
- res = Success("添加成功");
- }
- else
- {
- res = Error("添加失败");
- }
- }
- }
- return res;
- }
- //删除值班电话
- public ActionResult DelDutyPhone(string[] ids)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (ids != null && ids.Length > 0)
- {
- string idd = " ";
- foreach (string str in ids)
- {
- idd += str + ",";
- }
- if (new BLL.T_Call_ZBDH().DeleteList(idd.TrimEnd(',')))
- {
- res = Success("删除成功");
- }
- else
- res = Error("删除失败");
- }
- else
- {
- res = Error("请选择要删除的记录");
- }
- return res;
- }
- }
- }
|