Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int groupId = 0;

            if (context.Request.Form["groupId"] == null)
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }
            if (!int.TryParse(context.Request.Form["groupId"], out groupId))
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }

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

            if(currentAccount==null)
            {
                context.Response.Write("{success:false,msg:'登录超时失败,请重新登录'}");
                return;
            }

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

            if (group == null)
            {
                context.Response.Write("{success:false,msg:'您所在的群不存在或已被删除'}");
                return;
            }

            try
            {
                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList;

                if (currentAccount.Id != group.CreatorId)
                {
                    agList = ag.GetAccountGroupByGroupIdAndAccountId(currentAccount, group);

                    CY.UME.Core.Business.AccountGroup aGroup = CY.UME.Core.Business.AccountGroup.Load(agList[0].Id);

                    aGroup.DeleteOnSave();
                    aGroup.Save();
                }
                else
                {
                    group.IsChecked = false;
                    group.Save();
                }

                context.Response.Write("{success:true}");
            }
            catch
            {
                context.Response.Write("{success:false,msg:'系统忙,请稍后再试'}");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 提交权限设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            //lblMsg.Text = CheckCheckBoxFile(Repeater1, lblMsg, "chkState", "HFAccountGroupId");

            String strId = CheckCheckBoxFile(Repeater1, lblMsg, "chkState", "HFAccountGroupId");// 成员Id
            String Role = DDLRole.SelectedValue;

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

            ag.UpdateAccountGroupRoleByStrId(Role, strId);
            bind(HFId.Value, HFRole.Value, false);// 修改成功重新绑定一下.
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["groupId"] == null)
            {
                throw new Exception("参数错误");
            }

            if (!int.TryParse(Request.QueryString["groupId"].ToString(), out groupId))
            {
                throw new Exception("参数错误");
            }

            CY.UME.Core.Business.Group 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.UrlName.Length >= 1)
            {
                setgroupindivi.Visible = false;
            }
            TBXUrlName.Text = group.UrlName;

            if (!IsPostBack)
            {
                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByAccountIdOrGroupId(CurrentAccount.Id, groupId);
                if (agList.Count == 0 || agList[0].Role != 1)
                {
                    throw new Exception("您无权访问该页面");
                }

                headPicPath = group.HeadPicPath;
                groupSlogan.Value = group.Slogan;
                groupPlaCard.Value = group.PlaCard;

                HF_GroupId.Value = groupId.ToString();

                SetTitle(group.Name + "-群组管理");
            }

            base.CSSName = "ume2";
            SetTitle(group.Name + "-个性化设置");
        }
Esempio n. 4
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 + "的成员列表");
            }
        }
Esempio n. 5
0
        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("群组成员");
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 填充页面列表
        /// </summary>
        /// <param name="source">数据源</param>
        /// <param name="viewCount">显示总数,显示所有为null</param>
        /// <param name="rowCount">每行显示数量,默认null,显示6条</param>
        /// <returns></returns>
        public static String GetList(IList<CY.UME.Core.Business.Group> source, Int32 viewCount, Int32 rowCount)
        {
            if (viewCount == -1)
                viewCount = source.Count;

            if (rowCount == -1)
                rowCount = 6;

            String result = "";

            if (viewCount > source.Count)
                viewCount = source.Count;

            StringBuilder bulder = new StringBuilder();

            for (int i = 1; i <= viewCount; i++)
            {
                CY.UME.Core.Business.AccountGroup agroup = new CY.UME.Core.Business.AccountGroup();
                CY.UME.Core.Business.Group group = source[i - 1];

                if ((i - 1) % rowCount == 0)
                    bulder = new StringBuilder();//new row

                if (group != null)
                    bulder.Append("<li><a href='Group.aspx?groupId=" + group.Id + "' title='" + group.Name + "' >"
                                   + "<img src='" + SiteUrl() + "/Ajax/Group/GetGroupCover.ashx?gid=" + group.Id
                                   + "' style='width:60px; height:60px; margin:0 auto;'/></a>"
                                   + "<br/><a href='Group.aspx?groupId=" + group.Id + "' title='" + group.Name + "' >" + CY.Utility.Common.StringUtility.CutString(group.Name, 14, "...") + "</a>(" + agroup.GetGroupMemberCount(group) + ")</li>");

                if (i % rowCount == 0)
                {
                    result = result + "<div style='width:690px; margin:0 auto; height:100px'><ul class='pic'>"
                        + bulder.ToString() + "</ul></div>";
                }
                else
                {
                    if (i == viewCount)
                        result = result + "<div style='width:690px; margin:0 auto; height:100px'><ul class='pic'>"
                        + bulder.ToString() + "</ul></div>";
                }
            }
            return result;
        }
        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);
                }
            }
        }
