SysAdminRoleNewController.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. // /*
  2. // * 后台管理员角色
  3. // */
  4. // using System;
  5. // using System.Web;
  6. // using System.Collections.Generic;
  7. // using System.Diagnostics;
  8. // using System.Linq;
  9. // using System.Threading.Tasks;
  10. // using Microsoft.AspNetCore.Mvc;
  11. // using Microsoft.AspNetCore.Http;
  12. // using Microsoft.Extensions.Logging;
  13. // using Microsoft.Extensions.Options;
  14. // using MySystem.BsModels;
  15. // using Library;
  16. // using LitJson;
  17. // using MySystemLib;
  18. // namespace MySystem.Areas.Admin.Controllers
  19. // {
  20. // [Area("Admin")]
  21. // [Route("Admin/[controller]/[action]")]
  22. // public class SysAdminRoleNewController : BaseController
  23. // {
  24. // public SysAdminRoleNewController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
  25. // {
  26. // OtherMySqlConn.connstr = ConfigurationManager.AppSettings["BsSqlConnStr"].ToString();
  27. // }
  28. // #region 后台管理员角色列表
  29. // /// <summary>
  30. // /// 根据条件查询后台管理员角色列表
  31. // /// </summary>
  32. // /// <returns></returns>
  33. // public IActionResult Index(SysAdminRoleNew data, string right)
  34. // {
  35. // ViewBag.RightInfo = RightInfo;
  36. // ViewBag.right = right;
  37. // string Condition = "";
  38. // Condition += "Name:\"" + data.Name + "\",";
  39. // if (!string.IsNullOrEmpty(Condition))
  40. // {
  41. // Condition = Condition.TrimEnd(',');
  42. // Condition = ", where: {" + Condition + "}";
  43. // }
  44. // ViewBag.Condition = Condition;
  45. // return View();
  46. // }
  47. // #endregion
  48. // #region 根据条件查询后台管理员角色列表
  49. // /// <summary>
  50. // /// 后台管理员角色列表
  51. // /// </summary>
  52. // /// <returns></returns>
  53. // public JsonResult IndexData(SysAdminRoleNew data, int page = 1, int limit = 30)
  54. // {
  55. // Dictionary<string, string> Fields = new Dictionary<string, string>();
  56. // Fields.Add("Name", "2"); //名称
  57. // Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("SysAdminRoleNew", Fields, "Id desc", "0", page, limit, " and Status>-1");
  58. // List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
  59. // foreach (Dictionary<string, object> dic in diclist)
  60. // {
  61. // }
  62. // return Json(obj);
  63. // }
  64. // #endregion
  65. // #region 增加后台管理员角色
  66. // /// <summary>
  67. // /// 增加或修改后台管理员角色信息
  68. // /// </summary>
  69. // /// <returns></returns>
  70. // public IActionResult Add(string right)
  71. // {
  72. // ViewBag.RightInfo = RightInfo;
  73. // ViewBag.right = right;
  74. // return View();
  75. // }
  76. // #endregion
  77. // #region 增加后台管理员角色
  78. // /// <summary>
  79. // /// 增加或修改后台管理员角色信息
  80. // /// </summary>
  81. // /// <returns></returns>
  82. // [HttpPost]
  83. // public string Add(SysAdminRoleNew data)
  84. // {
  85. // Dictionary<string, object> Fields = new Dictionary<string, object>();
  86. // Fields.Add("Name", data.Name); //名称
  87. // Fields.Add("Details", data.Details); //描述
  88. // Fields.Add("RightInfo", "," + data.RightInfo + ","); //权限设置
  89. // Fields.Add("SeoTitle", data.SeoTitle);
  90. // Fields.Add("SeoKeyword", data.SeoKeyword);
  91. // Fields.Add("SeoDescription", data.SeoDescription);
  92. // int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Add("SysAdminRoleNew", Fields, 0);
  93. // AddSysLog(data.Id.ToString(), "SysAdminRoleNew", "add");
  94. // bsdb.SaveChanges();
  95. // return "success";
  96. // }
  97. // #endregion
  98. // #region 修改后台管理员角色
  99. // /// <summary>
  100. // /// 增加或修改后台管理员角色信息
  101. // /// </summary>
  102. // /// <returns></returns>
  103. // public IActionResult Edit(string right, int Id = 0)
  104. // {
  105. // ViewBag.RightInfo = RightInfo;
  106. // ViewBag.right = right;
  107. // SysAdminRoleNew editData = bsdb.SysAdminRoleNew.FirstOrDefault(m => m.Id == Id) ?? new SysAdminRoleNew();
  108. // ViewBag.data = editData;
  109. // return View();
  110. // }
  111. // #endregion
  112. // #region 修改后台管理员角色
  113. // /// <summary>
  114. // /// 增加或修改后台管理员角色信息
  115. // /// </summary>
  116. // /// <returns></returns>
  117. // [HttpPost]
  118. // public string Edit(SysAdminRoleNew data)
  119. // {
  120. // Dictionary<string, object> Fields = new Dictionary<string, object>();
  121. // Fields.Add("Name", data.Name); //名称
  122. // Fields.Add("Details", data.Details); //描述
  123. // Fields.Add("RightInfo", "," + data.RightInfo + ","); //权限设置
  124. // Fields.Add("SeoTitle", data.SeoTitle);
  125. // Fields.Add("SeoKeyword", data.SeoKeyword);
  126. // Fields.Add("SeoDescription", data.SeoDescription);
  127. // new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("SysAdminRoleNew", Fields, data.Id);
  128. // AddSysLog(data.Id.ToString(), "SysAdminRoleNew", "update");
  129. // bsdb.SaveChanges();
  130. // return "success";
  131. // }
  132. // #endregion
  133. // #region 删除后台管理员角色信息
  134. // /// <summary>
  135. // /// 删除后台管理员角色信息
  136. // /// </summary>
  137. // /// <returns></returns>
  138. // public string Delete(string Id)
  139. // {
  140. // string[] idlist = Id.Split(new char[] { ',' });
  141. // AddSysLog(Id, "SysAdminRoleNew", "del");
  142. // foreach (string subid in idlist)
  143. // {
  144. // int id = int.Parse(subid);
  145. // Dictionary<string, object> Fields = new Dictionary<string, object>();
  146. // Fields.Add("Status", -1);
  147. // new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("SysAdminRoleNew", Fields, id);
  148. // }
  149. // bsdb.SaveChanges();
  150. // return "success";
  151. // }
  152. // #endregion
  153. // #region 开启
  154. // /// <summary>
  155. // /// 开启
  156. // /// </summary>
  157. // /// <returns></returns>
  158. // public string Open(string Id)
  159. // {
  160. // string[] idlist = Id.Split(new char[] { ',' });
  161. // AddSysLog(Id, "SysAdminRoleNew", "open");
  162. // foreach (string subid in idlist)
  163. // {
  164. // int id = int.Parse(subid);
  165. // Dictionary<string, object> Fields = new Dictionary<string, object>();
  166. // Fields.Add("Status", 1);
  167. // new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("SysAdminRoleNew", Fields, id);
  168. // }
  169. // bsdb.SaveChanges();
  170. // return "success";
  171. // }
  172. // #endregion
  173. // #region 关闭
  174. // /// <summary>
  175. // /// 关闭
  176. // /// </summary>
  177. // /// <returns></returns>
  178. // public string Close(string Id)
  179. // {
  180. // string[] idlist = Id.Split(new char[] { ',' });
  181. // AddSysLog(Id, "SysAdminRoleNew", "close");
  182. // foreach (string subid in idlist)
  183. // {
  184. // int id = int.Parse(subid);
  185. // Dictionary<string, object> Fields = new Dictionary<string, object>();
  186. // Fields.Add("Status", 0);
  187. // new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Edit("SysAdminRoleNew", Fields, id);
  188. // }
  189. // bsdb.SaveChanges();
  190. // return "success";
  191. // }
  192. // #endregion
  193. // #region 排序
  194. // /// <summary>
  195. // /// 排序
  196. // /// </summary>
  197. // /// <param name="Id"></param>
  198. // public string Sort(int Id, int Sort)
  199. // {
  200. // new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).Sort("SysAdminRoleNew", Sort, Id);
  201. // AddSysLog(Id.ToString(), "SysAdminRoleNew", "sort");
  202. // return "success";
  203. // }
  204. // #endregion
  205. // #region 导入数据
  206. // /// <summary>
  207. // /// 导入数据
  208. // /// </summary>
  209. // /// <param name="ExcelData"></param>
  210. // public string Import(string ExcelData)
  211. // {
  212. // ExcelData = HttpUtility.UrlDecode(ExcelData);
  213. // JsonData list = JsonMapper.ToObject(ExcelData);
  214. // for (int i = 1; i < list.Count; i++)
  215. // {
  216. // JsonData dr = list[i];
  217. // bsdb.SysAdminRoleNew.Add(new SysAdminRoleNew()
  218. // {
  219. // CreateDate = DateTime.Now,
  220. // UpdateDate = DateTime.Now,
  221. // });
  222. // bsdb.SaveChanges();
  223. // }
  224. // AddSysLog("0", "SysAdminRoleNew", "Import");
  225. // return "success";
  226. // }
  227. // #endregion
  228. // #region 导出Excel
  229. // /// <summary>
  230. // /// 导出Excel
  231. // /// </summary>
  232. // /// <returns></returns>
  233. // public JsonResult ExportExcel(SysAdminRoleNew data)
  234. // {
  235. // Dictionary<string, string> Fields = new Dictionary<string, string>();
  236. // Fields.Add("Name", "2"); //名称
  237. // Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.BsTables).IndexData("SysAdminRoleNew", Fields, "Id desc", "0", 1, 20000, "", "", false);
  238. // List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
  239. // foreach (Dictionary<string, object> dic in diclist)
  240. // {
  241. // }
  242. // Dictionary<string, object> result = new Dictionary<string, object>();
  243. // result.Add("Status", "1");
  244. // result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
  245. // result.Add("Obj", diclist);
  246. // Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
  247. // result.Add("Fields", ReturnFields);
  248. // AddSysLog("0", "SysAdminRoleNew", "ExportExcel");
  249. // return Json(result);
  250. // }
  251. // #endregion
  252. // }
  253. // }