using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using DSWeb.Areas.SysMng.DAL.SysUser; using DSWeb.Areas.SysMng.Models.SysUser; using DSWeb.TruckMng.Comm.Cookie; using DSWeb.TruckMng.Helper; using DSWeb.TruckMng.Helper.Repository; using HcUtility.Comm; using HcUtility.Core; using DSWeb.Areas.CommMng.DAL; using System.Web; using DSWeb.SoftMng.BLL; using DSWeb.SoftMng.Model; using System.Web.Script.Serialization; using DSWeb.SoftMng.Filter; using DSWeb.SoftMng.Common; namespace DSWeb.Areas.SysMng.Controllers { /// /// /// [JsonRequestBehavior] public class SysUserOPRangeController : Controller { public ActionResult Index() { return View(); } public ContentResult GetOPRangTreeList(string PARENTID) { var dataList = SysUserDAL.GetOPRange(PARENTID); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetUserOPRangTreeList(string PARENTID, string USERID) { var CURRUSERID = ""; if (string.IsNullOrEmpty(USERID)) { if (PARENTID == "0") { var json = JsonConvert.Serialize(new { Success = true, Message = "" }); return new ContentResult() { Content = json }; }; try { CURRUSERID = HttpRuntime.Cache.Get(Convert.ToString(Session["USERID"]) + "_CURRUSERID").ToString(); } catch { var json0 = JsonConvert.Serialize(new { Success = false, Message = "" }); return new ContentResult() { Content = json0 }; } } else { CURRUSERID = USERID; HttpRuntime.Cache.Insert(Convert.ToString(Session["USERID"]) + "_CURRUSERID", USERID); } var dataList = new List(); if (string.IsNullOrEmpty(USERID) && string.IsNullOrEmpty(CURRUSERID)) { var json1 = JsonConvert.Serialize(new { Success = false, Message = "" }); return new ContentResult() { Content = json1 }; } else { dataList = SysUserDAL.GetOPRange(PARENTID, CURRUSERID); } var json2 = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json2 }; } public ContentResult AddRange(string IDList) { var CURRUSERID = ""; var json = ""; if (string.IsNullOrWhiteSpace(Session["USERID"].ToString())) { json = JsonConvert.Serialize(new { Success = false, Message = "请先登录系统!" }); return new ContentResult() { Content = json }; } try { CURRUSERID = HttpRuntime.Cache.Get(Convert.ToString(Session["USERID"]) + "_CURRUSERID").ToString(); } catch { json = JsonConvert.Serialize(new { Success = false, Message = "没有选中一个用户" }); return new ContentResult() { Content = json }; } DBResult result = SysUserDAL.AddRange(IDList, CURRUSERID,Session["USERID"].ToString()); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult DelRange(string IDList) { var CURRUSERID = ""; var json = ""; if (string.IsNullOrWhiteSpace(Session["USERID"].ToString())) { json = JsonConvert.Serialize(new { Success = false, Message = "请先登录系统!" }); return new ContentResult() { Content = json }; } try { CURRUSERID = HttpRuntime.Cache.Get(Convert.ToString(Session["USERID"]) + "_CURRUSERID").ToString(); } catch { json = JsonConvert.Serialize(new { Success = false, Message = "没有选中一个用户" }); return new ContentResult() { Content = json }; } var bodyList = JsonConvert.Deserialize>(IDList); var GIDLIST = ""; for (var _i = 0; _i < bodyList.Count; _i++) { if (GIDLIST != "") GIDLIST += ","; GIDLIST += "'" + bodyList[_i] + "'"; } DBResult result = SysUserDAL.DelRange(IDList, CURRUSERID, Session["USERID"].ToString()); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } }