public object GetGroupInfo(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(P2PGroupManager.GetGroup(provider, cn, groupid)); } } }
public static BPMObjectNameCollection GetNotifyUsers(YZResourceType resType, string resId) { BPMObjectNameCollection uids = new BPMObjectNameCollection(); switch (resType) { case YZResourceType.Group: using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { MemberCollection members = GroupManager.GetGroupMembers(provider, cn, Int32.Parse(resId)); foreach (Member member in members) { uids.Add(member.UID); } } } break; case YZResourceType.SingleChat: using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { P2PGroup.P2PGroup group = P2PGroupManager.GetGroup(provider, cn, Int32.Parse(resId)); uids.Add(group.Account1); uids.Add(group.Account2); } } break; case YZResourceType.Task: using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { uids = NotifyManager.GetNotifyUsersTaskSocial(provider, cn, Int32.Parse(resId)); } } break; } return(uids); }
protected virtual void PostProcessNotifyTopic(IYZDbProvider provider, IDbConnection cn, BPMConnection bpmcn, string loginUserAccount, DataRow row, bool countUsers) { JObject jExt = new JObject(); row["ext"] = jExt; YZResourceType resType = (YZResourceType)Enum.Parse(typeof(YZResourceType), Convert.ToString(row["resType"]), true); row["resType"] = resType.ToString(); if (row.Table.Columns.Contains("uid")) { string uid = Convert.ToString(row["uid"]); User user = User.TryGetUser(bpmcn, uid); jExt["UserShortName"] = user == null ? uid : user.ShortName; } switch (resType) { case YZResourceType.Task: BPMTask task = BPMTask.Load(bpmcn, Int32.Parse(Convert.ToString(row["resId"]))); ProcessProperty property = BPMProcess.GetProcessProperty(bpmcn, task.ProcessName, task.ProcessVersion); string owner = YZStringHelper.GetUserShortName(task.OwnerAccount, task.OwnerDisplayName); row["resName"] = String.Format(Resources.YZStrings.All_BPM_Task_Title_FMT, owner, task.ProcessName); jExt["ProcessName"] = task.ProcessName; jExt["Owner"] = owner; jExt["Color"] = property.Color; jExt["ShortName"] = property.ShortName; if (String.IsNullOrEmpty(property.ShortName)) { jExt["ShortName"] = YZStringHelper.GetProcessDefaultShortName(task.ProcessName); } break; case YZResourceType.Group: Group.Group group = GroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"]))); row["resName"] = group.Name; jExt["GroupType"] = group.GroupType; jExt["ImageFileID"] = group.ImageFileID; if (countUsers) { jExt["MemberCount"] = GroupManager.GetGroupMemberCount(provider, cn, group.GroupID); } break; case YZResourceType.SingleChat: P2PGroup.P2PGroup p2pGroup = P2PGroupManager.GetGroup(provider, cn, Int32.Parse(Convert.ToString(row["resId"]))); row["resName"] = p2pGroup.GetGroupName(bpmcn, loginUserAccount); jExt["P2PPeerAccount"] = p2pGroup.GetPeerAccount(loginUserAccount); jExt["FolderID"] = p2pGroup.FolderID; break; case YZResourceType.TaskApproved: row["resName"] = Resources.YZStrings.Aspx_Message_Title_Approved; break; case YZResourceType.TaskRejected: row["resName"] = Resources.YZStrings.Aspx_Message_Title_Rejected; break; default: break; } }