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
            {

            }
        }
Example #2
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("此活动已被删除");
            }
        }
Example #3
0
        protected void AddTopic_OnClick(object sender, EventArgs e)
        {
            if (TBXTopicName.Text.Trim().Length == 0)
            {
                ShowAlert("提示", "话题名不能为空");
                return;
            }
            else if (TBXTopicName.Text.Trim().Length > 100)
            {
                ShowAlert("提示", "话题名长度不能超过100");
                return;
            }
            if (type == "add")
            {
                int groupId = 0;
                if (ViewState["GroupId"] == null || !int.TryParse(ViewState["GroupId"].ToString(), out groupId))
                {
                    throw new Exception("参数错误");
                }

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

                if (group == null)
                {
                    throw new Exception("参数错误");
                }

                CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();

                topic.Id = System.Guid.NewGuid();
                topic.Title = TBXTopicName.Text.Trim();

                topic.Content = CY.Utility.Common.RequestUtility.GetFormString("wysiwyg");
                topic.DateCreated = DateTime.Now;
                topic.IP = CY.Utility.Common.RequestUtility.ClientIP;
                topic.Level = 0;
                topic.ReplyNum = 0;
                topic.AccountId = CurrentAccount.Id;
                topic.LastReplyDate = topic.DateCreated;
                topic.LastAuthorId = CurrentAccount.Id;

                topic.Save();

                CY.UME.Core.Business.TopicExtend te = new CY.UME.Core.Business.TopicExtend();

                te.AccountId = topic.AccountId;
                te.Id = topic.Id;
                te.InstanceId = group.Id.ToString();
                te.Type = "group";

                te.Save();

                //发送通知
                CurrentAccount.SendNoticeToAllFriendAndFollower("pubtopic","发表了新话题", topic.Id.ToString());

                #region 添加积分

                int addTopicCredit;
                if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditAddTopic", out addTopicCredit) &&
                    (addTopicCredit != 0))
                {
                    DateTime now = DateTime.Now;
                    DateTime startOfDay = new DateTime(now.Year, now.Month, now.Day);
                    int crediteGainCountTodayInSpecificalTopic = CY.UME.Core.Business.CreditHistory.GetCreditHistoryCount(
                        "addtopic", group.CreatorId, CurrentAccount.Id, topic.Id.ToString(), startOfDay, startOfDay.AddDays(1)); // TODO

                    if (crediteGainCountTodayInSpecificalTopic == 0)
                    {
                        CY.UME.Core.Business.Account creator = CY.UME.Core.Business.Account.Load(group.CreatorId);

                        if (creator != null)
                        {
                            int orgCredit = creator.Credit;
                            int modifiedCredit = orgCredit + addTopicCredit;
                            creator.Credit = modifiedCredit;
                            creator.Save();

                            CY.UME.Core.Business.CreditHistory ch = new CY.UME.Core.Business.CreditHistory();
                            ch.AccountId = creator.Id;
                            ch.DateCreated = DateTime.Now;
                            ch.Id = Guid.NewGuid();
                            ch.InstanceId = topic.Id.ToString();
                            ch.Original = orgCredit;
                            ch.Modified = modifiedCredit;
                            ch.Variation = addTopicCredit;
                            ch.Type = "addtopic";
                            ch.AssistAccountId = CurrentAccount.Id;
                            ch.Description = "用户 " + CurrentAccount.Name + "发表了话题 "+topic.Title;
                            ch.Save();
                        }
                    }
                }
                #endregion

                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '发起成功' });window.location.href='Topic.aspx?groupId=" + group.Id + "'</script>");
            }
            else if (type == "edit")
            {
                CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId);

                topic.Title = TBXTopicName.Text.Trim();
                topic.Content = CY.Utility.Common.RequestUtility.GetFormString("wysiwyg");
                topic.DateCreated = DateTime.Now;
                topic.IP = CY.Utility.Common.RequestUtility.ClientIP;
                topic.AccountId = CurrentAccount.Id;
                topic.LastAuthorId = CurrentAccount.Id;
                topic.Save();
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '编辑成功' });window.location.href='TopicDetailInfo.aspx?TopicId=" + topicId + "'</script>");
            }
        }
