public JsonResult LoadData(string codeRole, string roleAuthType, string isDIsabled, string vMemo, string cUpdUserID) { CodeRoleDao codeRoleDao = new CodeRoleDao(); OaEmpDao oaEmpDao = new OaEmpDao(); List <RoleMgrModel> rows = new List <RoleMgrModel>(); rows = codeRoleDao.roleMgrQry(codeRole, roleAuthType, isDIsabled, vMemo, cUpdUserID); Dictionary <string, string> userNameMap = new Dictionary <string, string>(); string userUId = ""; string userFId = ""; using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { foreach (RoleMgrModel role in rows) { userUId = StringUtil.toString(role.cUpdUserID); userFId = StringUtil.toString(role.freezeUid); if (!"".Equals(userUId)) { if (!userNameMap.ContainsKey(userUId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userUId, dbIntra); } role.cUpdUserID = userUId + " " + userNameMap[userUId]; } if (!"".Equals(userFId)) { if (!userNameMap.ContainsKey(userFId)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, userFId, dbIntra); } role.freezeUid = userFId + " " + userNameMap[userFId]; } } } } var jsonData = new { success = true, rows }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public JsonResult qryUserRole(string userId) { CodeUserRoleDao CodeUserRoleDao = new CodeUserRoleDao(); List <CodeUserRoleModel> rows = CodeUserRoleDao.qryByUserID(userId); using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { Dictionary <string, string> userNameMap = new Dictionary <string, string>(); OaEmpDao oaEmpDao = new OaEmpDao(); string createUid = ""; foreach (CodeUserRoleModel d in rows) { createUid = StringUtil.toString(d.createUid); if (!"".Equals(createUid)) { if (!userNameMap.ContainsKey(createUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, createUid, dbIntra); } d.createUid = createUid + " " + userNameMap[createUid]; } } } var jsonData = new { success = true, roleList = rows }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadData(String cReviewType) { AuthApprDao authApprDao = new AuthApprDao(); List <AuthReviewModel> rows = new List <AuthReviewModel>(); using (new TransactionScope( TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) { using (dbTreasuryEntities db = new dbTreasuryEntities()) { try { //查出待覆核的資料 rows = authApprDao.qryAuthReview("R", "1", db); } catch (Exception e) { logger.Error("其它錯誤:" + e.ToString()); return(Json(new { success = false, err = "其它錯誤,請洽系統管理員!!" })); } } } using (DB_INTRAEntities dbIntra = new DB_INTRAEntities()) { Dictionary <string, string> userNameMap = new Dictionary <string, string>(); OaEmpDao oaEmpDao = new OaEmpDao(); string createUid = ""; foreach (AuthReviewModel d in rows) { createUid = StringUtil.toString(d.createUid); if (!"".Equals(createUid)) { if (!userNameMap.ContainsKey(createUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, createUid, dbIntra); } d.createUid = createUid + " " + userNameMap[createUid]; } } } var jsonData = new { success = true, rows }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); }
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 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 = "其它錯誤,請洽系統管理員!!" })); } }
private List <UserMgrModel> qryUserData(UserMgrModel userMgrModel) { CodeUserDao codeUserDao = new CodeUserDao(); List <UserMgrModel> rows = codeUserDao.qryUserMgr(userMgrModel); using (DB_INTRAEntities db = new DB_INTRAEntities()) { OaEmpDao oaEmpDao = new OaEmpDao(); for (int i = 0; i < rows.Count; i++) { rows[i] = oaEmpDao.getUserOaData(rows[i], db); Dictionary <string, string> userNameMap = new Dictionary <string, string>(); if (!"".Equals(StringUtil.toString(rows[i].cCrtUserID))) { if (!"".Equals(rows[i].cCrtUserID)) { if (!userNameMap.ContainsKey(rows[i].cCrtUserID)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, rows[i].cCrtUserID, db); } rows[i].cCrtUserID = rows[i].cCrtUserID + " " + userNameMap[rows[i].cCrtUserID]; } } if (!"".Equals(StringUtil.toString(rows[i].cUpdUserID))) { if (!"".Equals(rows[i].cUpdUserID)) { if (!userNameMap.ContainsKey(rows[i].cUpdUserID)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, rows[i].cUpdUserID, db); } rows[i].cUpdUserID = rows[i].cUpdUserID + " " + userNameMap[rows[i].cUpdUserID]; } } if (!"".Equals(StringUtil.toString(rows[i].apprUid))) { if (!"".Equals(rows[i].apprUid)) { if (!userNameMap.ContainsKey(rows[i].apprUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, rows[i].apprUid, db); } rows[i].apprUid = rows[i].apprUid + " " + userNameMap[rows[i].apprUid]; } } if (!"".Equals(StringUtil.toString(rows[i].frezzeUid))) { if (!"".Equals(rows[i].frezzeUid)) { if (!userNameMap.ContainsKey(rows[i].frezzeUid)) { userNameMap = oaEmpDao.qryUsrName(userNameMap, rows[i].frezzeUid, db); } rows[i].frezzeUid = rows[i].frezzeUid + " " + userNameMap[rows[i].frezzeUid]; } } } } bool bcUserName = StringUtil.isEmpty(userMgrModel.cUserName); if (!bcUserName) { rows = rows.Where(x => x.cUserName == userMgrModel.cUserName).ToList(); } return(rows); }