Exemple #1
0
        private void BindInfo(int activeID)
        {
            CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(activeID);
            if (active != null)
            {
                SetTitle(active.Name + "话题");

                hdSiteUrl.Value = base.SiteUrl;
                hdPageSize.Value = "10";
                CY.UME.Core.Business.Topic top = new CY.UME.Core.Business.Topic();
                int count = top.GetTopicesNumByActiveId(active, -1);
                hdCount.Value = count.ToString();
                if (CurrentAccount != null)
                {
                    hdCurrentAccountId.Value = base.CurrentAccount.Id.ToString();
                }
                hdActiveId.Value = activeID.ToString();
            }
            else
            {
                throw new Exception("此活动已被删除");
            }
        }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int activeID = 0;
            int currentPage = 0;
            int pageSize = 0;

            #region validate
            if (context.Request.Params["currentPage"] == null || context.Request.Params["pageSize"] == null || context.Request.Params["activeID"] == null)
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }
            else
            {
                if (!int.TryParse(context.Request.Params["currentPage"].ToString().Trim(), out currentPage) || !int.TryParse(context.Request.Params["pageSize"].ToString().Trim(), out pageSize) || !int.TryParse(context.Request.Params["activeID"].ToString(), out activeID))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
            }
            #endregion

            try
            {
                CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(activeID);

                if (active == null)
                {
                    context.Response.Write("{success:false,msg:'该活动不存在或已被删除'}");
                    return;
                }

                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();
                pageInfo.CurrentPage = currentPage;
                pageInfo.PageSize = pageSize;

                IList<CY.UME.Core.Business.Topic> topicList = CY.UME.Core.Business.Topic.GetTopicesByActive(active.Id.ToString(), pageInfo);
                StringBuilder sb = new StringBuilder();

                sb.Append("{success:true,Topices:[");
                CY.UME.Core.Business.Topic topicTemp = new CY.UME.Core.Business.Topic();

                int count = topicTemp.GetTopicesNumByActiveId(active, -1);

                foreach (CY.UME.Core.Business.Topic topic in topicList)
                {
                    CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(topic.AccountId);
                    if (account == null)
                    {
                        continue;
                    }

                    CY.UME.Core.Business.Account lastAuthor = CY.UME.Core.Business.Account.Load(topic.LastAuthorId);
                    if (lastAuthor == null)
                    {
                        continue;
                    }

                    string accountName = account.Name;//作者名
                    string lastAuthorName = lastAuthor.Name;//最后回复人名

                    sb.Append("{");
                    sb.Append("Title:'" + CY.Utility.Common.StringUtility.CutString(topic.Title, 30, "...") + "'");
                    sb.Append(",AccountId:'" + topic.AccountId + "'");
                    sb.Append(",LastReplyDate:'" + topic.LastReplyDate.ToString("yyyy-MM-dd HH:mm") + "'");
                    sb.Append(",LastAuthorId:'" + topic.LastAuthorId + "'");
                    sb.Append(",LastAuthorName:'" + lastAuthorName + "'");
                    sb.Append(",AccountName:'" + accountName + "'");
                    sb.Append(",ReplyNum:'" + topic.ReplyNum + "'");
                    sb.Append(",ViewNum:'" + topic.ViewNum + "'");
                    sb.Append(",Id:'" + topic.Id + "'");
                    sb.Append("},");
                }

                if (topicList.Count > 0)
                {
                    sb.Remove(sb.Length - 1, 1);
                }

                sb.Append("]}");

                context.Response.Write(sb.ToString());
            }
            catch
            {
                context.Response.Write("{success:false,msg:'请求出错'}");
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string ActiveIdStr = Request.QueryString["activeID"];
            int ActiveId = 0;
            isActive = int.TryParse(ActiveIdStr, out ActiveId);

            if (isActive)
            {//活动

                LblDesc.Text = "活动信息";

                CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(ActiveId);

                if (active == null) return;

                LblGroupName.Text = CY.Utility.Common.StringUtility.CutString(active.Name, 18, "...");
                LblGroupName.ToolTip = active.Name;

                LblGroupCreator.Text = "发起人:<span class=\"orange\"><a href='" + SiteUrl + "/Home.aspx?uid=" + active.Sponsor + "' style='color: rgb(243, 126, 0);' target='_blank'>" + active.SponsorName + "</a></span>";

                LblGroupManager.Text = "主办人:" + active.OrganizerName;

                LblGroupMemberNum.Text = "成员数:" + active.JoinMember;

                //LblGroupType.Text = group.TypeName;

                CY.UME.Core.Business.Topic top = new CY.UME.Core.Business.Topic();
                LblTopicCount.Text = "话题数:" + top.GetTopicesNumByActiveId(active, -1);

                //LblGroupCover.Text = SiteUrl + "/Ajax/Group/GetGroupCover.ashx?gid=" + group.Id.ToString();
                LblGroupCover.Text = "<img alt='" + active.Name + "' title='" + active.Name + "' src='" + (string.IsNullOrEmpty(active.Pic) ? SiteUrl + "/Activities/images/defaultMiddlePic.jpg" : active.Pic) + "' />";

                LblBtnInfo.Text = "<a href=\"" + SiteUrl + "/Group/AddTopic.aspx?activeID=" + active.Id + "\" class=\"Topic_message_butt01\">发起话题</a>&nbsp;<a href=\"" + SiteUrl + "/Activities/ActiveDetail2.aspx?aid=" + active.Id + "\" class=\"Topic_message_butt01\">返回活动</a>";
            }

            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            if (group != null && !isActive)
            {//群组
                //LblCreatedDate.Text = group.DateCreated.ToString("yyyy-MM-dd");

                LblDesc.Text = "群组信息";
                CY.UME.Core.Business.Account creator = CY.UME.Core.Business.Account.Load(group.CreatorId);

                if (creator != null)
                    LblGroupCreator.Text = "组&nbsp;&nbsp;长:<span class=\"orange\"><a href='" + SiteUrl + "/Home.aspx?uid=" + creator.Id + "' style='color: rgb(243, 126, 0);' target='_blank'>" + creator.Name + "</a></span>";

                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group, -2, 1, null, new CY.UME.Core.PagingInfo { PageSize = int.MaxValue, CurrentPage = 1 });
                string strGroupManagers = String.Empty;

                foreach (CY.UME.Core.Business.AccountGroup agTemp in agList)
                    strGroupManagers += "<span class=\"orange\"><a href='" + SiteUrl + "/Home.aspx?uid=" + agTemp.AccountId + "' style='color: rgb(243, 126, 0);' rel='Next' target='_blank'>" + agTemp.Name + "</a></span>" + " ";

                LblGroupManager.Text = "管理员:" + strGroupManagers;

                LblGroupMemberNum.Text = "群成员:" + group.MemberNum.ToString();

                LblGroupName.Text = CY.Utility.Common.StringUtility.CutString(group.Name, 18, "...");
                LblGroupName.ToolTip = group.Name;
                //LblGroupType.Text = group.TypeName;

                LblTopicCount.Text = "话题数:" + group.GetGroupTopicesNum().ToString();

                //LblGroupCover.Text = SiteUrl + "/Ajax/Group/GetGroupCover.ashx?gid=" + group.Id.ToString();
                LblGroupCover.Text = "<img alt='" + group.Name + "' title='" + group.Name + "' src='" + SiteUrl + "/Ajax/Group/GetGroupCover.ashx?gid=" + group.Id + "' />";

                LblBtnInfo.Text = "<a href=\"AddTopic.aspx?groupId=" + group.Id + "\" class=\"Topic_message_butt01\">发起话题</a>&nbsp;<a href=\"group.aspx?groupId=" + group.Id + "\" class=\"Topic_message_butt01\">返回该群</a>";
            }
        }