Example #4
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:'请求出错'}");
            }
        }
        protected void BindData(CY.UME.Core.Business.Group group)
        {
            if (group == null)
            {
                return;
            }

            #region 获取搜索条件

            CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();

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

            int? minViewNum = null, maxViewNum = null, maxReplyNum = null, level = null, minReplyNum = null;
            DateTime? minDate = null, maxDate = null;
            string strTitle, strAuthorName;
            string InstruID = string.Empty;//ID
            string InstruType = string.Empty;//类型

            int minViewNumTemp, maxViewNumTemp, maxReplyNumTemp, levelTemp, minReplyNumTemp;
            DateTime minDateTemp = CY.UME.Core.Global.MinDateTime, maxDateTemp = DateTime.MaxValue;

            if (int.TryParse(minviewnum.Value.Trim(), out minViewNumTemp))
            {
                minViewNum = minViewNumTemp;
            }
            if (int.TryParse(maxviewnum.Value.Trim(), out maxViewNumTemp))
            {
                maxViewNum = maxViewNumTemp;
            }
            if (int.TryParse(maxreplynum.Value.Trim(), out maxReplyNumTemp))
            {
                maxReplyNum = maxReplyNumTemp;
            }
            if (int.TryParse(minreplynum.Value.Trim(), out minReplyNumTemp))
            {
                minReplyNum = minReplyNumTemp;
            }
            if (DateTime.TryParse(minPubDate.Value.Trim(), out minDateTemp))
            {
                minDate = minDateTemp;
            }
            if (DateTime.TryParse(maxPubDate.Value.Trim(), out maxDateTemp))
            {
                maxDate = maxDateTemp;
            }

            strTitle = title.Value.Trim();
            strAuthorName = authorname.Value.Trim();
            InstruID = group.Id.ToString();
            InstruType = "group";

            #endregion
            CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();
            topicList = topic.SearchTopices(InstruID, InstruType, strAuthorName, strTitle, minViewNum, maxViewNum, minReplyNum, maxReplyNum, minDate, maxDate, level, null, pageInfo);

            int count = topic.GetSearchTopicesCount(InstruID, InstruType, strAuthorName, strTitle, minViewNum, maxViewNum, minReplyNum, maxReplyNum, minDate, maxDate, level, null, pageInfo);

            if (count > pageInfo.PageSize)
            {
                IsDisPaged = true;
            }

            //authorname.Value = "";
            //minviewnum.Value = "";
            //maxviewnum.Value = "";
            //minreplynum.Value = "";
            //maxreplynum.Value = "";
            //title.Value = "";

            mgt_HiddenPageSize.Value = "10";
            mgt_HiddenRecordCount.Value = count.ToString();
            mgt_HiddenSiteUrl.Value = SiteUrl;
            mgt_HiddenGroupId.Value = group.Id.ToString();
        }