Esempio n. 8
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();
        }
Esempio n. 9
0
        /// <summary>
        /// 获取群组成员
        /// </summary>
        private string GetGroupMemberInfo(CY.UME.Core.Business.Group group)
        {
            #region validate
            if (group == null)
            {
                return "[]";
            }
            #endregion

            try
            {
                CY.UME.Core.Business.AccountGroup ae = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> aList = ae.GetAccountGroupByAccountIdOrGroupId(0, group.Id);

                StringBuilder sb = new StringBuilder();
                CY.UME.Core.Business.AccountExtend accountExtendTemp;

                sb.Append("[");
                foreach (CY.UME.Core.Business.AccountGroup ag in aList)
                {
                    accountExtendTemp = CY.UME.Core.Business.AccountExtend.Load(ag.AccountId);
                    sb.Append("{");
                    sb.Append("\"Id\":\"" + ag.AccountId + "\"");
                    sb.Append(",\"Name\":\"" + ag.Name + "\"");
                    sb.Append(",\"Phone\":\"" + (accountExtendTemp == null ? "" : accountExtendTemp.Telephone) + "\"");
                    sb.Append("},");
                }

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

                return sb.ToString();
            }
            catch
            {
                return "[]";
            }
        }
Esempio n. 10
0
        protected void Submit_OnClick(object sender, EventArgs e)
        {
            string[] accountIdArray = mm_HiddenMember.Value.Split(',');
            long accountId = 0;
            int groupId = 0, role = 0;

            if (!int.TryParse(mm_HiddenGroupId.Value, out groupId))
            {
                throw new Exception("参数错误");
            }

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

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

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

            if (role != 0 && role != 1 && role != -1)
            {
                throw new Exception("参数错误");
            }

            foreach (string strAccountId in accountIdArray)
            {
                if (!long.TryParse(strAccountId, out accountId))
                {
                    continue;
                }

                CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(accountId);

                if (account == null)
                {
                    continue;
                }

                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndAccountId(account, group);

                if (agList.Count > 0)
                {
                    ag = CY.UME.Core.Business.AccountGroup.Load(agList[0].Id);
                }

                if (role == -1)
                {
                    ag.DeleteOnSave();
                }
                else
                {
                    ag.Role = role;
                }

                ag.Save();
            }

            BindData(group);
        }
Esempio n. 11
0
        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:'系统忙,请稍后再试'}");
            }
        }
