Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["groupId"] == null)
                {
                    throw new Exception("您访问的页面不存在");
                }

                int GroupId = 0;

                if (!int.TryParse(Request.QueryString["groupId"].ToString(), out GroupId))
                {
                    throw new Exception("您访问的页面不存在");
                }

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

                if (group == null)
                {
                    throw new Exception("您访问的页面不存在");
                }

                int pageSize = 30;

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

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

                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();

                managerList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group, -1, 1, null, new CY.UME.Core.PagingInfo {CurrentPage=1,PageSize=int.MaxValue });
                memberList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group, -1,0, null, pageInfo);
                Count = ag.GetAccountCountByRole(group, 0).ToString();

                uc_GroupInfo.group = group;
                uc_NewestTopices.group = group;

                gm_HiddenGroupId.Value = GroupId.ToString();
                gm_HiddenPageSize.Value = pageSize.ToString();
                gm_HiddenTotalRecords.Value = Count;
                gm_HiddenSiteUrl.Value = SiteUrl;

                SetTitle(group.Name + "的成员列表");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int groupId = 0;
                int role = 0;

                if (Request.QueryString["groupId"] == null || Request.QueryString["role"] == null)
                {
                    throw new Exception("您所访问的页面不存在");
                }
                if (!int.TryParse(Request.QueryString["groupId"].ToString(), out groupId) || !int.TryParse(Request.QueryString["role"].ToString(), out role))
                {
                    throw new Exception("您所访问的页面不存在");
                }

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

                if (group == null)
                {
                    throw new Exception("您所访问的页面不存在");
                }

                int pageSize = 10;

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

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

                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();

                accountList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group, -1 , -1, null, pageInfo);
                string Count = ag.GetAccountCountByRole(group, role).ToString();

                gml_HiddenGroupId.Value = groupId.ToString();
                gml_HiddenPageSize.Value = pageSize.ToString();
                gml_HiddenTotalRecords.Value = Count;
                gml_HiddenRole.Value = role.ToString();

                LblSearchNum.Text = "共" + Count + "个成员";
                LitTitle.Text = "群组成员";

                SetTitle("群组成员");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo();

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

                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group,-1, 2, null, pageInfo);

                foreach (CY.UME.Core.Business.AccountGroup agTemp in agList)
                {
                    CY.UME.Core.Business.Account account = new CY.UME.Core.Business.Account();
                    account = CY.UME.Core.Business.Account.Load(agTemp.AccountId);

                    accountList.Add(account);
                }
            }
        }