Example #6
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");
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Guid topicId = new Guid();

                if (Request.QueryString["TopicId"] == null)
                {
                    throw new Exception("您所访问的页面不存在");
                }

                if (Request.QueryString["TopicId"].ToString().Trim().Length == 0)
                {
                    throw new Exception("您所访问的页面不存在");
                }
                else
                {
                    topicId = new Guid(Request.QueryString["TopicId"].ToString().Trim());
                }

                CY.UME.Core.Business.Account author = new CY.UME.Core.Business.Account();

                topic = CY.UME.Core.Business.Topic.Load(topicId);

                CY.UME.Core.Business.TopicExtend te = new CY.UME.Core.Business.TopicExtend();
                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();

                if (topic == null)
                {
                    topic = new CY.UME.Core.Business.Topic();
                    AuthorName = "无";
                    topic.AccountId = 0;
                    topic.Content = "<div style='font-size:18px;'>该话题所属群不存在或已被组长删除。</div>";

                    groupId = 3;//返回默认群,3为Ume创造者。
                }
                else
                {
                    author = CY.UME.Core.Business.Account.Load(topic.AccountId);
                    if (author != null) AuthorName = author.Name;

                    if (CurrentAccount != null)
                    {
                        tdi_HiddenCurrentAccountId.Value = CurrentAccount.Id.ToString();
                    }
                    else
                    {
                        tdi_HiddenCurrentAccountId.Value = "0";
                    }

                    topic.ViewNum += 1;
                    topic.Save();
                    te = CY.UME.Core.Business.TopicExtend.Load(topic.Id);
                    if (te != null) group = CY.UME.Core.Business.Group.Load(int.Parse(te.InstanceId));
                    //if (group == null)
                    //{
                    //    throw new Exception("该话题所属群不存在或已被删除");
                    //}

                    if (group != null) uc_NewestTopices.group = group;

                    bool ismember = group.CheckIsGroupMember(CurrentAccount);
                    bool ismanage = group.CheckIsManager(CurrentAccount);

                    if (group.AddTopicReplyPermission == 0)
                    {
                        topicreply = true;
                    }
                    else if (group.AddTopicReplyPermission == 1)
                    {
                        if (ismember)
                        {
                            topicreply = true;
                        }
                    }
                    groupId = group.Id;
                    AuthorId = te.AccountId;
                    GroupName = group.Name;
                    HF_GroupId.Value = groupId.ToString();

                    int pageSize = 20;
                    int pageNum = 1;

                    CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();
                    pageInfo.CurrentPage = pageNum;
                    pageInfo.PageSize = pageSize;
                    topicReplyList = CY.UME.Core.Business.TopicReply.GetReplyByTopicIdAndPages(topicId, pageInfo);
                    int topicreplycount = CY.UME.Core.Business.TopicReply.GetReplyCountByTopicId(topic.Id);

                    uc_GroupInfo.group = group;
                    tdi_HiddenPageSize.Value = pageSize.ToString();
                    tdi_HiddenRecordsCount.Value = topicreplycount.ToString();
                    tdi_HiddenSiteUrl.Value = SiteUrl;
                    tdi_HiddenTopicId.Value = topic.Id.ToString();

                    int activeId = 0;
                    if (int.TryParse(Request.QueryString["activeId"], out activeId))
                    {//活动
                        CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(activeId);

                        if (active != null) GroupName = active.Name;
                        HF_ActiveId.Value = activeId.ToString();
                    }
                    SetTitle(GroupName + " - 话题");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Guid topicId = new Guid();

                if (Request.QueryString["TopicId"] == null)
                {
                    throw new Exception("您所访问的页面不存在");
                }

                if (Request.QueryString["TopicId"].ToString().Trim().Length == 0)
                {
                    throw new Exception("您所访问的页面不存在");
                }
                else
                {
                    topicId = new Guid(Request.QueryString["TopicId"].ToString().Trim());
                }

                topic = CY.UME.Core.Business.Topic.Load(topicId);

                CY.UME.Core.Business.Account author = CY.UME.Core.Business.Account.Load(topic.AccountId);
                if (author != null)
                {
                    AuthorName = author.Name;
                }

                if (topic == null)
                {
                    throw new Exception("该话题不存在或已被删除");
                }

                if (CurrentAccount != null)
                {
                    tdi_HiddenCurrentAccountId.Value = CurrentAccount.Id.ToString();
                }
                else
                {
                    tdi_HiddenCurrentAccountId.Value ="0";
                }

                CY.UME.Core.Business.TopicExtend te = CY.UME.Core.Business.TopicExtend.Load(topic.Id);
                CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(int.Parse(te.InstanceId));
                if (group == null)
                {
                    throw new Exception("该话题所属群不存在或已被删除");
                }

                groupNavigation1.groupId = group.Id;

                bool ismember = CurrentAccount == null ? false : group.CheckIsGroupMember(CurrentAccount);
                bool ismanage = CurrentAccount == null ? false : group.CheckIsManager(CurrentAccount);
                switch (group.AddPicturePermission)
                {
                    case 0: groupNavigation1.IsShowAddImgBtn = true; break;
                    case 1: if (!ismember)
                        {
                            groupNavigation1.IsShowAddImgBtn = false;
                        } break;
                    case 2: if (!ismember)
                        {
                            groupNavigation1.IsShowAddImgBtn = false;
                        } break;
                }
                switch (group.AddTopicPermission)
                {
                    case 0: groupNavigation1.IsShowAddTopicBtn = true; AddTopicBtn = true; break;
                    case 1: if (!ismember)
                        {
                            groupNavigation1.IsShowAddTopicBtn = false;
                            AddTopicBtn = false;
                        } break;
                    case 2: if (!ismanage)
                        {
                            groupNavigation1.IsShowAddTopicBtn = false;
                            AddTopicBtn = false;
                        } break;
                }
                if (group.AddTopicReplyPermission == 0)
                {
                        topicreply = true;
                }
                else if (group.AddTopicReplyPermission == 1)
                {
                    if (ismember)
                    {
                        topicreply = true;
                    }
                }
                groupId = group.Id;

                int pageSize = 30;
                int pageNum =1;

                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();
                pageInfo.CurrentPage = pageNum;
                pageInfo.PageSize =pageSize;
                topicReplyList = CY.UME.Core.Business.TopicReply.GetReplyByTopicIdAndPages(topicId, pageInfo);
                int topicreplycount  = CY.UME.Core.Business.TopicReply.GetReplyCountByTopicId(topic.Id);

                tdi_HiddenPageSize.Value = pageSize.ToString();
                tdi_HiddenRecordsCount.Value = topicreplycount.ToString();
                tdi_HiddenSiteUrl.Value = SiteUrl;
                tdi_HiddenTopicId.Value = topic.Id.ToString();

                AddViewNum(topic);

                SetTitle(group.Name + "-话题");
            }
        }