Esempio n. 12
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int groupId = 0;
            CY.UME.Core.Business.Account currentAccount;

            #region validate
            if (context.Request.Params["groupId"] == null )
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }

            if (!int.TryParse(context.Request.Params["groupId"].ToString(), out groupId))
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }

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

            if (currentAccount == null)
            {
                context.Response.Write("{success:false,msg:'用户登录超时失败,请重新登录'}");
                return;
            }
            #endregion

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

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

                if (group.MaxMemberNum <= group.MemberNum)
                {
                    context.Response.Write("{success:false,msg:'该群组已达最大人数上限'}");
                    return;
                }

                //标识群组邀请通知已读
                IList<CY.UME.Core.Business.Notice> noticeList = CY.UME.Core.Business.Notice.GetNoticeByTypeAndInstanceId(currentAccount, false, "groupinvite", groupId.ToString(), new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = int.MaxValue });

                foreach (CY.UME.Core.Business.Notice notice in noticeList)
                {
                    CY.UME.Core.Business.Notice noticeTemp = CY.UME.Core.Business.Notice.Load(notice.Id);

                    noticeTemp.IsReaded = true;
                    noticeTemp.Save();
                }
                if (noticeList.Count > 0)
                {
                    CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                    IList<CY.UME.Core.Business.AccountGroup> accountGroupList = ag.GetAccountGroupByGroupIdAndAccountId(currentAccount, group);

                    if (accountGroupList.Count == 0)
                    {
                        ag.AccountId = currentAccount.Id;
                        ag.DateCreated = DateTime.Now;
                        ag.GroupId = groupId;
                        ag.LastVisitDate = DateTime.Now;
                        ag.Name = currentAccount.Name;
                        ag.Role = 0;

                        ag.Save();
                    }
                }

                context.Response.Write("{success:true,GroupName:'"+group.Name+"'}");
            }
            catch
            {
                context.Response.Write("{success:false,msg:'请稍后,系统忙'}");
            }
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (CurrentAccount == null)
            //{
            //    Response.Redirect("~/Login2.aspx");
            //    return;
            //}

            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("该班级或群组不存在或已被删除");
                }

                bool ismember = CurrentAccount == null ? false : group.CheckIsGroupMember(CurrentAccount);
                bool ismanage = CurrentAccount == null ? false : group.CheckIsManager(CurrentAccount);
                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";
                }

                placard.group = group;//公告
                newestTopices1.Group = group;//新话题
                newestTopices1.PageSize = 10;
                hotTopices1.group = group;//最热话题
                groupStatistics1.group = group;//群组概况
                groupMembers1.group = group;//群组成员
                groupLeaveWords1.group = group;//群组留言
                if (ismanage)
                {
                    groupNavigation1.IsShowActiveBtn = true;//发起新活动
                }
                if (!ismanage)
                {
                    membersWaitForHandled1.Visible = false;
                }
                if (CurrentAccount != null)
                {
                    hotPictures1.group = group;//热门图片
                }
                membersWaitForHandled1.group = group;//待处理成员列表

                if (CurrentAccount != null)
                {
                    groupMenu1.IsManager = ismanage;
                    groupMenu1.IsGroupMember = ismember;
                    groupMenu1.IsClass = (group.Type == 0);
                }

                groupNavigation1.groupId = group.Id;
                if (group.Type == 0)
                {
                    groupNavigation1.IsShowAddGroupBtn = false;
                    groupNavigation1.IsShowApp = false;
                    groupMenu1.IsShowAddTopicBtn = false;//GroupMenu.ascx页面的 发贴连接
                }
                switch (group.AddPicturePermission)
                {
                    case 0: groupNavigation1.IsShowAddImgBtn = true; break;
                    case 1: if (ismember)
                        {
                            groupNavigation1.IsShowAddImgBtn = true;
                        } break;
                    case 2: if (ismanage)
                        {
                            groupNavigation1.IsShowAddImgBtn = true;
                        } break;
                }
                switch (group.AddTopicPermission)
                {
                    case 0: groupNavigation1.IsShowAddTopicBtn = true; break;
                    case 1: if (ismember)
                        {
                            groupNavigation1.IsShowAddTopicBtn = true;
                        } break;
                    case 2: if (ismanage)
                        {
                            groupNavigation1.IsShowAddTopicBtn = true;
                        } break;
                }

                if (CurrentAccount != null)
                {
                    groupLeaveWords1.CurrentAccount = CurrentAccount;//群组留言
                    groupLeaveWords1.IsGroupHome = true;
                }
                if (group.ViewPermission == 1)
                {
                    viewpermission = true;
                }
                else
                {
                    if (!ismember)
                    {
                        viewpermission = false; hotPictures1.group = null; this.groupNavigation1.IsShowNav = false;
                    }
                    else
                    {
                        viewpermission = true;
                    }
                }
                if (group.AddPermission == 1 || group.AddPermission ==0)
                {
                    addpermission = true;
                }
                else
                {
                    addpermission = false; if (!ismember) { this.groupMenu1.Visible = 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);
            }
        }