Example #4
0
        protected void BindData(CY.UME.Core.Business.Group group)
        {
            int role = 0, pageSize = 30, pageNum = 1;

            if (!int.TryParse(DDLRole.SelectedValue, out role))
            {
                throw new Exception("参数错误");
            }

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

            CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
            agList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group,-1, role, null, pageInfo);

            foreach (CY.UME.Core.Business.AccountGroup agroup in agList)
            {
                if (agroup.AccountId == CurrentAccount.Id)
                {
                    agList.Remove(agroup);

                    break;
                }
            }

            int Count = ag.GetAccountCountByRole(group, role);

            if (Count > pageSize)
            {
                IsDisPaged = true;
            }

            OperationDDL_Bind(DDLRole.SelectedValue);

            mm_HiddenPageSize.Value = pageSize.ToString();
            mm_HiddenSiteUrl.Value = SiteUrl;
            mm_HiddenRecordCount.Value = Count.ToString();
            mm_HiddenGroupId.Value = group.Id.ToString();
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            CY.UME.Core.Business.Account account;
            int pageSize;
            int pageNum;
            int role;
            int groupId = 0;
            CY.UME.Core.Business.Group group;

            #region -Validateion and Get Data -

            account = CY.UME.Core.Global.GetCurrentAccount();
            if (account == null)
            {
                context.Response.Write("{success: false, msg: '用户登录超时,请重新登录!'}");
                return;
            }

            if (!CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.Form["pageSize"], out pageSize) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.Form["pageNum"], out pageNum) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.Form["role"], out role) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.Form["groupId"], out groupId))
            {
                context.Response.Write("{success: false, msg: '搜索参数错误!'}");
                return;
            }

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

            if (group == null)
            {
                context.Response.Write("{success: false, msg: '搜索参数错误!'}");
                return;
            }

            #endregion

            try
            {
                StringBuilder sb = new StringBuilder();
                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> accounts = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group,-2, role, null, new CY.UME.Core.PagingInfo {CurrentPage=pageNum,PageSize=pageSize });

                sb.Append("{success: true,Id:'" + account.Id.ToString() + "', accounts: [");

                CY.UME.Core.Business.University university;
                string universityName = "暂无";
                foreach (CY.UME.Core.Business.AccountGroup agroup in accounts)
                {
                    CY.UME.Core.Business.Account a = CY.UME.Core.Business.Account.Load(agroup.AccountId);
                    if (a == null)
                    {
                        continue;
                    }
                    if (a.ExtendInfo != null && a.ExtendInfo.UniversityId > 0)
                    {
                        university = CY.UME.Core.Business.University.Load(a.ExtendInfo.UniversityId);
                        if (university != null)
                        {
                            universityName = university.Name;
                        }

                    }

                    sb.Append("{Id: ");
                    sb.Append(a.Id);
                    sb.Append(", Name: '");
                    sb.Append( CY.Utility.Common.StringUtility.EscapeString(a.Name));
                    sb.Append("', fs: ");
                    if (account.HasFriendshipWith(a))
                    {
                        sb.Append("true");
                    }
                    else
                    {
                        sb.Append("false");
                    }
                    sb.Append(", univeristyName: '");
                    sb.Append(universityName);
                    sb.Append("'");

                    sb.Append("},");

                }
                if (accounts.Count > 0)
                {
                    sb.Remove(sb.Length - 1, 1);
                }
                sb.Append("]}");

                context.Response.Write(sb.ToString());
            }
            catch
            {
                context.Response.Clear();
                context.Response.Write("{success: false, msg: '服务器忙,请稍后再试!'}");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int pageSize;
            int pageNum;
            int role;
            int groupId = 0;
            CY.UME.Core.Business.Group group;
            CY.UME.Core.Business.Account account;

            #region -Validateion and Get Data -

            account = CY.UME.Core.Global.GetCurrentAccount();
            if (account == null)
            {
                context.Response.Write("{success: false, msg: '用户登录超时,请重新登录!'}");
                return;
            }

            if (!CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.QueryString["pageSize"], out pageSize) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.QueryString["pageNum"], out pageNum) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.QueryString["role"], out role) ||
                !CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.QueryString["groupId"], out groupId))
            {
                context.Response.Write("{success: false, msg: '搜索参数错误!'}");
                return;
            }

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

            if (group == null)
            {
                context.Response.Write("{success: false, msg: '搜索参数错误!'}");
                return;
            }
            #endregion
            try
            {
                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndRoleAndAccountId(group,-1, role, null, new CY.UME.Core.PagingInfo { CurrentPage = pageNum, PageSize = pageSize });
                StringBuilder sb = new StringBuilder();

                sb.Append("{success:true,Members:[");
                foreach (CY.UME.Core.Business.AccountGroup accountGroupTemp in agList)
                {
                    sb.Append("{");
                    sb.Append("Id:" + accountGroupTemp.AccountId);
                    sb.Append(",Name:'" + accountGroupTemp.Name + "'");
                    sb.Append(",AddDate:'" + accountGroupTemp.DateCreated.ToString("yyyy-MM-dd HH:mm") + "'");
                    sb.Append(",LastVisitDate:'" + accountGroupTemp.LastVisitDate.ToString("yyyy-MM-dd HH:mm") + "'");
                    sb.Append("},");
                }

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

                sb.Append("]}");

                context.Response.Write(sb.ToString());
            }
            catch
            {
                context.Response.Write("{success:false,msg:'系统忙,请稍后再试'}");
            }
        }
