/// <summary> /// 用于BUG /// </summary> /// <param name="projectNum"></param> /// <param name="UserID"></param> /// <returns></returns> public bool IsCanEditProjectByProjectNumForBug(String projectNum, String UserID) { bool result = false; if (UserID == "admin") { result = true; } else { //根据项目编号得到项目的Guidid List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("prjNum", projectNum)); Dictionary <String, object> dic1 = this.GetFirstDictionary(condition, "GuidID"); if (dic1 != null && dic1.Count > 0) { String projectGuidID = dic1["GuidID"].ToString(); condition.Clear(); condition.Add(new SearchField("parentGuid", projectGuidID)); condition.Add(new SearchField("UserID", UserID)); condition.Add(new SearchField("PrjRole='0' or PrjRole='3' ", "", SearchOperator.UserDefine)); Tb_Project_PersonBU bu1 = new Tb_Project_PersonBU(); result = bu1.HasData(condition); } } return(result); }
/// <summary> /// 得到当前用户对项目的访问基本权限 0--项目发起人 1--项目经理 2--测试人员 3--其他人员 /// 0---没有权限 /// 1---其他人员 (项目角色为3) /// 2---测试人员 (项目角色为2) /// /// 3---项目经理 (项目角色为1) /// 4---项目发起人 (包括admin 0) /// </summary> /// <param name="ProjectGuidID">项目的GuidID</param> /// <param name="userid">用户id</param> /// <returns></returns> public static int GetProjectClassByUserID(String ProjectGuidID, String userid) { int result = 0; if (userid == "admin") { result = 4; //admin用户 } else { if (String.IsNullOrEmpty(ProjectGuidID) == false) { List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("GuidID", ProjectGuidID)); Dictionary <String, object> dic1 = (new Tb_ProjectBU()).GetFirstDictionary(condition, "Author"); if (dic1 != null && dic1.Count > 0) { if (dic1["Author"].ToString() == userid) { result = 4; //项目发起人 } } //根据项目用户列表进行判断 if (result == 0) { condition.Clear(); dic1.Clear(); condition.Add(new SearchField("parentGuid", ProjectGuidID)); condition.Add(new SearchField("UserID", userid)); Tb_Project_PersonBU bu1 = new Tb_Project_PersonBU(); dic1 = bu1.GetFirstDictionary(condition, "PrjRole"); if (dic1 != null && dic1.Count > 0) { int t1 = 0; int.TryParse(dic1["PrjRole"].ToString(), out t1); result = 4 - t1; } } } } return(result); }
/// <summary> /// 判断用户能否对项目BUG数据进行编辑和修改 /// </summary> /// <param name="projectGuidID"></param> /// <param name="UserID"></param> /// <returns></returns> public bool IsCanEditProjectForBug(String projectGuidID, String UserID) { bool result = false; if (UserID == "admin") { result = true; } else { List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("parentGuid", projectGuidID)); condition.Add(new SearchField("UserID", UserID)); condition.Add(new SearchField("PrjRole='0' or PrjRole='3' ", "", SearchOperator.UserDefine)); Tb_Project_PersonBU bu1 = new Tb_Project_PersonBU(); result = bu1.HasData(condition); } return(result); }