コード例 #1
0
ファイル: UserMgrController.cs プロジェクト: BiancoLee/BETA
        public ActionResult userHis(String cUserID)
        {
            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();


            //覆核狀態
            var apprStatusList = sysCodeDao.loadSelectList("APPR_STATUS");

            apprStatusList = new SelectList(apprStatusList
                                            .Where(x => x.Value != "4")
                                            .ToList(),
                                            "Value",
                                            "Text");

            ViewBag.apprStatusList = apprStatusList;


            if (!"".Equals(StringUtil.toString(cUserID)))
            {
                UserMgrModel userMgrModel = new UserMgrModel();
                userMgrModel.cUserID = cUserID;
                List <UserMgrModel> rows = qryUserData(userMgrModel);


                ViewBag.cUserID = cUserID;
                return(View(rows[0]));
            }
            else
            {
                return(View());
            }
        }
コード例 #2
0
ファイル: UserMgrController.cs プロジェクト: BiancoLee/BETA
        public ActionResult Index(String userId)
        {
            UserAuthUtil authUtil = new UserAuthUtil();

            String opScope = "";

            String[] roleInfo = authUtil.chkUserFuncAuth(Session["UserID"].ToString(), "~/UserMgr/");
            if (roleInfo != null && roleInfo.Length == 1)
            {
                opScope = "1";
                //roleId = roleInfo[1];
                //funcType = roleInfo[2];
            }


            ViewBag.opScope = opScope;

            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();


            //啟用狀態
            var isDisabledList = sysCodeDao.loadSelectList("IS_DISABLED");

            ViewBag.isDisabledList = isDisabledList;

            //是否寄送MAIL
            var isMailList = sysCodeDao.loadSelectList("YN_FLAG");

            ViewBag.isMailList = isMailList;

            //角色群組
            var roleAuthTypeList = sysCodeDao.loadSelectList("ROLE_AUTH_TYPE");

            ViewBag.roleAuthTypeList = roleAuthTypeList;

            //角色名稱
            CodeRoleDao codeRoleDao  = new CodeRoleDao();
            var         CodeRoleList = codeRoleDao.loadSelectList();

            ViewBag.CodeRoleList = CodeRoleList;

            //異動人員
            CodeUserDao codeUserDao  = new CodeUserDao();
            var         CodeUserList = codeUserDao.loadSelectList();

            ViewBag.CodeUserList = CodeUserList;

            if (userId != null)
            {
                UserMgrModel userMgrModel = new UserMgrModel();
                userMgrModel.cUserID = userId;
                ViewBag.cUserID      = userId;
                return(View(userMgrModel));
            }
            else
            {
                return(View());
            }
        }
コード例 #3
0
ファイル: FuncMgrController.cs プロジェクト: BiancoLee/BETA
        /**
         * 畫面初始
         **/
        public ActionResult Index()
        {
            UserAuthUtil authUtil = new UserAuthUtil();

            String opScope  = "";
            String roleId   = "";
            String funcType = "";

            String[] roleInfo = authUtil.chkUserFuncAuth(Session["UserID"].ToString(), "~/FuncMgr/");
            if (roleInfo != null && roleInfo.Length == 1)
            {
                opScope = "1";// roleInfo[0];
                //roleId = roleInfo[1];
                //funcType = roleInfo[2];
            }


            ViewBag.opScope = opScope;

            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();
            //停用註記
            var FlagList = sysCodeDao.loadSelectList("IS_DISABLED");

            ViewBag.FlagList = FlagList;

            return(View());
        }
コード例 #4
0
        public ActionResult roleHis(String cRoleID)
        {
            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();


            //覆核狀態
            var apprStatusList = sysCodeDao.loadSelectList("APPR_STATUS");

            apprStatusList = new SelectList(apprStatusList
                                            .Where(x => x.Value != "4")
                                            .ToList(),
                                            "Value",
                                            "Text");

            ViewBag.apprStatusList = apprStatusList;

            //角色群組
            var roleAuthTypeList = sysCodeDao.loadSelectList("ROLE_AUTH_TYPE");

            ViewBag.roleAuthTypeList = roleAuthTypeList;


            RoleMgrHisModel roleMgrHisModel = new RoleMgrHisModel();


            if (!"".Equals(StringUtil.toString(cRoleID)))
            {
                CodeRoleDao codeRoleDao = new CodeRoleDao();
                CODE_ROLE   codeRole    = new CODE_ROLE();
                codeRole = codeRoleDao.qryRoleByKey(cRoleID);


                roleMgrHisModel.cRoleID      = StringUtil.toString(codeRole.ROLE_ID);
                roleMgrHisModel.cRoleName    = StringUtil.toString(codeRole.ROLE_NAME);
                roleMgrHisModel.roleAuthType = StringUtil.toString(codeRole.ROLE_AUTH_TYPE);

                ViewBag.cRoleID = cRoleID;
                return(View(roleMgrHisModel));
            }
            else
            {
                return(View());
            }
        }
