public JsonResult qryRoleItemHis(string roleId, string aplyNo, string authType) { CodeRoleItemHisDao codeRoleItemHisDao = new CodeRoleItemHisDao(); try { List <CodeRoleItemModel> rows = new List <CodeRoleItemModel>(); rows = codeRoleItemHisDao.qryByAplyNo(aplyNo, authType); if (rows.Count == 0) { CodeRoleItemDao codeRoleItemDao = new CodeRoleItemDao(); rows = codeRoleItemDao.qryForAppr(roleId, authType); } var jsonData = new { success = true, rows }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } catch (Exception e) { logger.Error("其它錯誤:" + e.ToString()); return(Json(new { success = false, err = "其它錯誤,請洽系統管理員!!" })); } }
public ActionResult qryRoleAuth(string roleAuthType, string roleId) { List <authItem> rows = new List <authItem>(); switch (roleAuthType) { case "F": List <RoleFuncHisModel> rowsF = new List <RoleFuncHisModel>(); CodeRoleFunctionDao codeRoleFuncDao = new CodeRoleFunctionDao(); rowsF = codeRoleFuncDao.qryForAppr(roleId); foreach (RoleFuncHisModel d in rowsF) { authItem authItem = new authItem(); authItem.authId = d.cFunctionID; authItem.authDesc = StringUtil.toString(d.cFunctionName); rows.Add(authItem); } break; //var jsonDataF = new { success = true, rows = rowsF }; //return Json(jsonDataF, JsonRequestBehavior.AllowGet); case "E": List <CodeRoleEquipModel> rowsE = new List <CodeRoleEquipModel>(); CodeRoleTreaItemDao codeRoleTreaItemDao = new CodeRoleTreaItemDao(); rowsE = codeRoleTreaItemDao.qryForRoleMgr(roleId); foreach (CodeRoleEquipModel d in rowsE) { authItem authItem = new authItem(); authItem.authId = d.treaEquipId; authItem.authDesc = StringUtil.toString(d.equipName) + ";" + StringUtil.toString(d.controlModeDesc) + ";" + StringUtil.toString(d.custodyModeDesc) + ";" + StringUtil.toString(d.custodyOrder); rows.Add(authItem); } break; //var jsonDataE = new { success = true, rows = rowsE }; //return Json(jsonDataE, JsonRequestBehavior.AllowGet); case "I": case "A": List <CodeRoleItemModel> rowsI = new List <CodeRoleItemModel>(); CodeRoleItemDao codeRoleItemDao = new CodeRoleItemDao(); rowsI = codeRoleItemDao.qryForAppr(roleId, roleAuthType == "I" ? "1" : "2"); foreach (CodeRoleItemModel d in rowsI) { authItem authItem = new authItem(); authItem.authId = d.itemId; authItem.authDesc = StringUtil.toString(d.itemDesc); rows.Add(authItem); } break; //var jsonDataI = new { success = true, rows = rowsI }; //return Json(jsonDataI, JsonRequestBehavior.AllowGet); } var jsonData = new { success = true, rows }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); return(Json(new { success = false, err = "其它錯誤,請洽系統管理員!!" })); }