/// <summary> /// 验证WBS结构下是否可增加角色 /// </summary> /// <param name="roleDefine">岗位角色定义</param> /// <returns>boolean值</returns> public bool ValidateRoleDefine(S_D_RoleDefine roleDefine) { if (this.S_T_WBSStructRole.FirstOrDefault(d => d.WBSStructID == this.ID && d.RoleCode == roleDefine.RoleCode) == null) { return(false); } else { return(true); } }
/// <summary> /// 增加角色定义 /// </summary> /// <param name="roleDefine">角色定义对象</param> public void AddRoleInfo(S_D_RoleDefine roleDefine) { if (this.S_T_WBSStructRole.FirstOrDefault(d => d.RoleCode == roleDefine.RoleCode) != null) { return; } var roleInfo = new S_T_WBSStructRole(); roleInfo.ID = FormulaHelper.CreateGuid(); roleInfo.RoleCode = roleDefine.RoleCode; roleInfo.RoleName = roleDefine.RoleName; roleInfo.RoleRelation = roleDefine.RoleRelation; roleInfo.RoleType = roleDefine.RoleType; roleInfo.SychProject = false.ToString(); roleInfo.SychWBS = false.ToString(); roleInfo.Multi = true.ToString(); roleInfo.SortIndex = this.S_T_WBSStructRole.Count + 1; this.S_T_WBSStructRole.Add(roleInfo); }
void addRbsDt(UserInfo userInfo, DataTable rbsDt, DataRow wbsRow, S_D_RoleDefine roleDefine) { if (userInfo == null) { return; } var rbsNewRow = rbsDt.NewRow(); rbsNewRow["WBSID"] = wbsRow["ID"]; rbsNewRow["WBSCode"] = wbsRow["Code"]; rbsNewRow["WBSType"] = wbsRow["WBSType"]; if (wbsRow["WBSType"].ToString() == WBSNodeType.Major.ToString()) { rbsNewRow["MajorValue"] = wbsRow["WBSValue"]; } rbsNewRow["ProjectInfoID"] = wbsRow["ProjectInfoID"]; rbsNewRow["RoleCode"] = roleDefine.RoleCode; rbsNewRow["RoleName"] = roleDefine.RoleName; rbsNewRow["UserID"] = userInfo.UserID; rbsNewRow["UserName"] = userInfo.UserName; rbsNewRow["UserDeptID"] = userInfo.UserOrgID; rbsNewRow["UserDeptName"] = userInfo.UserOrgName; rbsDt.Rows.Add(rbsNewRow); }
/// <summary> /// 为空间设置项目角色的权限 /// </summary> /// <param name="roleDefine">项目角色定义对象</param> /// <param name="authType">权限级别(默认完全控制)</param> /// <param name="dynValue">动态值类别(默认为全部)</param> /// <param name="includeChildren">子节点是否继承</param> public void SetProjectRole(S_D_RoleDefine roleDefine, string authType, bool includeChildren = true) { this.SetProjectRole(roleDefine.RoleCode, authType, includeChildren); }