/// <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="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> //public static string CompleteActivity(Innovator inn, string strAML) //{ // Item resItem = inn.applyAML(strAML); // if (resItem.isError()) return resItem.getErrorString(); // return ""; //} /// <summary> /// 完成任务 /// </summary> /// <param name="activityId">任务ID</param> /// <param name="activityAssignmentId">权限ID</param> /// <param name="path">选择路线</param> /// <param name="delegateTo">委托到</param> /// <returns></returns> public static string CompleteActivity(Innovator inn, string activityId, string activityAssignmentId, string pathId, string pathName, string delegateTo, string comments, UserInfo userInfo = null) { if (userInfo != null && string.IsNullOrEmpty(delegateTo)) { string delegateName = ""; ACTIVITY_ASSIGNMENT activity_assignment = WorkFlowDA.GetInnvatorByAgent(inn, userInfo, activityId, activityAssignmentId, ref delegateName); if (activity_assignment != null) { activityAssignmentId = activity_assignment.ID; comments = "使用 " + delegateName + " 代理权限审核完成。备注:" + comments; } } //获取委托的ID string delegateToId = ""; if (!string.IsNullOrEmpty(delegateTo)) { delegateToId = UserDA.GetUserByKeyedName(delegateTo).ID; } string MD5Auth = ""; string AuthMode = ""; var strAML = "<AML><Item type='Activity' action='EvaluateActivity'>"; strAML += "<Activity>" + activityId + "</Activity>"; strAML += "<ActivityAssignment>" + activityAssignmentId + "</ActivityAssignment>"; strAML += "<Paths>"; strAML += "<Path id='" + pathId + "'>" + pathName + "</Path>"; strAML += "</Paths>"; strAML += "<DelegateTo>" + delegateToId + "</DelegateTo>"; strAML += "<Tasks>"; strAML += "</Tasks>"; strAML += "<Variables></Variables>"; strAML += "<Authentication mode='" + AuthMode + "'>" + MD5Auth + "</Authentication>"; strAML += "<Comments>" + comments + "</Comments>"; strAML += "<Complete>1</Complete>"; strAML += "</Item></AML>"; Item resItem = inn.applyAML(strAML); if (resItem.isError()) { return(resItem.getErrorString()); } return(""); }