Esempio n. 14
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>";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                long Id = 0;
                CurrentAccount = CY.UME.Core.Global.GetCurrentAccount();
                if (CurrentAccount == null)
                {
                    Response.Redirect("../Login.aspx");
                    return;
                }
                //this.hiduserid.Value = currentacc.Id.ToString();

                uaccountex = CY.UME.Core.Business.AccountExtend.Load(Id);
                CY.UME.Core.Business.Account currentacc = CY.UME.Core.Business.Account.Load(Id);

                if (uaccountex != null && !uaccountex.IsNew)
                {
                    IList<CY.UME.Core.Business.Friendship> fslist = CY.UME.Core.Business.Friendship.GetAccountRequestList(currentacc);
                    IList<CY.UME.Core.Business.AccountExtend> sameinterlist = CY.UME.Core.Business.AccountExtend.GetInterFrendsByAccountExtend(uaccountex);
                    IList<CY.UME.Core.Business.AccountExtend> classmatelist = CY.UME.Core.Business.AccountExtend.GetClassMateByAccountExtend(uaccountex);
                    groups = CY.UME.Core.Business.Group.GetCommendGroup(uaccountex);

                    if (sameinterlist != null && sameinterlist.Count != 0)
                    {
                        if (fslist != null && fslist.Count != 0)
                        {
                            for (int i = 0; i < sameinterlist.Count; i++)
                            {
                                for (int j = 0; j < fslist.Count; j++)
                                {
                                    if (sameinterlist[i].Id == fslist[j].FriendId)
                                    {
                                        sameinterlist.Remove(sameinterlist[i]);
                                        i = i - 1;
                                        break;
                                    }
                                }
                            }
                        }
                        sameinterlist = sameinterlist.Take(6).ToList();
                        for (int i = 0; i < sameinterlist.Count; i++)
                        {
                            CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(sameinterlist[i].Id);
                            if (acc != null && !acc.IsNew)
                            {
                                sameinter.Add(acc);
                            }
                        }
                    }
                    if (classmatelist != null && classmatelist.Count != 0)
                    {
                        if (fslist != null && fslist.Count != 0)
                        {
                            for (int i = 0; i < classmatelist.Count; i++)
                            {
                                for (int j = 0; j < fslist.Count; j++)
                                {
                                    if (classmatelist[i].Id == fslist[j].FriendId)
                                    {
                                        classmatelist.Remove(classmatelist[i]);
                                        i = i - 1;
                                        break;
                                    }
                                }
                            }
                        }
                        classmatelist = classmatelist.Take(6).ToList();
                        for (int j = 0; j < classmatelist.Count; j++)
                        {
                            CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(classmatelist[j].Id);
                            if (acc != null && !acc.IsNew)
                            {
                                classmate.Add(acc);
                            }
                        }
                    }
                    if (groups != null && groups.Count != 0)
                    {
                        CY.UME.Core.Business.AccountGroup accgroup = new CY.UME.Core.Business.AccountGroup();
                        IList<CY.UME.Core.Business.AccountGroup> accgrouplist = accgroup.GetAccountGroupByAccountIdOrGroupId(Id, 0);
                        if (accgrouplist != null && accgrouplist.Count != 0)
                        {
                            for (int i = 0; i < groups.Count; i++)
                            {
                                for (int j = 0; j < accgrouplist.Count; j++)
                                {
                                    if (groups[i].Id == accgrouplist[j].GroupId)
                                    {
                                        groups.Remove(groups[i]);
                                        i = i - 1;
                                        break;
                                    }
                                }
                            }
                        }
                        groups = groups.Take(6).ToList();
                    }
                }
            }
            catch
            {
                return;
            }
        }