Example #9
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>";
            }
        }
Example #10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            int? minViewNum = 0, maxViewNum = 0, maxReplyNum = 0, level = 0, minReplyNum = 0;
            string title, authorName, groupId;
            DateTime? minDate = DateTime.MinValue, maxDate = DateTime.MaxValue;
            int pageSize = 0, pageNum = 0;
            int minViewNumTemp, maxViewNumTemp, maxReplyNumTemp, levelTemp, minReplyNumTemp;
            DateTime minDateTemp = DateTime.MinValue, maxDateTemp = DateTime.MaxValue;
            string InstruID = string.Empty;//ID
            string InstruType = string.Empty;//类型
            #region validate
            if (context.Request.QueryString["type"] != null && context.Request.QueryString["type"].ToString() == "active")
            {
                if (context.Request.QueryString["activeId"] == null || context.Request.QueryString["minViewNum"] == null
                    || context.Request.QueryString["maxViewNum"] == null || context.Request.QueryString["maxReplyNum"] == null
                     || context.Request.QueryString["minReplyNum"] == null
                    || context.Request.QueryString["authorName"] == null || context.Request.QueryString["title"] == null
                    || context.Request.QueryString["minDate"] == null || context.Request.QueryString["maxDate"] == null
                    || context.Request.QueryString["pageSize"] == null || context.Request.QueryString["pageNum"] == null)
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }

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

                if (context.Request.QueryString["maxViewNum"].ToString().Trim().Length == 0)
                {
                    maxViewNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["maxViewNum"].ToString().Trim(), out maxViewNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxViewNum = maxViewNumTemp;
                }

                if (context.Request.QueryString["maxReplyNum"].ToString().Trim().Length == 0)
                {
                    maxReplyNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["maxReplyNum"].ToString().Trim(), out maxReplyNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxReplyNum = maxReplyNumTemp;
                }

                if (context.Request.QueryString["minReplyNum"].ToString().Trim().Length == 0)
                {
                    minReplyNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["minReplyNum"].ToString().Trim(), out minReplyNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    minReplyNum = minReplyNumTemp;
                }

                if (context.Request.QueryString["minDate"].ToString().Trim().Length == 0)
                {
                    minDate = null;
                }
                else if (!DateTime.TryParse(context.Request.QueryString["minDate"].ToString().Trim(), out minDateTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    minDate = minDateTemp;
                }

                if (context.Request.QueryString["maxDate"].ToString().Trim().Length == 0)
                {
                    maxDate = null;
                }
                else if (!DateTime.TryParse(context.Request.QueryString["maxDate"].ToString().Trim(), out maxDateTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxDate = maxDateTemp;
                }
                string activeId = context.Request.QueryString["activeId"].ToString().Trim();
                InstruType = "active";
                InstruID = activeId;
            }
            else
            {
                if (context.Request.QueryString["groupId"] == null
                    || context.Request.QueryString["minViewNum"] == null
                    || context.Request.QueryString["maxViewNum"] == null
                    || context.Request.QueryString["maxReplyNum"] == null
                    || context.Request.QueryString["level"] == null
                    || context.Request.QueryString["minReplyNum"] == null
                    || context.Request.QueryString["authorName"] == null
                    || context.Request.QueryString["title"] == null
                    || context.Request.QueryString["minDate"] == null
                    || context.Request.QueryString["maxDate"] == null
                    || context.Request.QueryString["pageSize"] == null
                    || context.Request.QueryString["pageNum"] == null)
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }

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

                if (context.Request.QueryString["maxViewNum"].ToString().Trim().Length == 0)
                {
                    maxViewNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["maxViewNum"].ToString().Trim(), out maxViewNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxViewNum = maxViewNumTemp;
                }

                if (context.Request.QueryString["maxReplyNum"].ToString().Trim().Length == 0)
                {
                    maxReplyNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["maxReplyNum"].ToString().Trim(), out maxReplyNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxReplyNum = maxReplyNumTemp;
                }

                if (context.Request.QueryString["level"].ToString().Trim().Length == 0)
                {
                    level = null;
                }
                else if (!int.TryParse(context.Request.QueryString["level"].ToString().Trim(), out levelTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    level = levelTemp;
                }

                if (context.Request.QueryString["minReplyNum"].ToString().Trim().Length == 0)
                {
                    minReplyNum = null;
                }
                else if (!int.TryParse(context.Request.QueryString["minReplyNum"].ToString().Trim(), out minReplyNumTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    minReplyNum = minReplyNumTemp;
                }

                if (context.Request.QueryString["minDate"].ToString().Trim().Length == 0)
                {
                    minDate = null;
                }
                else if (!DateTime.TryParse(context.Request.QueryString["minDate"].ToString().Trim(), out minDateTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    minDate = minDateTemp;
                }

                if (context.Request.QueryString["maxDate"].ToString().Trim().Length == 0)
                {
                    maxDate = null;
                }
                else if (!DateTime.TryParse(context.Request.QueryString["maxDate"].ToString().Trim(), out maxDateTemp))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }
                else
                {
                    maxDate = maxDateTemp;
                }
                groupId = context.Request.QueryString["groupId"].ToString().Trim();
                InstruType = "group";
                InstruID = groupId.ToString();
            }

            title = context.Request.QueryString["title"].ToString().Trim();
            authorName = context.Request.QueryString["authorName"].ToString().Trim();

            #endregion

            try
            {
                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();

                pageInfo.CurrentPage = pageNum;
                pageInfo.PageSize = pageSize;

                if (minViewNum > maxViewNum && minViewNum.HasValue && maxViewNum.HasValue)
                {
                    int viewTemp = minViewNum.Value;
                    minViewNum = maxViewNum;
                    maxViewNum = viewTemp;
                }
                if (minReplyNum > maxViewNum && minViewNum.HasValue && maxViewNum.HasValue)
                {
                    int replyTemp = minReplyNum.Value;
                    minReplyNum = maxReplyNum;
                    maxReplyNum = replyTemp;
                }
                if (minDate.HasValue && maxDate.HasValue && DateTime.Compare(minDate.Value, maxDate.Value) > 0)
                {
                    DateTime dateTemp = new DateTime();
                    dateTemp = minDate.Value;

                    minDate = maxDate;
                    maxDate = dateTemp;
                }

                CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();

                List<CY.UME.Core.Business.Topic> topicList = topic.SearchTopices(InstruID, InstruType, authorName, title, minViewNum, maxViewNum, minReplyNum, maxReplyNum, minDate, maxDate, level, null, pageInfo);
                StringBuilder sb = new StringBuilder();

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

                foreach (CY.UME.Core.Business.Topic t in topicList)
                {
                    CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(t.AccountId);
                    string name = String.Empty;
                    long accountId = 0;
                    if (account == null)
                    {
                        name = "该用户不存在";
                    }
                    else
                    {
                        name = account.Name;
                        accountId = account.Id;
                    }

                    sb.Append("{");
                    sb.Append("Id:'" + t.Id + "'");
                    sb.Append(",Title:'" + CY.Utility.Common.StringUtility.EscapeString(CY.Utility.Common.StringUtility.CutString(t.Title, 30, "...")) + "'");
                    sb.Append(",ViewNum:" + t.ViewNum);
                    sb.Append(",ReplyNum:" + t.ReplyNum);
                    sb.Append(",Name:'" + name + "'");
                    sb.Append(",AuthorId:" + accountId);
                    sb.Append(",Date:'" + t.DateCreated.ToString("yyyy-MM-dd HH:mm") + "'");
                    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:'系统忙,请稍后再试!'}");
            }
        }
        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:'服务器忙,请稍后重试。'}");
            }
        }
