Example #1
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"));
                }
            }
        }
Example #2
0
        /// <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));
            }
        }