Esempio n. 16
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            #region validate
            if (context.Request.Params["groupId"] == null)
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }
            string groupIds = context.Request.Params["groupId"];
            string id = context.Request.Params["id"];
            string[] groupIdsstr = groupIds.Split(',');
            string json = string.Empty;
            if (groupIds != null && id != null)
            {
                CY.UME.Core.Business.Account acc = CY.UME.Core.Business.Account.Load(long.Parse(id));
            #endregion

                try
                {
                    json = "{success:true,msg:' ";
                    for (int i = 0; i < groupIdsstr.Length; i++)
                    {
                        CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(int.Parse(groupIdsstr[i]));
                        CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                        IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndAccountId(acc, group);
                        if (agList != null && agList.Count != 0)
                        {
                            if (agList[0].Role == 2)
                            {
                                context.Response.Write("{success:true,msg:'你已经发送过申请,请等候'}");
                                return;
                            }
                            else
                            {
                                context.Response.Write("{success:true,msg:'你已经加入了该群组'}");
                                return;
                            }
                        }

                        if (group.MaxMemberNum <= group.MemberNum)
                        {
                            continue;
                        }

                        if (group.AddPermission == 0)//需群主验证加入
                        {
                            CY.UME.Core.Business.AccountGroup agTemp = new CY.UME.Core.Business.AccountGroup();

                            agTemp.AccountId = acc.Id;
                            agTemp.DateCreated = DateTime.Now;
                            agTemp.GroupId = group.Id;
                            agTemp.Name = acc.Name;
                            agTemp.Role = 2;

                            agTemp.Save();
                            json += "加入申请已发出 ";
                            continue;
                        }
                        else if (group.AddPermission == 1)//任何人可以加入
                        {
                            CY.UME.Core.Business.AccountGroup accountGroup = new CY.UME.Core.Business.AccountGroup();

                            accountGroup.AccountId = acc.Id;
                            accountGroup.DateCreated = DateTime.Now;
                            accountGroup.GroupId = group.Id;
                            accountGroup.Name = acc.Name;
                            accountGroup.Role = 0;

                            accountGroup.Save();

                            group.MemberNum++;
                            group.Save();
                            json += "加入成功 ";
                            continue;

                        }
                        else if (group.AddPermission == 2)//只能由群主邀请加入
                        {
                            json += "该群只能由群组邀请加入 ";
                            continue;
                        }

                    }
                    json += "'}";
                    context.Response.Write(json);
                    return;
                }
                catch
                {
                    context.Response.Write("{success:false,msg:'服务器忙,请稍后再试'}");
                    return;
                }
            }
        }
Esempio n. 17
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);
            }
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["groupId"] == null)
            {
                throw new Exception("参数错误");
            }

            if (!int.TryParse(Request.QueryString["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("参数错误");
            }

            if (group.Type == 0)
            {
                IsClass = true;
            }

            gm_HiddenSiteUrl.Value = SiteUrl;
            gm_HiddenGroupId.Value = groupId.ToString();

            if (!IsPostBack)
            {
                CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();
                IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByAccountIdOrGroupId(CurrentAccount.Id, groupId);
                if (agList.Count == 0 || agList[0].Role != 1)
                {
                    throw new Exception("您无权访问该页面");
                }

                groupNavigation1.groupId = group.Id;

                ViewState["GroupId"] = groupId;

                BindData(group);

                SetTitle("群组管理-" + group.Name);
            }
        }
Esempio n. 19
0
        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: '服务器忙,请稍后再试!'}");
            }
        }