Example #12
0
        private void BindInfo(Guid topicID)
        {
            topic = CY.UME.Core.Business.Topic.Load(topicID);
            if (topic != null)
            {
                CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(topic.AccountId);
                if (account != null)
                {
                    AuthorName = account.Name;
                }
                else
                {
                    throw new Exception("作者被删除");
                }

                string topicName = topic.Title;
                CY.UME.Core.Business.TopicExtend te = CY.UME.Core.Business.TopicExtend.Load(topicID);
                if (te != null)
                {
                    activeID = CY.Utility.Common.ConvertUtility.ConvertToInt(te.InstanceId, 0);
                    hdActiveId.Value = activeID.ToString();
                    CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(activeID);
                    if (active != null)
                    {
                        activeID = active.Id;
                        ActiveName = active.Name;
                        SetTitle(topicName + "-话题");
                        int pageSize = 15;
                        int pageNum = 1;

                        CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo { CurrentPage = pageNum, PageSize = pageSize };

                        topicReplyList = CY.UME.Core.Business.TopicReply.GetReplyByTopicIdAndPages(topic.Id, pageInfo);
                        int topicreplycount = CY.UME.Core.Business.TopicReply.GetReplyCountByTopicId(topic.Id);
                        hdTopicId.Value = topic.Id.ToString();
                        hdPageSize.Value = pageSize.ToString();
                        hdCount.Value = topicreplycount.ToString();
                        hdSiteUrl.Value = SiteUrl;
                        AddViewNum(topic);

                        base.CSSName = "ume2";
                        member.activeID = activeID;//活动成员
                        PicTop.active = active;
                        if (CurrentAccount != null)
                        {
                            myInfo.SpaceAccount = base.CurrentAccount;
                            //myActive.CurentAccount = CurrentAccount;
                        }
                        memberInGroup.activeID = activeID;
                        InOtherActive.activeID = activeID;
                    }
                    else
                    {
                        throw new Exception("该话题所在活动已被删除");
                    }
                }
                else
                {
                    throw new Exception("该活动已被删除");
                }
            }
            else
            {
                throw new Exception("该活动已被删除");
            }
        }
