| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- using CallCenter.Utility;
- 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.Client
- {
- public class ApplicationsRefreshController : BaseController
- {
- BLL.T_Client_Applications bll = new BLL.T_Client_Applications();
- /// <summary>
- /// 获取所有库列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetAllList()
- {
- DataTable dt = new DataTable();
- string appliName = HttpUtility.UrlDecode(RequestString.GetQueryString("appliName"));
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("strstarttime"));
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("strendtime"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- string sql = string.Empty;
- if (appliName.Trim() != "") {
- sql += " and F_AppliName like '%" + appliName + "%'";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_CreateTime,'" + strendtime + "')>=0 ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Client_Applications",
- "F_Id",
- "*",
- sql,
- "ORDER BY F_Id desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取一条详细信息
- /// </summary>
- /// <param name="infoid"></param>
- /// <returns></returns>
- public ActionResult GetInfo(string infoid)
- {
- if (infoid != null && infoid.Trim() != "")
- {
- Model.T_Client_Applications model = bll.GetModel(int.Parse(infoid.Trim()));
- if (model != null)
- {
- return Success("获取成功", model);
- }
- else
- {
- return Error("获取失败");
- };
- }
- else {
- return Error("获取参数失败");
- }
- }
- /// <summary>
- /// 保存信息
- /// </summary>
- /// <returns></returns>
- [Authority]
- public ActionResult SaveInfo()
- {
- int id = RequestString.GetInt("id", 0);
- string appliName = RequestString.GetFormString("appliName");
- string versionName = RequestString.GetFormString("versionName");
- string versionCode = RequestString.GetFormString("versionCode");
- string downUrl = RequestString.GetFormString("downUrl");
- int userId = RequestString.GetInt("userId", 0);
- string userCode = RequestString.GetFormString("userCode");
- int isDelete = RequestString.GetInt("isDelete", 0);
- int order = RequestString.GetInt("order", 0);
- string note = RequestString.GetFormString("note");
- if (!string.IsNullOrWhiteSpace(appliName) || !string.IsNullOrWhiteSpace(versionCode))
- {
- Model.T_Client_Applications model = new Model.T_Client_Applications();
- if (id == 0)
- {
- model.F_AppliName = appliName;
- model.F_VersionName = versionName;
- model.F_VersionCode = versionCode;
- model.F_DownUrl = downUrl;
- model.UserId = userId;
- model.UserCode = userCode;
- model.F_CreateTime = DateTime.Now;
- //model.F_UpdateTime = DateTime.Now;
- //model.F_DeleteTime = DateTime.Now;
- model.F_IsDelete = 0;
- model.F_Order = 0;
- model.F_Note = note;
- int n = bll.Add(model);
- if (n > 0)
- {
- return Success("添加成功", n);
- }
- else
- {
- return Error("添加失败");
- }
- }
- else
- {
- model = bll.GetModel(id);
- if (model != null)
- {
- model.F_Id = id;
- model.F_AppliName = appliName;
- model.F_VersionName = versionName;
- model.F_VersionCode = versionCode;
- model.F_DownUrl = downUrl;
- model.UserId = userId;
- model.UserCode = userCode;
- model.F_CreateTime = model.F_CreateTime;
- model.F_UpdateTime = DateTime.Now;
- //model.F_DeleteTime = model.F_DeleteTime;
- model.F_IsDelete = isDelete;
- model.F_Order = order;
- model.F_Note = note;
- if (bll.Update(model))
- {
- return Success("修改成功");
- }
- else
- {
- return Error("修改失败");
- }
- }
- return Error("信息不存在");
- }
- }
- else {
- return Error("获取参数失败");
- }
- }
- /// <summary>
- /// 删除信息
- /// </summary>
- /// <param name="ids"></param>
- /// <returns></returns>
- [Authority]
- public ActionResult DelInfo(string[] ids)
- {
- if (ids != null && ids.Length > 0)
- {
- string idd = " ";
- foreach (string str in ids)
- {
- idd += str + ",";
- }
- if (bll.DeleteList(idd.TrimEnd(',')))
- {
- return Success("删除成功");
- }
- else
- return Error("删除失败");
- }
- else
- {
- return Error("获取参数失败");
- }
- }
- }
- }
|