Esempio n. 20
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int groupId = 0;
            CY.UME.Core.Business.Account currentAccount;
            CY.UME.Core.Business.Group group;

            #region validate
            if(context.Request.Form["groupId"]==null)
            {
                context.Response.Write("{success:false,msg:'参数错误'}");
                return;
            }

            if (!int.TryParse(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;
            }

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

            if(currentAccount==null)
            {
                context.Response.Write("{success:false,msg:'登录超时失败,请重新登录'}");
                return;
            }
            #endregion

            try
            {
                if (group.CheckIsGroupMember(currentAccount))
                {
                    context.Response.Write("{success:true,msg:'已是群组成员'}");
                    return;
                }

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

                if (group.MaxMemberNum <= group.MemberNum)
                {
                    context.Response.Write("{success:false,msg:'该群已达用户数已达上线'}");
                    return;
                }

                if (group.AddPermission == 0)//需群主验证加入
                {
                    CY.UME.Core.Business.AccountGroup ag = new CY.UME.Core.Business.AccountGroup();

                    IList<CY.UME.Core.Business.AccountGroup> agList = ag.GetAccountGroupByGroupIdAndAccountId(currentAccount, group);

                    if (agList.Count > 0)
                    {
                        ag = agList[0];

                        if (ag.Role != 2)
                        {
                            context.Response.Write("{success:true,msg:'加入成功'}");
                            return;
                        }
                        else if (ag.Role == 2)
                        {
                            context.Response.Write("{success:false,msg:'申请已发出,请等待'}");
                            return;
                        }
                    }

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

                    agTemp.AccountId = currentAccount.Id;
                    agTemp.DateCreated = DateTime.Now;
                    agTemp.GroupId = group.Id;
                    agTemp.Name = currentAccount.Name;
                    agTemp.Role = 2;

                    agTemp.Save();

                    context.Response.Write("{success:false,msg:'申请已发出,请等待'}");
                    return;
                }
                else if(group.AddPermission==1)//任何人可以加入
                {
                    CY.UME.Core.Business.AccountGroup accountGroup =new CY.UME.Core.Business.AccountGroup();

                    accountGroup.AccountId =currentAccount.Id;
                    accountGroup.DateCreated =DateTime.Now;
                    accountGroup.GroupId =group.Id;
                    accountGroup.Name =currentAccount.Name;
                    accountGroup.Role =0;

                    accountGroup.Save();

                    group.MemberNum++;
                    group.Save();

                    context.Response.Write("{success:true,msg:'加入成功'}");
                    return;
                }
                else if(group.AddPermission==2)//只能由群主邀请加入
                {
                    context.Response.Write("{success:false,msg:'该群只能由群主邀请加入'}");
                    return;
                }

            }
            catch
            {
                context.Response.Write("{success:false,msg:'服务器忙,请稍后再试'}");
                return;
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 获取该组下的所有成员
        /// </summary>
        /// <param name="isTrue"></param>
        private void bind(String GroupId, String Role, bool isTrue)
        {
            Core.PagingInfo pagingInfo = new CY.UME.Core.PagingInfo();
            pagingInfo.CurrentPage = AspNetPager1.CurrentPageIndex;
            pagingInfo.PageSize = AspNetPager1.PageSize = SetCurrentPageSize.CurrentPageSize;

            Core.Business.AccountGroup accountGroup = new CY.UME.Core.Business.AccountGroup();
            accountGroup.GroupId = CY.Utility.Common.ConvertUtility.ConvertToInt(GroupId, -1);
            accountGroup.Role = CY.Utility.Common.ConvertUtility.ConvertToInt(Role, -1);

            IList<Core.Business.AccountGroup> GroupAccountList = ag.GetGroupAccountByAccountGroup(accountGroup, pagingInfo);

            if (GroupAccountList.Count > 0)
            {
                if (isTrue)
                {
                    AspNetPager1.RecordCount = ag.GetGroupAccountByAccountGroupCount(accountGroup);//绑定总条数
                }

                AspNetPager1.Visible = true;
                Repeater2.Visible = false;
                Repeater1.Visible = true;
                Repeater1.DataSourceID = "";
                Repeater1.DataSource = GroupAccountList;
                Repeater1.DataBind();
            }
            else
            {
                Repeater1.Visible = false;
                Repeater2.Visible = true;

                DataTable dt = new DataTable();
                dt.Columns.Add("message", typeof(System.String));
                DataRow dr = dt.NewRow();
                dr[0] = "暂无数据";
                dt.Rows.Add(dr);

                Repeater2.DataSourceID = "";
                Repeater2.DataSource = dt;
                Repeater2.DataBind();
                AspNetPager1.Visible = false;
            }
        }