/// <summary> /// 删除模块操作权限 /// </summary> /// <param name="id"></param> /// <param name="modules"></param> /// <returns></returns> public JsonResult GroupPower_remove(string id, string modules) { List<PowerGroupPower> list = new List<PowerGroupPower>(); string[] moduless = modules.Split(','); for (int i = 0; i < moduless.Length; i++) { PowerGroupPower en = new PowerGroupPower(); en.groupID = Convert.ToInt32(id); en.moduleID = Convert.ToInt32(moduless[i]); list.Add(en); } DaPowerGroupPower dal = new DaPowerGroupPower(); var result = new CustomJsonResult(); result.Data = dal.delete(list); return result; }
/// <summary> /// 添加模块操作权限 /// </summary> /// <param name="id"></param> /// <param name="modules"></param> /// <returns></returns> public JsonResult GroupPower_add(string id, string modules) { if (modules.Trim() == "") { return null; } List<PowerGroupPower> addList = new List<PowerGroupPower>(); string[] moduless = modules.Split(','); DaPowerGroupPower dal = new DaPowerGroupPower(); IList<PowerGroupPower> groups = dal.getList(id); for (int i = 0; i < moduless.Length; i++) { bool flag = true; for (int j = 0; j < groups.Count; j++) { if (moduless[i] == groups[i].moduleID.ToString()) { flag = false; break; } } if (flag) { PowerGroupPower en = new PowerGroupPower(); en.groupID = Convert.ToInt32(id); en.moduleID = Convert.ToInt32(moduless[i]); en.power = 0; addList.Add(en); } } dal = new DaPowerGroupPower(); dal.add(addList); var result = new CustomJsonResult(); result.Data = 1; return result; }