///// <summary> ///// 開啟使用者修改明細畫面 ///// </summary> ///// <param name="aplyNo"></param> ///// <returns></returns> //public ActionResult detailUser(string cReviewSeq) //{ // try // { // using (DbAccountEntities db = new DbAccountEntities()) // { // CodeUserHisDao codeUserHisDao = new CodeUserHisDao(); // AuthReviewUserModel userData = codeUserHisDao.qryByNowHis(cReviewSeq, db); // string[] cDateTime = userData.cCrtDateTime.Split(' '); // userData.cCrtDateTime = DateUtil.formatDateTimeDbToSc(cDateTime[0] + " " + cDateTime[1], "DT"); // ViewBag.bHaveData = "Y"; // ViewBag.cReviewSeq = cReviewSeq; // return View(userData); // } // } // catch (Exception e) // { // ViewBag.bHaveData = "N"; // return View(); // } //} /// <summary> /// 開啟使用者修改明細畫面 /// </summary> /// <param name="aplyNo"></param> /// <returns></returns> public ActionResult detailUser(string aplyNo, string userId) { try { string execAction = ""; AuthApprDao AuthApprDao = new AuthApprDao(); AUTH_APPR authAppr = new AUTH_APPR(); if (!"".Equals(StringUtil.toString(aplyNo))) { authAppr = AuthApprDao.qryByKey(aplyNo); ViewBag.bView = "N"; } else { authAppr = AuthApprDao.qryByFreeRole(userId); if (authAppr != null) { aplyNo = StringUtil.toString(authAppr.APLY_NO); } ViewBag.bView = "Y"; } AuthReviewUserModel userData = new AuthReviewUserModel(); userData.aplyNo = aplyNo; userData.userId = authAppr.APPR_MAPPING_KEY; userData.createUid = authAppr.CREATE_UID; OaEmpDao oaEmpDao = new OaEmpDao(); using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { try { userData.createUid = userData.createUid == null ? "" : StringUtil.toString(oaEmpDao.qryByUsrId(userData.createUid, dbIntra).EMP_NAME); userData.userName = userData.userId == null ? "" : StringUtil.toString(oaEmpDao.qryByUsrId(userData.userId, dbIntra).EMP_NAME); } catch (Exception e) { } } userData.createDt = authAppr.CREATE_DT.ToString(); SysCodeDao sysCodeDao = new SysCodeDao(); Dictionary <string, string> dicExecAction = sysCodeDao.qryByTypeDic("EXEC_ACTION"); Dictionary <string, string> dicYNFlag = sysCodeDao.qryByTypeDic("YN_FLAG"); CodeUserHisDao codeUserHisDao = new CodeUserHisDao(); CODE_USER_HIS codeUserHis = codeUserHisDao.qryByAplyNo(aplyNo); if (codeUserHis != null) { execAction = StringUtil.toString(codeUserHis.EXEC_ACTION); } if ("".Equals(execAction)) { CodeUserDao codeUserDao = new CodeUserDao(); CODE_USER codeUser = new CODE_USER(); codeUser = codeUserDao.qryUserByKey(authAppr.APPR_MAPPING_KEY); userData.isMailB = StringUtil.toString(codeUser.IS_MAIL); userData.isDisabledB = StringUtil.toString(codeUser.IS_DISABLED); userData.memoB = StringUtil.toString(codeUser.MEMO); } else { if ("A".Equals(execAction)) { userData.isMail = StringUtil.toString(codeUserHis.IS_MAIL); userData.isDisabled = StringUtil.toString(codeUserHis.IS_DISABLED); userData.memo = StringUtil.toString(codeUserHis.MEMO); } else { userData.isMail = StringUtil.toString(codeUserHis.IS_MAIL); userData.isDisabled = StringUtil.toString(codeUserHis.IS_MAIL); userData.memo = StringUtil.toString(codeUserHis.MEMO); userData.isMailB = StringUtil.toString(codeUserHis.IS_MAIL_B); userData.isDisabledB = StringUtil.toString(codeUserHis.IS_DISABLED_B); userData.memoB = StringUtil.toString(codeUserHis.MEMO_B); } } userData.execAction = execAction; userData.execActionDesc = dicExecAction.ContainsKey(userData.execAction) ? dicExecAction[userData.execAction] : userData.execAction; userData.isDisabledDesc = dicYNFlag.ContainsKey(userData.isDisabled) ? dicYNFlag[userData.isDisabled] : userData.isDisabled; userData.isDisabledDescB = dicYNFlag.ContainsKey(userData.isDisabledB) ? dicYNFlag[userData.isDisabledB] : userData.isDisabledB; userData.isMailDesc = dicYNFlag.ContainsKey(userData.isMail) ? dicYNFlag[userData.isMail] : userData.isMail; userData.isMailDescB = dicYNFlag.ContainsKey(userData.isMailB) ? dicYNFlag[userData.isMailB] : userData.isMailB; ViewBag.bHaveData = "Y"; ViewBag.aplyNo = aplyNo; return(View(userData)); } catch (Exception e) { ViewBag.bHaveData = "N"; return(View()); } }
public ActionResult qryRoleHisData(string cRoleID, string apprStatus, string updDateB, string updDateE) { if ("".Equals(StringUtil.toString(cRoleID))) { return(Json(new { success = false, err = "角色代號未輸入!!" })); } SysCodeDao sysCodeDao = new SysCodeDao(); Dictionary <string, string> dicExecAction = sysCodeDao.qryByTypeDic("EXEC_ACTION"); Dictionary <string, string> dicYNFlag = sysCodeDao.qryByTypeDic("YN_FLAG"); Dictionary <string, string> dicApprStatus = sysCodeDao.qryByTypeDic("APPR_STATUS"); Dictionary <string, string> dicIsDisabled = sysCodeDao.qryByTypeDic("IS_DISABLED"); List <CodeRoleModel> roleHisList = new List <CodeRoleModel>(); List <RoleFuncHisModel> roleFuncHisList = new List <RoleFuncHisModel>(); List <CodeRoleEquipModel> roleEquipHisList = new List <CodeRoleEquipModel>(); List <CodeRoleItemModel> roleRoleItemHisList = new List <CodeRoleItemModel>(); List <CodeRoleItemModel> roleItemHisList = new List <CodeRoleItemModel>(); List <CodeRoleItemModel> roleFormAplyHisList = new List <CodeRoleItemModel>(); CodeRoleHisDao codeRoleHisDao = new CodeRoleHisDao(); CodeRoleFuncHisDao codeRoleFuncHisDao = new CodeRoleFuncHisDao(); CodeRoleTreaItemHisDao codeRoleTreaItemHisDao = new CodeRoleTreaItemHisDao(); CodeRoleItemHisDao codeRoleItemHisDao = new CodeRoleItemHisDao(); try { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { using (dbTreasuryEntities db = new dbTreasuryEntities()) { roleHisList = codeRoleHisDao.qryForRoleMgrHis(db, cRoleID, apprStatus, updDateB, updDateE); roleFuncHisList = codeRoleFuncHisDao.qryForRoleMgrHis(db, cRoleID, apprStatus, updDateB, updDateE); roleEquipHisList = codeRoleTreaItemHisDao.qryForRoleMgrHis(db, cRoleID, apprStatus, updDateB, updDateE); roleRoleItemHisList = codeRoleItemHisDao.qryForRoleMgrHis(db, cRoleID, apprStatus, updDateB, updDateE); } } using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { Dictionary <string, string> userNameMap = new Dictionary <string, string>(); OaEmpDao oaEmpDao = new OaEmpDao(); string apprUid = ""; string userId = ""; //處理角色資訊人員&代碼 if (roleHisList != null) { foreach (CodeRoleModel role in roleHisList) { role.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(role.execAction)) ? dicExecAction[StringUtil.toString(role.execAction)]:""; role.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(role.apprStatus)) ? dicApprStatus[StringUtil.toString(role.apprStatus)]:""; role.isDisabledDesc = dicIsDisabled.ContainsKey(StringUtil.toString(role.isDisabled)) ? dicIsDisabled[StringUtil.toString(role.isDisabled)]:""; role.isDisabledDescB = dicIsDisabled.ContainsKey(StringUtil.toString(role.isDisabledB)) ? dicIsDisabled[StringUtil.toString(role.isDisabledB)]:""; userId = StringUtil.toString(role.updateUid); if (!"".Equals(userId)) { if (!userNameMap.ContainsKey(userId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userId, dbIntra); } role.updateUid = userNameMap[userId]; } apprUid = StringUtil.toString(role.apprUid); if (!"".Equals(apprUid)) { if (!userNameMap.ContainsKey(apprUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, apprUid, dbIntra); } role.apprUid = userNameMap[apprUid]; } } } //處理授權功能人員&代碼 if (roleFuncHisList != null) { foreach (RoleFuncHisModel d in roleFuncHisList) { d.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(d.execAction)) ? dicExecAction[StringUtil.toString(d.execAction)] : ""; d.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(d.apprStatus)) ? dicApprStatus[StringUtil.toString(d.apprStatus)] : ""; userId = StringUtil.toString(d.updateUid); if (!"".Equals(userId)) { if (!userNameMap.ContainsKey(userId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userId, dbIntra); } d.updateUid = userNameMap[userId]; } apprUid = StringUtil.toString(d.apprUid); if (!"".Equals(apprUid)) { if (!userNameMap.ContainsKey(apprUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, apprUid, dbIntra); } d.apprUid = userNameMap[apprUid]; } } } //處理金庫設備人員&代碼 if (roleEquipHisList != null) { foreach (CodeRoleEquipModel d in roleEquipHisList) { d.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(d.execAction)) ? dicExecAction[StringUtil.toString(d.execAction)] : ""; d.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(d.apprStatus)) ? dicApprStatus[StringUtil.toString(d.apprStatus)] : ""; userId = StringUtil.toString(d.updateUid); if (!"".Equals(userId)) { if (!userNameMap.ContainsKey(userId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userId, dbIntra); } d.updateUid = userNameMap[userId]; } apprUid = StringUtil.toString(d.apprUid); if (!"".Equals(apprUid)) { if (!userNameMap.ContainsKey(apprUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, apprUid, dbIntra); } d.apprUid = userNameMap[apprUid]; } } } //處理"存取項目/表單申請"人員&代碼 if (roleRoleItemHisList != null) { foreach (CodeRoleItemModel d in roleRoleItemHisList) { d.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(d.execAction)) ? dicExecAction[StringUtil.toString(d.execAction)] : ""; d.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(d.apprStatus)) ? dicApprStatus[StringUtil.toString(d.apprStatus)] : ""; userId = StringUtil.toString(d.updateUid); if (!"".Equals(userId)) { if (!userNameMap.ContainsKey(userId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userId, dbIntra); } d.updateUid = userNameMap[userId]; } apprUid = StringUtil.toString(d.apprUid); if (!"".Equals(apprUid)) { if (!userNameMap.ContainsKey(apprUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, apprUid, dbIntra); } d.apprUid = userNameMap[apprUid]; } } roleItemHisList = roleRoleItemHisList.Where(x => x.authType == "1").ToList(); roleFormAplyHisList = roleRoleItemHisList.Where(x => x.authType == "2").ToList(); } } return(Json(new { success = true, roleHisList = roleHisList, roleFuncHisList = roleFuncHisList, roleEquipHisList = roleEquipHisList , roleItemHisList = roleItemHisList, roleFormAplyHisList = roleFormAplyHisList })); } catch (Exception e) { logger.Error("[qryEquip]:" + e.ToString()); return(Json(new { success = false, err = "其它錯誤,請洽系統管理員!!" })); } }
/** * 角色資訊(含功能授權) **/ public ActionResult detailRole(string cRoleId, string execType) { /*---畫面下拉選單初始值---*/ //金庫設備 TreaEquipDao treaEquipDao = new TreaEquipDao(); ViewBag.equipList = treaEquipDao.jqgridSelect(); //存取項目 TreaItemDao treaItemDao = new TreaItemDao(); ViewBag.itemList = treaItemDao.jqgridSelect(""); SysCodeDao sysCodeDao = new SysCodeDao(); //停用註記 var isDisabledList = sysCodeDao.loadSelectList("IS_DISABLED"); ViewBag.isDisabledList = isDisabledList; //角色群組 var roleAuthTypeList = sysCodeDao.loadSelectList("ROLE_AUTH_TYPE"); ViewBag.roleAuthTypeList = roleAuthTypeList; //控管模式 var controlList = sysCodeDao.loadSelectList("CONTROL_MODE"); ViewBag.controlList = controlList; //ViewBag.controlList = sysCodeDao.jqGridList("CONTROL_MODE"); //控管方式 var custodyList = sysCodeDao.loadSelectList("CUSTODY_MODE"); ViewBag.custodyList = custodyList; //ViewBag.custodyList = sysCodeDao.jqGridList("CUSTODY_MODE"); //入庫作業類型 ViewBag.itemOpTypeList = sysCodeDao.jqGridList("ITEM_OP_TYPE"); //覆核狀態 add by daiyu 20180214 Dictionary <string, string> dicReview = sysCodeDao.qryByTypeDic("DATA_STATUS"); //查詢角色資訊 CodeRoleDao codeRoleDao = new CodeRoleDao(); CODE_ROLE codeRole = new CODE_ROLE(); if (cRoleId != null) { codeRole = codeRoleDao.qryRoleByKey(cRoleId); } //將值搬給畫面欄位 RoleMgrModel roleMgrModel = new RoleMgrModel(); qryUserFunc(cRoleId); //取得已授權、未授權功能清單 if (!"".Equals(StringUtil.toString(codeRole.ROLE_ID))) { roleMgrModel.cRoleID = StringUtil.toString(codeRole.ROLE_ID); roleMgrModel.cRoleName = StringUtil.toString(codeRole.ROLE_NAME); roleMgrModel.roleAuthType = StringUtil.toString(codeRole.ROLE_AUTH_TYPE); roleMgrModel.isDisabled = StringUtil.toString(codeRole.IS_DISABLED); roleMgrModel.vMemo = StringUtil.toString(codeRole.MEMO); roleMgrModel.dataStatus = StringUtil.toString(codeRole.DATA_STATUS) == "" ? "" : codeRole.DATA_STATUS + "." + dicReview[codeRole.DATA_STATUS]; roleMgrModel.cCrtDateTime = codeRole.CREATE_DT == null ? "" : DateUtil.DatetimeToString(codeRole.CREATE_DT, ""); roleMgrModel.cUpdDateTime = codeRole.LAST_UPDATE_DT == null ? "" : DateUtil.DatetimeToString(codeRole.LAST_UPDATE_DT, ""); OaEmpDao oaEmpDao = new OaEmpDao(); using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { try { roleMgrModel.cCrtUserID = codeRole.CREATE_UID == null ? "" : StringUtil.toString(oaEmpDao.qryByUsrId(codeRole.CREATE_UID, dbIntra).EMP_NAME); } catch (Exception e) { } try { roleMgrModel.cUpdUserID = codeRole.LAST_UPDATE_UID == null ? "" : StringUtil.toString(oaEmpDao.qryByUsrId(codeRole.LAST_UPDATE_UID, dbIntra).EMP_NAME); } catch (Exception e) { } } roleMgrModel.Categories = ViewBag.funcList; ViewBag.bHaveData = "Y"; //return RedirectToAction("Index", "Home"); return(View(roleMgrModel)); } else { if ("A".Equals(execType)) { qryUserFunc(""); //取得已授權、未授權功能清單 roleMgrModel.cRoleID = ""; roleMgrModel.cRoleName = ""; roleMgrModel.isDisabled = "N"; roleMgrModel.vMemo = ""; roleMgrModel.cCrtUserID = ""; roleMgrModel.cCrtDateTime = ""; roleMgrModel.cUpdUserID = ""; roleMgrModel.cUpdDateTime = ""; roleMgrModel.dataStatus = ""; roleMgrModel.Categories = ViewBag.funcList; ViewBag.bHaveData = "Y"; return(View(roleMgrModel)); } else { ViewBag.bHaveData = "N"; return(View("detailRole")); } } }
public ActionResult qryUserHisData(string userId, string apprStatus, string updDateB, string updDateE) { if ("".Equals(StringUtil.toString(userId))) { return(Json(new { success = false, err = "使用者帳號未輸入!!" })); } SysCodeDao sysCodeDao = new SysCodeDao(); Dictionary <string, string> dicExecAction = sysCodeDao.qryByTypeDic("EXEC_ACTION"); Dictionary <string, string> dicYNFlag = sysCodeDao.qryByTypeDic("YN_FLAG"); Dictionary <string, string> dicApprStatus = sysCodeDao.qryByTypeDic("APPR_STATUS"); Dictionary <string, string> dicIsDisabled = sysCodeDao.qryByTypeDic("IS_DISABLED"); List <CodeUserHisModel> userHisList = new List <CodeUserHisModel>(); List <UserRoleHisModel> userRoleHisList = new List <UserRoleHisModel>(); CodeUserHisDao codeUserHisDao = new CodeUserHisDao(); CodeUserRoleHisDao codeUserRoleHisDao = new CodeUserRoleHisDao(); try { using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted })) { using (dbTreasuryEntities db = new dbTreasuryEntities()) { userHisList = codeUserHisDao.qryForUserMgrHis(db, userId, apprStatus, updDateB, updDateE); userRoleHisList = codeUserRoleHisDao.qryForUserMgrHis(db, userId, apprStatus, updDateB, updDateE); } } using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { Dictionary <string, string> userNameMap = new Dictionary <string, string>(); OaEmpDao oaEmpDao = new OaEmpDao(); string createUid = ""; string updId = ""; //處理角色資訊人員&代碼 if (userHisList != null) { foreach (CodeUserHisModel d in userHisList) { d.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(d.execAction)) ? dicExecAction[StringUtil.toString(d.execAction)] : ""; d.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(d.apprStatus)) ? dicApprStatus[StringUtil.toString(d.apprStatus)] : ""; d.isDisabledDesc = dicIsDisabled.ContainsKey(StringUtil.toString(d.isDisabled)) ? dicIsDisabled[StringUtil.toString(d.isDisabled)] : ""; d.isDisabledDescB = dicIsDisabled.ContainsKey(StringUtil.toString(d.isDisabledB)) ? dicIsDisabled[StringUtil.toString(d.isDisabledB)] : ""; d.isMailDesc = dicYNFlag.ContainsKey(StringUtil.toString(d.isMail)) ? dicYNFlag[StringUtil.toString(d.isMail)] : ""; d.isMailDescB = dicYNFlag.ContainsKey(StringUtil.toString(d.isMailB)) ? dicYNFlag[StringUtil.toString(d.isMailB)] : ""; updId = StringUtil.toString(d.updateUid); if (!"".Equals(updId)) { if (!userNameMap.ContainsKey(updId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, updId, dbIntra); } d.updateUid = userNameMap[updId]; } } } //處理使用者角色異動資訊人員&代碼 if (userRoleHisList != null) { foreach (UserRoleHisModel d in userRoleHisList) { d.execActionDesc = dicExecAction.ContainsKey(StringUtil.toString(d.execAction)) ? dicExecAction[StringUtil.toString(d.execAction)] : ""; d.apprStatusDesc = dicApprStatus.ContainsKey(StringUtil.toString(d.apprStatus)) ? dicApprStatus[StringUtil.toString(d.apprStatus)] : ""; updId = StringUtil.toString(d.updateUid); if (!"".Equals(updId)) { if (!userNameMap.ContainsKey(updId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, updId, dbIntra); } d.updateUid = userNameMap[updId]; } } } } return(Json(new { success = true, userHisList = userHisList, userRoleHisList = userRoleHisList })); } catch (Exception e) { logger.Error("[qryUserHisData]:" + e.ToString()); return(Json(new { success = false, err = "其它錯誤,請洽系統管理員!!" })); } }