Example #13
0
        private void SendTopicPermission(CY.UME.Core.Business.Group group)
        {
            CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();

            topic.Id = System.Guid.NewGuid();
            topic.Title = TBXTopicName.Text.Trim();

            topic.Content = CY.Utility.Common.RequestUtility.GetFormString("wysiwyg");
            topic.DateCreated = DateTime.Now;
            topic.IP = CY.Utility.Common.RequestUtility.ClientIP;
            topic.Level = 0;
            topic.ReplyNum = 0;
            topic.AccountId = CurrentAccount.Id;
            topic.LastReplyDate = topic.DateCreated;
            topic.LastAuthorId = CurrentAccount.Id;

            topic.Save();

            CY.UME.Core.Business.TopicExtend te = new CY.UME.Core.Business.TopicExtend();

            string pubType = "pubtopic";

            te.AccountId = topic.AccountId;
            te.Id = topic.Id;

            int.TryParse(Request.QueryString["activeID"], out activeId);
            if (activeId == 0)
            {//群组话题
                te.InstanceId = group.Id.ToString();
                te.Type = "group";
                pubType = "pubtopic";
            }
            else
            {//活动话题
                te.InstanceId = activeId.ToString();
                te.Type = "active";
                pubType = "activeTopic";
            }

            te.Save();

            //发送通知
            CurrentAccount.SendNoticeToAllFriendAndFollower(pubType, "发表了新话题", topic.Id.ToString());

            #region 添加积分

            int addTopicCredit;
            if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditAddTopic", out addTopicCredit) &&
                (addTopicCredit != 0) && (1 == 2))//2010.12.26 由于效率太低,暂时不用了
            {
                DateTime now = DateTime.Now;
                DateTime startOfDay = new DateTime(now.Year, now.Month, now.Day);
                int crediteGainCountTodayInSpecificalTopic = CY.UME.Core.Business.CreditHistory.GetCreditHistoryCount(
                    "addtopic", group.CreatorId, CurrentAccount.Id, topic.Id.ToString(), startOfDay, startOfDay.AddDays(1)); // TODO

                if (crediteGainCountTodayInSpecificalTopic == 0)
                {
                    CY.UME.Core.Business.Account creator = CY.UME.Core.Business.Account.Load(group.CreatorId);

                    if (creator != null)
                    {
                        int orgCredit = creator.Credit;
                        int modifiedCredit = orgCredit + addTopicCredit;
                        creator.Credit = modifiedCredit;
                        creator.Save();

                        CY.UME.Core.Business.CreditHistory ch = new CY.UME.Core.Business.CreditHistory();
                        ch.AccountId = creator.Id;
                        ch.DateCreated = DateTime.Now;
                        ch.Id = Guid.NewGuid();
                        ch.InstanceId = topic.Id.ToString();
                        ch.Original = orgCredit;
                        ch.Modified = modifiedCredit;
                        ch.Variation = addTopicCredit;
                        ch.Type = "addtopic";
                        ch.AssistAccountId = CurrentAccount.Id;
                        ch.Description = "用户 " + CurrentAccount.Name + "发表了话题 " + topic.Title;
                        ch.Save();
                    }
                }
            }
            #endregion

            if (pubType == "pubtopic")
            { //群组
                base.ShowAlert("提示", "发起话题成功<span>3</span>秒后将自动跳转。", true, "Topic.aspx?groupId=" + group.Id, true);
            }
            else
            {//活动
                base.ShowAlert("提示", "发起话题成功<span>3</span>秒后将自动跳转。", true, "Topic.aspx?activeid=" + activeId, true);
                //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('发起成功');window.location.href='Topic.aspx?groupId=" + group.Id + "'</script>");
            }
        }
