Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                object User = Session["user"];

                long Id = 0;
                if (User != null)
                {
                }
                else
                {
                    return;
                }
                if (Request.QueryString["uid"] == null)
                {
                    Id = long.Parse(User.ToString());
                }
                else
                {
                    Id = long.Parse(Request.QueryString["uid"].ToString());
                }
                CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();
                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();

                pageInfo.CurrentPage = 1;
                pageInfo.PageSize = 7;
                CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(Id);
                topicList = topic.GetGroupsTopicesByGroupTypeAndAccountId(acc, pageInfo, -2, null, null);

                arrGroupId = new string[topicList.Count];
                CY.UME.Core.Business.TopicExtend te;
                int i = 0;
                foreach (CY.UME.Core.Business.Topic topic2 in topicList)
                {
                    topic2.Title = CY.Utility.Common.StringUtility.CutString(topic2.Title, 24, "...");

                    te = CY.UME.Core.Business.TopicExtend.Load(topic2.Id);
                    arrGroupId[i] = te.InstanceId;
                    i++;
                }
            }
            catch
            {

            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CY.UME.Core.Business.Account currentAccount = CY.UME.Core.Global.GetCurrentAccount();

            if (currentAccount == null)
            {
                return;
            }

            if (!IsPostBack)
            {
                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();

                pageInfo.CurrentPage = 1;
                pageInfo.PageSize = PageSize;

                if (Group != null)
                {
                    IList<CY.UME.Core.Business.Topic> topicListTemp = CY.UME.Core.Business.Topic.GetGroupTopicesByViewNumDesc(Group.Id.ToString(), pageInfo);

                    foreach (CY.UME.Core.Business.Topic topic in topicListTemp)
                    {
                        topic.Title = CY.Utility.Common.StringUtility.CutString(topic.Title, 34, "...");
                    }

                    topicList = topicListTemp;
                }
                else
                {
                    CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();

                    if (isMyGroup)
                    {
                        topicList = topic.GetGroupsTopicesByGroupTypeAndAccountId(currentAccount, pageInfo, type, IsRecommend, IsManage, "DateCreated");
                    }
                    else
                    {
                        topicList = topic.GetGroupsTopicesByGroupTypeAndAccountId(null, pageInfo, type, IsRecommend, IsManage, "DateCreated");
                    }
                }
            }
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int groupId = 0;
            int activeId = 0;
            int currentPage = 0;
            int pageSize = 0;
            CY.UME.Core.Business.Account currentAccount;

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

            if (context.Request.QueryString["groupId"] != null)
            {
                int.TryParse(context.Request.QueryString["groupId"].ToString(), out groupId);
            }

            currentAccount = CY.UME.Core.Global.GetCurrentAccount();

            if (context.Request.QueryString["activeId"] != null)
            {
                int.TryParse(context.Request.QueryString["activeId"], out activeId);
            }
            #endregion

            try
            {
                CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(groupId);

                if (groupId != 0 && group == 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 = new List<CY.UME.Core.Business.Topic>();
                int count = 0;

                if (activeId == 0)
                {//群组话题
                    if (groupId != 0)
                    {
                        topicList = CY.UME.Core.Business.Topic.GetTopicesByGroup(group.Id.ToString(), pageInfo);
                        count = group.GetGroupTopicesNum();
                    }
                    else
                    {
                        CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();
                        topicList = topic.GetGroupsTopicesByGroupTypeAndAccountId(currentAccount, pageInfo, -2, null, null, "DateCreated");
                        count = CY.UME.Core.Business.Topic.GetTopicCountByGroupsWhereAccountIn(currentAccount.Id);
                    }
                }
                else
                {//活动话题
                    topicList = CY.UME.Core.Business.Topic.GetTopicesByActive(activeId.ToString(), pageInfo);
                    count = group.GetGroupTopicesNum();
                }

                StringBuilder sb = new StringBuilder();

                sb.Append("{success:true,Count:" + count + ",Topices:[");

                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:'" + topic.Title + "'");
                    sb.Append(",AccountId:'" + topic.AccountId + "'");
                    sb.Append(",LastReplyDate:'" + topic.LastReplyDate.ToString("yy-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(",GroupName:" + CY.Utility.Common.JavaScriptUtility.ToEscapedJavaScriptString(CY.UME.Core.Business.Group.GetGroupByTopicId(topic.Id.ToString()).Name));
                    sb.Append(",GroupId:" + CY.UME.Core.Business.Group.GetGroupByTopicId(topic.Id.ToString()).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:'服务器忙,请稍后重试。'}");
            }
        }
Esempio n. 4
0
 //绑定我的话题
 private void BindGroupTopics(string loadType, CY.UME.Core.PagingInfo pInfo, string accountId)
 {
     string html = "";
     StringBuilder sb = new StringBuilder();
     sb.Append("<tr>");
     sb.Append("<td width='5' height='29'></td>");
     sb.Append("<td class='li_huati' width='332'>");
     sb.Append("<a href='{0}'>{1}</a>");
     sb.Append("</td>");
     sb.Append("<td class='li_qunzu' width='101'><a href='{2}'>{3}</a></td>");
     sb.Append("<td class='li_huifu' width='111'>{4}</td>");
     sb.Append("<td class='li_huiying' width='90'>{5}</td>");
     sb.Append("</tr>");
     if (loadType.ToLower() == "mygrouptopic")
     {
         CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();
         if (newestTopicList == null)
         {
             newestTopicList = topic.GetGroupsTopicesByGroupTypeAndAccountId(SpaceAccount, pInfo, -2, null, null, "DateCreated");
             HF_TotalRecords.Value =
                 CY.UME.Core.Business.Topic.GetTopicCountByGroupsWhereAccountIn(SpaceAccount.Id).ToString();
             HF_LoadType.Value = loadType.ToLower();
             if (newestTopicList.Count != 0)
             {
                 foreach (CY.UME.Core.Business.Topic topicObj in newestTopicList)
                 {
                     CY.UME.Core.Business.Group group =
                         CY.UME.Core.Business.Group.GetGroupByTopicId(topicObj.Id.ToString());
                     string topicTitle = CY.Utility.Common.StringUtility.CutString(topicObj.Title, 30, "...");
                     html += string.Format(sb.ToString(), SiteUrl + "/Group/TopicDetailInfo.aspx?TopicId=" + topicObj.Id, topicTitle, SiteUrl + "/Group/Group.aspx?groupId=" + group.Id, group.Name, topicObj.ReplyNum + "/" + topicObj.ViewNum, topicObj.LastReplyDate.ToString("yy-MM-dd HH:mm"));
                     ListTopic.Text = html;
                 }
             }
             else
             {
                 return;
             }
         }
     }
     else if (loadType.ToLower() == "mytopic")
     {
         if (topicList == null)
         {
             topicList = CY.UME.Core.Business.Topic.GetMyTopices(SpaceAccount, -1, "group", pInfo);
             HF_TotalRecords.Value = CY.UME.Core.Business.Topic.GetMyTopicesCount(SpaceAccount, -1, "group").ToString();
             HF_LoadType.Value = loadType.ToLower();
             if (topicList.Count != 0)
             {
                 foreach (CY.UME.Core.Business.Topic topic in topicList)
                 {
                     CY.UME.Core.Business.Group group =
                         CY.UME.Core.Business.Group.GetGroupByTopicId(topic.Id.ToString());
                     string topicTitle = CY.Utility.Common.StringUtility.CutString(topic.Title, 40, "...");
                     html += string.Format(sb.ToString(), SiteUrl + "/Group/TopicDetailInfo.aspx?TopicId=" + topic.Id, topicTitle, SiteUrl + "/Group/Group.aspx?groupId=" + group.Id, group.Name, topic.ReplyNum + "/" + topic.ViewNum, topic.LastReplyDate.ToString("yy-MM-dd HH:mm"));
                     ListTopic.Text = html;
                 }
             }
         }
     }
     else if (loadType.ToLower() == "myrelpytopic")
     {
         if (topicList == null)
         {
             topicList = CY.UME.Core.Business.Topic.GetReplyedTopicesByAccount(SpaceAccount, -1, "group", pInfo);
             HF_TotalRecords.Value = CY.UME.Core.Business.Topic.GetReplyedTopicesCountByAccount(SpaceAccount, -1, "group").ToString();
             HF_LoadType.Value = loadType.ToLower();
             if (topicList.Count != 0)
             {
                 foreach (CY.UME.Core.Business.Topic topic in topicList)
                 {
                     CY.UME.Core.Business.Group group =
                         CY.UME.Core.Business.Group.GetGroupByTopicId(topic.Id.ToString());
                     string topicTitle = CY.Utility.Common.StringUtility.CutString(topic.Title, 40, "...");
                     html += string.Format(sb.ToString(), SiteUrl + "/Group/TopicDetailInfo.aspx?TopicId=" + topic.Id, topicTitle, SiteUrl + "/Group/Group.aspx?groupId=" + group.Id, group.Name, topic.ReplyNum + "/" + topic.ViewNum, topic.LastReplyDate.ToString("yy-MM-dd HH:mm"));
                     ListTopic.Text = html;
                 }
             }
         }
     }
 }