/// <summary> /// 根据Identity 获取Email /// </summary> /// <param name="identitys"></param> public static void GetNamesByIdentitys(Innovator inn, Item identitys, ref string names) { if (!identitys.isError() && identitys.getItemCount() > 0) { for (int i = 0; i < identitys.getItemCount(); i++) { Item identityItem = identitys.getItemByIndex(i); string isAlias = identityItem.getProperty("is_alias"); string id = identityItem.getProperty("id"); if (isAlias == "1") { //根据Id 获取邮箱账户 Item userItem = UserDA.GetUserByIdentityId(inn, id); string name = userItem.getProperty("keyed_name"); if (!string.IsNullOrEmpty(name) && names.IndexOf(name) < 0 && name != "Innovator Admin") { names += name + "、"; } } else { Item childIdentity = IdentityDA.GetChildIdentity(inn, id); GetNamesByIdentitys(inn, childIdentity, ref names); } } } }
/// <summary> /// 根据Identity 获取Email /// </summary> /// <param name="identitys"></param> public static void GetEmailByIdentitys(Innovator inn, Item identitys, List <string> listEmail, List <string> names) { if (!identitys.isError() && identitys.getItemCount() > 0) { for (int i = 0; i < identitys.getItemCount(); i++) { Item identityItem = identitys.getItemByIndex(i); string isAlias = identityItem.getProperty("is_alias"); string id = identityItem.getProperty("id"); if (isAlias == "1") { //根据Id 获取邮箱账户 Item userItem = UserDA.GetUserByIdentityId(inn, id); string email = userItem.getProperty("email"); string name = userItem.getProperty("keyed_name"); if (!string.IsNullOrEmpty(name) && names.IndexOf(name) < 0 && name != "Innovator Admin") { names.Add(name); } if (!string.IsNullOrEmpty(email) && listEmail.IndexOf(email) < 0) { listEmail.Add(email); } } else { Item childIdentity = IdentityDA.GetChildIdentity(inn, id); GetEmailByIdentitys(inn, childIdentity, listEmail, names); } } } }
/// <summary> /// 获取审核对象根据委托 /// </summary> /// <param name="userInfo"></param> /// <param name="activityAssignmentId"></param> public static ACTIVITY_ASSIGNMENT GetInnvatorByAgent(Innovator inn, UserInfo userInfo, string activityId, string activityAssignmentId, ref string delegateName) { ACTIVITY_ASSIGNMENT obj = null; AgentAuthEntity agentAuth = null; IDENTITY dentity = IdentityDA.GetIdentityByActivityAssignmentId(activityAssignmentId); if (userInfo.AgentAuth != null) { agentAuth = userInfo.AgentAuth.Where(x => x.agentRoles.Contains(dentity.ID)).FirstOrDefault(); if (agentAuth != null) { delegateName = agentAuth.delegateName; } } //当人员信息权限中没有当前Identity权限 并且 Identity在委托的的权限中存在时!则为委托审核 if (!userInfo.Roles.Contains(dentity.ID) && agentAuth != null) { //获取当前人员的Id Item identity = IdentityDA.GetIdentityByKeyedName(inn, userInfo.UserName); string identityId = identity.getProperty("id"); var ActivityAssignmentItem = ActivityAssignmentDA.GetActivityAssignmentById(inn, activityAssignmentId); int voting_weight = int.Parse(ActivityAssignmentItem.getItemByIndex(0).getProperty("voting_weight")); //修改当前审核权限为0 ActivityAssignmentDA.UpdateActivityAssignmentVotingWeight(inn, activityAssignmentId, 0); //插入委托人员权限 ActivityAssignmentDA.AddActivityAssignment(inn, activityId, identityId, voting_weight); //获取插入权限的ID obj = ActivityAssignmentDA.GetActivity_AssignmentByCondition(activityId, identityId); } return(obj); }
/// <summary> /// 获取当前任务操作人 /// </summary> /// <param name="activityId"></param> /// <returns></returns> public static string GetActivityOperator(Innovator inn, string activityId, bool isClose) { string names = ""; //获取当前任务操作权限 Item identitys = IdentityDA.GetIdentityByActivityId(inn, activityId, isClose); UserDA.GetNamesByIdentitys(inn, identitys, ref names); if (!string.IsNullOrEmpty(names)) { names = names.Substring(0, names.Length - 1); } return(names); }
/// <summary> /// 获取当前任务,登录人的审核权限列表 /// </summary> /// <returns></returns> public static List <string> GetActivityIdentitys(Innovator inn, string activityId, List <string> Roles) { List <string> identitys = new List <string>(); //获取当前任务操作权限 Item identityItems = IdentityDA.GetIdentityByActivityId(inn, activityId); if (!identityItems.isError() && identityItems.getItemCount() > 0) { for (int i = 0; i < identityItems.getItemCount(); i++) { var item = identityItems.getItemByIndex(i); string identityId = item.getProperty("id"); if (Roles.Contains(identityId)) { identitys.Add(identityId); } } } return(identitys); }