Exemplo n.º 1
0
        //绑定我的群组
        private void BindMyGroup(CY.UME.Core.Business.Account currentAccount)
        {
            string html = "";
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul>");
            sb.Append("<li><a href='{0}/Group/Group.aspx?groupId={1}'>");
            sb.Append("<img src='{2}/Ajax/Group/GetGroupCover.ashx?gid={3}' style='width:60px;height:60px;' />");
            sb.Append("</a></li>");
            sb.Append("<li><a href='{4}/Group/Group.aspx?groupId={5}' title='{7}'>{6}");
            sb.Append("</a></li>");

            sb.Append("</ul>");
            groupList = new List<CY.UME.Core.Business.Group>();
            if (currentAccount != null)
            {
                myGroupCount = CY.UME.Core.Business.Group.GetGroupsCountByType(-2, currentAccount, null);
                groupList = currentAccount.GetGroupsByType(new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 24 },
                                                           -2);
                if (myGroupCount > 24)
                {
                    for (int i = 0; i < 24; i++)
                    {
                        string groupName = CY.Utility.Common.StringUtility.CutString(groupList[i].Name, 8, "...");
                        html += string.Format(sb.ToString(), SiteUrl, groupList[i].Id, SiteUrl, groupList[i].Id, SiteUrl, groupList[i].Id, groupName,groupList[i].Name);
                        MyGroupId.Text = html;
                    }
                }
                else
                {
                    foreach (CY.UME.Core.Business.Group group in groupList)
                    {
                        string groupName = CY.Utility.Common.StringUtility.CutString(group.Name, 8, "...");
                        html += string.Format(sb.ToString(), SiteUrl, group.Id, SiteUrl, group.Id, SiteUrl, group.Id, groupName, group.Name);
                        MyGroupId.Text = html;
                    }
                }

            }
        }