Beispiel #1
0
        /// <summary>
        /// 根據用戶等級帶出該USER所能管理的角色   EMP_LEVEL=9 代表超級管理員  1代表可以管理本部門所有角色 0 代表普通用戶
        /// </summary>
        public void SelectRoleByEmp_level(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec sfcdb = null;
            List <c_role_byempl> RoleInfoLevel;
            T_C_ROLE             RoleInfo;
            T_c_user_role        GetRoleID;

            string EMP_LEVEL = this.LoginUser.EMP_LEVEL;
            string FACTORY   = this.LoginUser.FACTORY;
            string BU_NAME   = this.LoginUser.BU;
            string DPT_NAME  = this.LoginUser.DPT_NAME;
            string EDIT_EMP  = Data["EDIT_EMP"].ToString();

            try
            {
                sfcdb     = this.DBPools["SFCDB"].Borrow();
                RoleInfo  = new T_C_ROLE(sfcdb, DBTYPE);
                GetRoleID = new T_c_user_role(sfcdb, DBTYPE);
                List <get_c_roleid> ROLE_ID = GetRoleID.GetRoleID(EDIT_EMP, sfcdb);
                RoleInfoLevel         = RoleInfo.ManageRoleByUser(ROLE_ID, DPT_NAME, BU_NAME, FACTORY, EMP_LEVEL, sfcdb);
                StationReturn.Status  = StationReturnStatusValue.Pass;
                StationReturn.Message = "用戶所的角色獲取成功";
                StationReturn.Data    = RoleInfoLevel;
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根據傳入角色 除掉登錄人能管理的角色中存在和該角色相同的權限ID
        /// </summary>
        public void CheckTwoRolePrivilegeID(Newtonsoft.Json.Linq.JObject requestValue, Newtonsoft.Json.Linq.JObject Data, MESStationReturn StationReturn)
        {
            OleExec            sfcdb = null;
            T_C_ROLE_PRIVILEGE CheckRolePrivilege;
            T_C_ROLE           GetMangeRole;
            List <c_role_privilegeinfobyemp> CheckRolePrivilegeList;
            List <c_role_byempl>             GetMangeRoleList;
            string EDITROLE_ID = Data["EDITROLE_ID"].ToString();

            try
            {
                sfcdb = this.DBPools["SFCDB"].Borrow();
                CheckRolePrivilege = new T_C_ROLE_PRIVILEGE(sfcdb, DBTYPE);
                GetMangeRole       = new T_C_ROLE(sfcdb, DBTYPE);
                GetMangeRoleList   = GetMangeRole.ManageRoleByUser(new List <get_c_roleid>(), this.LoginUser.DPT_NAME, this.LoginUser.BU, this.LoginUser.FACTORY, this.LoginUser.EMP_LEVEL, sfcdb);
                if (GetMangeRoleList.Count == 0)
                {
                    StationReturn.Status  = StationReturnStatusValue.Fail;
                    StationReturn.Message = "無角色能管理";
                    this.DBPools["SFCDB"].Return(sfcdb);
                    return;
                }
                CheckRolePrivilegeList    = CheckRolePrivilege.CheckTwoRolePrivilegeID(GetMangeRoleList, EDITROLE_ID, this.LoginUser.EMP_LEVEL, sfcdb);
                StationReturn.Status      = StationReturnStatusValue.Pass;
                StationReturn.MessageCode = "MES00000026";
                // StationReturn.Message = "獲取成功";
                StationReturn.Data = CheckRolePrivilegeList;
                this.DBPools["SFCDB"].Return(sfcdb);
            }
            catch (Exception e)
            {
                sfcdb.RollbackTrain();
                this.DBPools["SFCDB"].Return(sfcdb);
                throw e;
            }
        }