Example #14
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;
                 }
             }
         }
     }
 }
Example #15
0
        protected void AddTopic_OnClick(object sender, EventArgs e)
        {
            if (TBXTopicName.Text.Trim().Length == 0)
            {
                ShowAlert("提示", "话题名不能为空");
                return;
            }
            else if (TBXTopicName.Text.Trim().Length > 100)
            {
                ShowAlert("提示", "话题名长度不能超过100");
                return;
            }

            if (ViewState["topicId"] == null)
            {
                //新增
                CY.UME.Core.Business.Topic topic = new CY.UME.Core.Business.Topic();

                topic.Id = System.Guid.NewGuid();
                topic.Title = TBXTopicName.Text.Trim();

                topic.Content = CY.Utility.Common.RequestUtility.GetFormString("wysiwyg");
                topic.DateCreated = DateTime.Now;
                topic.IP = CY.Utility.Common.RequestUtility.ClientIP;
                topic.Level = 0;
                topic.ReplyNum = 0;
                topic.AccountId = CurrentAccount.Id;
                topic.LastReplyDate = DateTime.Now;
                topic.LastAuthorId = CurrentAccount.Id;

                topic.Save();

                CY.UME.Core.Business.TopicExtend te = new CY.UME.Core.Business.TopicExtend();

                te.AccountId = topic.AccountId;
                te.Id = topic.Id;
                te.InstanceId = ViewState["ActiveID"].ToString();
                te.Type = "active";

                te.Save();

                //发送通知
                CurrentAccount.SendNoticeToAllFriendAndFollower("activeTopic", "发表了新话题", topic.Id.ToString());
                string activeID = ViewState["ActiveID"].ToString();
                //window.location.href='Topic.aspx?activeId=" + activeID + "'
                //cy.ume.ui.window({ title: '提示', content: '发起成功' });
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '发起成功' });window.location.href='Topic.aspx?activeId=" + activeID + "'</script>");
            }
            else
            {
                //编辑
                Guid topicId = new Guid(ViewState["topicId"].ToString());
                CY.UME.Core.Business.Topic topicEdit = CY.UME.Core.Business.Topic.Load(topicId);
                if (topicEdit != null)
                {
                    topicEdit.Title = TBXTopicName.Text.Trim();
                    topicEdit.Content = CY.Utility.Common.RequestUtility.GetFormString("wysiwyg");
                    topicEdit.Save();

                    //发送通知
                    //CurrentAccount.SendNoticeToAllFriend("activeTopic", "发表了新话题", topic.Id.ToString());
                    //cy.ume.ui.window({ title: '提示', content: '修改成功' });
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '修改成功' });window.location.href='TopDetail.aspx?TopicId=" + topicId + "'</script>");
                    //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '修改成功' });</script>");
                }
            }
        }