コード例 #5
0
        ///// <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());
            }
        }
コード例 #6
0
        public ActionResult Index(String cRoleID)
        {
            UserAuthUtil authUtil = new UserAuthUtil();
            String       opScope  = "";
            String       roleId   = "";
            String       funcType = "";

            String[] roleInfo = authUtil.chkUserFuncAuth(Session["UserID"].ToString(), "~/RoleMgr/");
            if (roleInfo != null && roleInfo.Length == 1)
            {
                opScope = "1";
                //roleId = roleInfo[1];
                //funcType = roleInfo[2];
            }


            ViewBag.opScope = opScope;

            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();


            //啟用狀態
            var isDisabledList = sysCodeDao.loadSelectList("IS_DISABLED");

            ViewBag.isDisabledList = isDisabledList;

            //角色群組
            var roleAuthTypeList = sysCodeDao.loadSelectList("ROLE_AUTH_TYPE");

            ViewBag.roleAuthTypeList = roleAuthTypeList;

            //角色名稱
            CodeRoleDao codeRoleDao  = new CodeRoleDao();
            var         CodeRoleList = codeRoleDao.loadSelectList();

            ViewBag.CodeRoleList = CodeRoleList;

            //異動人員
            CodeUserDao codeUserDao  = new CodeUserDao();
            var         CodeUserList = codeUserDao.loadSelectList();

            ViewBag.CodeUserList = CodeUserList;

            RoleMgrModel roleMgrModel = new RoleMgrModel();


            if (!"".Equals(StringUtil.toString(cRoleID)))
            {
                CODE_ROLE codeRole = new CODE_ROLE();
                codeRole = codeRoleDao.qryRoleByKey(cRoleID);


                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.cUpdUserID   = StringUtil.toString(codeRole.LAST_UPDATE_UID);

                ViewBag.cRoleID = cRoleID;
                return(View(roleMgrModel));
            }
            else
            {
                return(View());
            }
        }
コード例 #7
0
        /**
         * 角色資訊(含功能授權)
         **/
        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"));
                }
            }
        }
コード例 #8
0
        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 = "其它錯誤,請洽系統管理員!!" }));
            }
        }