Example #7
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 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //没登录,或则登录失效
                // Request.QueryString["groupId"].ToString() == "undefined"
                if (Request.QueryString["groupId"] == null
                    && Request.QueryString["urlName"] == null)
                {
                    //throw new Exception("页面不存在");
                }

                int groupId = 0;
                string urlName = String.Empty;

                if (Request.QueryString["groupId"] == null || !int.TryParse(Request.QueryString["groupId"].ToString(), out groupId))
                {
                    urlName = Request.Params["urlName"].ToString();
                    if (urlName.Trim().Length > 0)
                    {
                        group = CY.UME.Core.Business.Group.Load(urlName);

                        groupId = group.Id;
                        string CurrentUrl = SiteUrl + "/Group/" + urlName;//用户登录后转到之前的页面

                        CY.UME.Core.Business.Account.SetCurrentUrl(CurrentUrl);
                    }
                }
                else
                {
                    group = CY.UME.Core.Business.Group.Load(groupId);
                }

                if (group == null)
                {
                    group = new CY.UME.Core.Business.Group();
                    group.Id = 3;
                    throw new Exception("该群组不存在或已被删除");
                }

                if (group.Slogan.Length == 0)
                {
                    //groupSlogn.Text = "为群组和平,为阿凡达的核心理论而结群。我们要团结一心 为争取成为Ume第一群组而努力。加油!加油!加油!";
                    //groupSlogn.Text = "这里显示的是群组精神 赶快让你们的群主把你们的群组精神Show出来!";
                }
                else
                {
                    groupSlogn.Value = group.Slogan;
                }

                string grouphead = String.Empty;
                if (group.HeadPicPath.Length == 0)
                {
                    grouphead = SiteUrl + "/Theme/default/imgs/group_2/topbanner.jpg";
                }
                else
                {
                    grouphead = SiteUrl + group.HeadPicPath;
                }
                //imgGroupHead.ImageUrl = grouphead;

                if (group.UrlName.Length != 0)
                {
                    TxtGroupUrl.Value = group.UrlName;
                }
                else if (CurrentAccount != null && group.CreatorId == CurrentAccount.Id)
                {
                    TxtGroupUrl.Value = "设置自定义域名";
                }

                ismember = group.CheckIsGroupMember(CurrentAccount);
                ismanage = group.CheckIsManager(CurrentAccount);
                HF_IsManager.Value = ismanage.ToString();
                HF_IsMember.Value = ismember.ToString();

                if (CurrentAccount != null && CurrentAccount.Id == group.CreatorId)
                {
                    g_HiddenIsCreator.Value = "1";
                }

                if (group.ViewPermission == 0 && !ismember)
                {
                    //base.ShowAlert("提示","你无权进入"+group.Name+"群!",false,"",false);
                    //Response.Write("<script language='javascript'>alert('你无权进入该群')</script>");
                    Response.Redirect(SiteUrl + "/Group/MyGroups.aspx");
                }

                if (ismember)
                {
                    CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();

                    ag.AddVisit(CurrentAccount, group);
                }

                if (group.MemberNum >= group.MaxMemberNum)
                {
                    hdCaninviteFriend.Value = "false";
                }
                else
                {
                    hdCaninviteFriend.Value = "true";
                }

                if (group.ViewPermission == 1)
                {
                    viewpermission = true;
                }
                else
                {
                    if (!ismember)
                        viewpermission = false;
                    else
                        viewpermission = true;
                }

                if (group.AddPermission == 1 || group.AddPermission == 0)
                {
                    addpermission = true;
                }
                else
                {
                    addpermission = false;
                }

                //群组信息
                LblCreatedDate.Text = group.DateCreated.ToString("yyyy-MM-dd");

                CY.UME.Core.Business.Account creator = CY.UME.Core.Business.Account.Load(group.CreatorId);

                if (creator != null)
                {
                    LblGroupCreator.Text = "<a href='" + SiteUrl + "/Home.aspx?uid=" + creator.Id + "' style='color: rgb(243, 126, 0);' target='_blank'>" + creator.Name + "</a>";
                }

                CY.UME.Core.Business.AccountGroup agroup = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = agroup.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 += "<a href='" + SiteUrl + "/Home.aspx?uid=" + agTemp.AccountId + "' style='color: rgb(243, 126, 0);' rel='Next' target='_blank'>" + agTemp.Name + "</a>" + " ";
                }

                LblGroupManager.Text = strGroupManagers;

                LblGroupMemberNum.Text = agroup.GetGroupMemberCount(group).ToString();
                LblGroupType.Text = group.TypeName;                     //群组类型
                LblGroupName.Text = CY.Utility.Common.StringUtility.CutString(group.Name, 18, "...");
                LblGroupName.ToolTip = group.Name;

                LblTopicCount.Text = group.GetGroupTopicesNum().ToString();

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

                //群组话题
                topicList = CY.UME.Core.Business.Topic.GetTopicesByGroup(group.Id.ToString(), new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = CY.Utility.Common.ConvertUtility.ConvertToInt(HF_DefaultTopicNum.Value, 22) });
                RPT_TopicList.DataSourceID = "";
                RPT_TopicList.DataSource = topicList;
                RPT_TopicList.DataBind();

                //友情小组
                groupList = group.GetRelativeGroup();
                BindFriendList(groupList);

                //群组成员
                groupMemberList = CY.UME.Core.Business.Account.GetAllAccountByGroupId(group.Id, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 12 });
                if (groupMemberList != null)
                {
                    BindGroupMemberList(groupMemberList, 6, 3);
                }

                //好友
                if (CurrentAccount != null)
                {
                    accountList = GetInvitingFriend(groupId);
                }
                string univerSityName = String.Empty;
                StringBuilder sb = new StringBuilder();

                sb.Append("{SiteUrl:'" + SiteUrl + "'");
                sb.Append(",GroupId:" + groupId);
                sb.Append(",Accounts:[");

                int i = 0;
                foreach (CY.UME.Core.Business.Account account in accountList)
                {
                    sb.Append("{Index:" + i);
                    sb.Append(",Name:'" + account.Name + "'");
                    sb.Append(",AccountId:" + account.Id);
                    if (account.UniversityInfo != null)
                    {
                        univerSityName = account.UniversityInfo.Name;
                    }
                    sb.Append(",UniversityName:'" + univerSityName + "'");
                    sb.Append("},");

                    i++;
                }

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

                sb.Append("]}");
                if_HiddenAccountJson.Value = sb.ToString();

                //群组相册
                int albumViewPer = 1;
                if (ismember)
                {
                    albumViewPer = 0;
                }
                albumList = group.GetGroupAlbum(albumViewPer, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 12 });

                if(albumList!=null)
                {
                    BindAlbumList(albumList, 6, 3);
                }

                //群组留言
                Comments = group.GetGroupLevelWords(new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = CY.Utility.Common.ConvertUtility.ConvertToInt(HF_DefaultCommentsNum.Value, 22) });
                GroupLeaveWords.Comments = Comments;
                GroupLeaveWords.group = group;
                GroupLeaveWords.CurrentAccount = CurrentAccount;

                if (group.LeaveWordsPermission == 1)
                {
                    if (!ismember)
                    {
                        leavwordshow = false;
                    }
                }

                g_HiddenSiteUrl.Value = SiteUrl;
                g_HiddenGroupId.Value = group.Id.ToString();
                g_HiddenIsCreator.Value = CurrentAccount == null ? "0" : (CurrentAccount.Id == group.CreatorId) ? "1" : "0";

                SetTitle(group.Name);
            }
        }