コード例 #9
0
        /// <summary>
        /// 開啟角色修改明細畫面
        /// </summary>
        /// <param name="aplyNo"></param>
        /// <returns></returns>
        public ActionResult detailRole(string aplyNo, string roleId)
        {
            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(roleId);
                    if (authAppr != null)
                    {
                        aplyNo = StringUtil.toString(authAppr.APLY_NO);
                    }

                    ViewBag.bView = "Y";
                }



                AuthReviewRoleModel roleData = new AuthReviewRoleModel();
                roleData.aplyNo    = aplyNo;
                roleData.createUid = authAppr.CREATE_UID;

                OaEmpDao oaEmpDao = new OaEmpDao();
                using (DB_INTRAEntities dbIntra = new DB_INTRAEntities())
                {
                    try
                    {
                        roleData.createUid = roleData.createUid == null ? "" : StringUtil.toString(oaEmpDao.qryByUsrId(roleData.createUid, dbIntra).EMP_NAME);
                    }
                    catch (Exception e)
                    {
                    }
                }
                roleData.createDt    = authAppr.CREATE_DT.ToString();
                roleData.roleName    = "";
                roleData.isDisabled  = "";
                roleData.memo        = "";
                roleData.roleNameB   = "";
                roleData.isDisabledB = "";
                roleData.memoB       = "";


                CodeRoleHisDao CodeRoleHisDao = new CodeRoleHisDao();
                CODE_ROLE_HIS  codeRoleHis    = CodeRoleHisDao.qryByAplyNo(aplyNo);
                if (codeRoleHis != null)
                {
                    execAction = StringUtil.toString(codeRoleHis.EXEC_ACTION);
                }

                if ("".Equals(execAction))
                {
                    CodeRoleDao CodeRoleDao = new CodeRoleDao();
                    CODE_ROLE   codeRole    = new CODE_ROLE();
                    codeRole = CodeRoleDao.qryRoleByKey(authAppr.APPR_MAPPING_KEY);

                    roleData.roleId       = StringUtil.toString(codeRole.ROLE_ID);
                    roleData.roleAuthType = StringUtil.toString(codeRole.ROLE_AUTH_TYPE);
                    roleData.roleNameB    = StringUtil.toString(codeRole.ROLE_NAME);
                    roleData.isDisabledB  = StringUtil.toString(codeRole.IS_DISABLED);
                    roleData.memoB        = StringUtil.toString(codeRole.MEMO);
                }
                else
                {
                    roleData.roleId       = StringUtil.toString(codeRoleHis.ROLE_ID);
                    roleData.roleAuthType = StringUtil.toString(codeRoleHis.ROLE_AUTH_TYPE);

                    if ("A".Equals(execAction))
                    {
                        roleData.roleName   = StringUtil.toString(codeRoleHis.ROLE_NAME);
                        roleData.isDisabled = StringUtil.toString(codeRoleHis.IS_DISABLED);
                        roleData.memo       = StringUtil.toString(codeRoleHis.MEMO);
                    }
                    else
                    {
                        roleData.roleName   = StringUtil.toString(codeRoleHis.ROLE_NAME);
                        roleData.isDisabled = StringUtil.toString(codeRoleHis.IS_DISABLED);
                        roleData.memo       = StringUtil.toString(codeRoleHis.MEMO);

                        roleData.roleNameB   = StringUtil.toString(codeRoleHis.ROLE_NAME_B);
                        roleData.isDisabledB = StringUtil.toString(codeRoleHis.IS_DISABLED_B);
                        roleData.memoB       = StringUtil.toString(codeRoleHis.MEMO_B);
                    }
                }


                SysCodeDao sysCodeDao = new SysCodeDao();
                SYS_CODE   sysCode    = new SYS_CODE();
                sysCode = sysCodeDao.qryByKey("ROLE_AUTH_TYPE", StringUtil.toString(roleData.roleAuthType));
                if (sysCode != null)
                {
                    roleData.roleAuthTypeDesc = StringUtil.toString(sysCode.CODE_VALUE);
                }

                sysCode = sysCodeDao.qryByKey("IS_DISABLED", StringUtil.toString(roleData.isDisabledB));
                if (sysCode != null)
                {
                    roleData.isDisabledB = StringUtil.toString(sysCode.CODE_VALUE);
                }

                sysCode = sysCodeDao.qryByKey("IS_DISABLED", StringUtil.toString(roleData.isDisabled));
                if (sysCode != null)
                {
                    roleData.isDisabled = StringUtil.toString(sysCode.CODE_VALUE);
                }


                ViewBag.bHaveData = "Y";
                ViewBag.aplyNo    = aplyNo;
                return(View(roleData));
            }
            catch (Exception e)
            {
                ViewBag.bHaveData = "N";
                return(View());
            }
        }
コード例 #10
0
ファイル: UserMgrController.cs プロジェクト: BiancoLee/BETA
        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 = "其它錯誤,請洽系統管理員!!" }));
            }
        }
コード例 #11
0
ファイル: UserMgrController.cs プロジェクト: BiancoLee/BETA
        /// <summary>
        /// 使用者資訊codeUser
        /// </summary>
        /// <param name="cUserID"></param>
        /// <returns></returns>
        public ActionResult detailUser(string userId)
        {
            /*---畫面下拉選單初始值---*/
            SysCodeDao sysCodeDao = new SysCodeDao();


            //啟用狀態
            var isDisabledList = sysCodeDao.loadSelectList("IS_DISABLED");

            ViewBag.isDisabledList = isDisabledList;

            //是否寄送MAIL
            var isMailList = sysCodeDao.loadSelectList("YN_FLAG");

            ViewBag.isMailList = isMailList;


            //角色群組
            var roleAuthTypeList = sysCodeDao.jqGridList("ROLE_AUTH_TYPE");

            ViewBag.roleAuthTypeList = roleAuthTypeList;


            ////查詢使用者資訊
            //CodeUserDao codeUserDao = new CodeUserDao();
            //CODEUSER codeUser = codeUserDao.qryByKey(cUserID);


            ////查詢角色
            CodeRoleDao codeRoleDao = new CodeRoleDao();
            var         roleStr     = codeRoleDao.jqGridRoleList("");

            ViewBag.roleList = roleStr;



            //將值搬給畫面欄位
            UserMgrModel userMgrModel = new UserMgrModel();

            if ("".Equals(StringUtil.toString(userId)))
            {
                ViewBag.bHaveData = false;
                return(View(userMgrModel));
            }


            userMgrModel.cUserID = userId;
            List <UserMgrModel> rows = qryUserData(userMgrModel);

            if (rows.Count > 0)
            {
                ViewBag.bHaveData = true;

                //return RedirectToAction("Index", "Home");
                return(View(rows[0]));
            }
            else
            {
                ViewBag.bHaveData = false;
                return(View(userMgrModel));
            }
        }