/// <summary>
        /// 新增班级或群组
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();

                group.Name = txtName.Text.Trim();
                group.CreatorId = CY.Utility.Common.ConvertUtility.ConvertToInt(txtAccountName.Text.Trim(), 1);
                group.MaxMemberNum = CY.Utility.Common.ConvertUtility.ConvertToInt(txtMaxMemberNum.Text.Trim(), 150);
                group.AddPermission = CY.Utility.Common.ConvertUtility.ConvertToInt(DDLAddPermission.SelectedValue, 1);
                group.IsChecked = true;// 群组/班级通过审核
                if (DDLType.SelectedValue == "0")
                {
                    group.Type = CY.Utility.Common.ConvertUtility.ConvertToInt(DDLType.SelectedValue, 0);
                    CY.UME.Core.Business.GroupCollege groupCollege = new CY.UME.Core.Business.GroupCollege();
                    groupCollege.CollegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(selCollege.Value, 1);
                    groupCollege.GroupId = group.Id;
                    groupCollege.Save();
                }
                group.DateCreated = DateTime.Now;
                group.ViewPermission = CY.Utility.Common.ConvertUtility.ConvertToInt(DDLViewPermission.SelectedValue, 1);
                group.PlaCard = txtPlaCard.Text.Trim();

                group.Save();

                if (group.Id != 0)
                {
                    lblMsg.Text = "新增成功。";
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = "新增失败:" + ex.Message;
            }
        }
        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("该群组不存在或已被删除");
            }
            BindData(group);

            mrg_HiddenGroupId.Value = groupId.ToString();
            mrg_HiddenSiteUrl.Value = SiteUrl;

            base.CSSName = "ume2";

            SetTitle(group.Name + " - 友情小组邀请");
        }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SetTitle("群组搜索");
     if (CurrentAccount == null)
     {
         //转到404页面
         Response.Redirect(SiteUrl + "/Login");
         return;
     }
     else
     {
         try
         {
             if (Request.QueryString["SearchText"] != null)
             {
                 this.HF_SearchType.Value = "1";
                 this.HF_SearchText.Value = Server.UrlDecode(Request.QueryString["SearchText"]);
                 CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                 //SearchedGroupsCount = group.GetGroupCountBySearch(Server.UrlDecode(Request.QueryString["SearchText"]), 1);
                 SearchedGroups = CY.UME.Core.Business.Group.GetGroupsCountBySearch(Server.UrlDecode(Request.QueryString["SearchText"].ToString()), new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 42 }, "1");
                 SearchedGroupsCount = SearchedGroups.Count;
                 this.HF_SearchTotalCount.Value = SearchedGroupsCount.ToString();
                 this.HF_PageSize.Value = "42";
                 HF_SiteUrl.Value = SiteUrl;
                 this.HF_CurrentAccount_Id.Value = CurrentAccount.Id.ToString();
             }
         }
         catch
         {
             return;
         }
     }
 }
Example #4
0
 private void BindNew()
 {
     if (!string.IsNullOrEmpty(Type))
     {
         switch (Type)
         {
             case "New"://最新活动
                 IEnumerable<CY.UME.Core.Business.Activities> getActiviteList = CY.UME.Core.Business.Activities.GetAllTopNum(6);
                 ActiveList = getActiviteList.ToList();
                 break;
             case "Hot"://最热活动
                 IEnumerable<CY.UME.Core.Business.Activities> getActivieHotList = CY.UME.Core.Business.Activities.GetHotTop4();
                 ActiveList = getActivieHotList.ToList();
                 break;
             case "MyGroup"://我的小组发起了
                 if (CurrentAccount != null)
                 {
                     CY.UME.Core.Business.Group g = new CY.UME.Core.Business.Group();
                     List<CY.UME.Core.Business.Group> groupList = g.GetGroupsByAccountId(CurrentAccount).ToList();//获取用户所在的群组列表
                     if (groupList != null && groupList.Count > 0)
                     {
                         List<CY.UME.Core.Business.Activities> getGroupList = CY.UME.Core.Business.Activities.GetMyGroupTop4(groupList, CurrentAccount.Id).ToList();
                         ActiveList = getGroupList;
                     }
                 }
                 break;
             case "MyFriend"://我的好友还喜欢
                 List<CY.UME.Core.Business.Friendship> ac = CurrentAccount.GetFriendships();
                 List<CY.UME.Core.Business.Account> accountList = new List<CY.UME.Core.Business.Account>();
                 if (ac != null && ac.Count > 0)
                 {
                     for (int i = 0; i < ac.Count; i++)
                     {
                         CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(ac[i].FriendId);
                         if (account != null)
                         {
                             accountList.Add(account);
                         }
                     }
                 }
                 List<CY.UME.Core.Business.ActivitieParticipants> GetMyFriendLoveList = CY.UME.Core.Business.Activities.GetMyFriendLoveActiveList(accountList).Take(4).ToList();//找出所有的活动参与者列表
                 List<CY.UME.Core.Business.Activities> activiteListResult = new List<CY.UME.Core.Business.Activities>();
                 if (GetMyFriendLoveList != null && GetMyFriendLoveList.Count > 0)
                 {
                     //根据活动ID取得活动列表
                     for (int p = 0; p < GetMyFriendLoveList.Count; p++)
                     {
                         CY.UME.Core.Business.Activities acTivite = CY.UME.Core.Business.Activities.Load(GetMyFriendLoveList[p].ActivitieId);
                         if (acTivite != null && acTivite.IsCheck == true)
                         {
                             activiteListResult.Add(acTivite);
                         }
                     }
                     ActiveList = activiteListResult;
                 }
                 break;
         }
     }
 }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
         hotgrouplist = group.GetTopGroupByNum(6) as List<CY.UME.Core.Business.Group>;
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            int pageNum = 0, pageSize = 0, type = -2;
            //CY.UME.Core.Business.Account currentAccount;

            if (context.Request.QueryString["pageNum"] == null || context.Request.QueryString["pageSize"] == null
                || context.Request.QueryString["type"] == null)
            {
                context.Response.Write("success:false,msg:'参数错误'");
                return;
            }

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

            try
            {
                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo { CurrentPage = pageNum, PageSize = pageSize };
                CY.UME.Core.Business.Group groupTemp = new CY.UME.Core.Business.Group();
                System.Collections.Generic.IList<CY.UME.Core.Business.Group> groupList = groupTemp.GetGroupsByAccountIdAndType(null, type, pageInfo, "Id", "DESC", null);
                StringBuilder sb = new StringBuilder();

                sb.Append("{success:true,MyGroups:[");
                foreach (CY.UME.Core.Business.Group group in groupList)
                {
                    sb.Append("{");
                    sb.Append("Id:" + group.Id);
                    sb.Append(",Name:'" + CY.Utility.Common.StringUtility.EscapeString(group.Name) + "'");
                    sb.Append(",TypeName:'" + group.GetGroupNameByType() + "'");
                    sb.Append(",MemberNum:" + group.MemberNum);
                    sb.Append(",TopicesNum:" + group.GetGroupTopicesNum());
                    sb.Append(",TopicesReplyNum:" + group.GetGroupTopicReplyCount());
                    sb.Append("},");
                }

                if (groupList.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 bind(long albumId)
        {
            int groupId = 0;

            CY.UME.Core.Business.Album album = CY.UME.Core.Business.Album.Load(albumId);

            if (album == null)
            {
                throw new Exception("该相册不存在或已被删除");
            }

            CY.UME.Core.Business.AlbumExtend ae = CY.UME.Core.Business.AlbumExtend.Load(album.Id);

            if (ae == null)
            {
                throw new Exception("系统异常错误");
            }

            if (ae.Type != "group" || !int.TryParse(ae.InstanceId, out groupId))
            {
                throw new Exception("该群组相册不存在或已被删除");
            }

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

            if (group == null)
            {
                throw new Exception("该相册所在群组不存在或已被删除");
            }

            if (!group.CheckIsManager(CurrentAccount))
            {
                throw new Exception("您无权访问该页");
            }

            picList = CY.UME.Core.Business.Picture.GetAllPicture(album, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 4 });

            int count = album.GetPictureCount();

            if (count > picList.Count)
            {
                IsDisPaged = true;
            }

            albumName.Text = album.Name;

            ep_HiddenAlbumId.Value = albumId.ToString();
            ep_HiddenPageSize.Value = "4";
            ep_HiddenSiteUrl.Value = SiteUrl;
            ep_HiddenTotalRecords.Value = count.ToString();
            ep_HiddenCoverId.Value = "";
            ep_HiddenDescription.Value = "";
            uc_GroupInfo.group = group;
            uc_NewestTopices.group = group;
        }
Example #8
0
        protected void AddGroup_OnClick(object sender, EventArgs e)
        {
            bool check = false;

            if (LblGroupName.Text.Trim().Length == 0)
            {
                ShowAlert("提示", "用户名不能为空");

                check = true;
            }
            if (CurrentAccount == null)
            {
                ShowAlert("提示", "用户登录超时失败,请重新登录");

                check = true;
            }

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

            if (group.CheckGroupNameIsExist(LblGroupName.Text.Trim()))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({title: '提示', content: '该群组已经存在'});</script>");

                check = true;
            }

            if (check)
            {
                return;
            }

            group.AddPermission = int.Parse(SelAddPermission.Value);
            group.CreatorId = CurrentAccount.Id;
            group.DateCreated = DateTime.Now;
            group.IsRecommended = 0;
            group.Level = 0;
            group.MaxMemberNum = 300;
            group.MemberNum = 0;
            group.Name = LblGroupName.Text.Trim();
            group.Slogan = TBXPlaClard.Text.Trim();
            group.Type = int.Parse(DDLGroupType.SelectedValue);
            group.ViewPermission = 1;
            group.AddPicturePermission = 0;
            group.AddPictureReplyPermission = 0;
            group.AddTopicPermission = 0;
            group.AddTopicReplyPermission = 0;
            group.LeaveWordsPermission = 0;
            group.IsChecked = true;

            group.Save();

            SetGroupCover(group);

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({title: '提示', content: '新建群组成功'});window.location.href='Group.aspx?groupId=" + group.Id.ToString() + "'</script>");
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();

            int type = -2;
            if (Request.QueryString["type"] != null)
            {
                int.TryParse(Request.QueryString["type"], out type);
            }

            if (type == -2)
            {
                //RecommendedGroups = group.GetGroupsByAccountIdAndType(null, type, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 14 }, "Id", "DESC", true);
                RecommendedGroups = CY.UME.Core.Business.Group.GetCommendGroup(CurrentAccount.ExtendInfo).Take(14).ToList();
            }
            /*int pagesize = 28;

            AllGroups = group.GetGroupsByAccountIdAndType(null, type, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = pagesize }, "Id", "DESC", null);

            groupCount = CY.UME.Core.Business.Group.GetGroupsCountByType(type, null, null);*/

            int pagesize = 18;

            AllGroups = group.GetGroupsByAccountIdAndType(null, type, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = pagesize }, "Id", "DESC", null);

            //groupCount = CY.UME.Core.Business.Group.GetGroupsCountByType(type, null, null);

            gl_HiddenPageSize.Value = pagesize.ToString();
            gl_HiddenSiteUrl.Value = SiteUrl;
            gl_HiddenTotalRecords.Value = groupCount.ToString();
            gl_HiddenType.Value = type.ToString();
            HF_SiteUrl.Value = SiteUrl;
            HF_CurrentAccount_Id.Value = CurrentAccount.Id.ToString();

            CY.UME.Core.Business.Group g = new CY.UME.Core.Business.Group();
            g.Id = 3;
            g.Type = type;

            if (type == -2)
            {
                Lbl_GroupType.Text = "最新群组(" + AllGroups.Count + ")";
            }
            else
            {
                Lbl_GroupType.Text = g.GetGroupNameByType() + "(" + AllGroups.Count + ")";
            }

            base.CSSName = "ume2";
            SetTitle("Ume群组");
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                myManagingGroupList = group.GetGroupByTypeAndAccountIdAndRole(-2, CurrentAccount, 1, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 18 });
                myGroupList = group.GetGroupByTypeAndAccountIdAndRole(-2, CurrentAccount, 0, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 18 });

                HF_SiteUrl.Value = SiteUrl;
                HF_CurrentAccount_Id.Value = CurrentAccount.Id.ToString();

                //base.CSSName = "ume2";
                SetTitle("我的群组");
            }
        }
        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 + "-个性化设置");
        }
Example #12
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 + "的成员列表");
            }
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int type = -2;
                if (Request.QueryString["type"] != null)
                {
                    int.TryParse(Request.QueryString["type"], out type);
                }
                int pageSize = 16, recordCount = 0;

                CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = pageSize };
                bool? isClass = (type == 0);

                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                groupList = group.GetGroupByTypeAndAccountIdAndRole(type, CurrentAccount, 1, pageInfo);

                recordCount = CurrentAccount.GetGroupCountByRole(1);

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

                newestTopices.PageSize = 10;
                newestTopices.Group = null;
                newestTopices.IsRecommend = null;
                newestTopices.Type = type;
                newestTopices.IsMyGroup = true;
                newestTopices.IsManage = true;

                groupNavigation1.groupId = 0;
                groupNavigation1.IsShowAddGroupBtn = true;
                groupNavigation1.IsShowAddTopicBtn = false;
                groupNavigation1.IsShowAddImgBtn = false;
                groupNavigation1.IsShowNav = false;

                groupType1.LinkUrl = "MyManageGroup";

                mgm_HiddenPageSize.Value = pageSize.ToString();
                mgm_HiddenSiteUrl.Value = SiteUrl;
                mgm_HiddenTotalRecords.Value = recordCount.ToString();
                mgm_HiddenType.Value = type.ToString();

                SetTitle("我管理的群组");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int type = -2;
                if (Request.QueryString["type"] != null)
                {
                    int.TryParse(Request.QueryString["type"], out type);
                }
                int pageSize = 16, recordCount = 0;

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

                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                groupList = group.GetGroupsByAccountIdAndType(CurrentAccount, type, pageInfo, "Id", "desc", true);

                recordCount = CY.UME.Core.Business.Group.GetGroupsCountByType(type, CurrentAccount,true);

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

                newestTopices.PageSize = 10;
                newestTopices.Group = null;
                newestTopices.IsRecommend = true;
                newestTopices.Type = type;
                newestTopices.IsMyGroup = false;

                groupNavigation1.groupId = 0;
                groupNavigation1.IsShowAddGroupBtn = true;
                groupNavigation1.IsShowAddTopicBtn = false;
                groupNavigation1.IsShowAddImgBtn = false;
                groupNavigation1.IsShowNav = false;

                groupType1.LinkUrl = "RecommendGroup";

                rg_HiddenPageSize.Value = pageSize.ToString();
                rg_HiddenSiteUrl.Value = SiteUrl;
                rg_HiddenTotalRecords.Value = recordCount.ToString();
                rg_HiddenType.Value = type.ToString();

                SetTitle("推荐群组");
            }
        }
Example #15
0
        protected void DDLRole_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            int groupId = 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("参数错误");
            }

            BindData(group);
        }
Example #16
0
        private string Creatjson(string pageSize, string pageNum, string sText,string type)
        {
            StringBuilder json = new StringBuilder();

            CY.UME.Core.PagingInfo pinfo = new CY.UME.Core.PagingInfo { CurrentPage = int.Parse(pageNum), PageSize = int.Parse(pageSize) };

            List<CY.UME.Core.Business.Group> groups = CY.UME.Core.Business.Group.GetGroupsCountBySearch(sText, pinfo,type) as List<CY.UME.Core.Business.Group>;
            CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
            int count = group.GetGroupCountBySearch(sText, int.Parse(type));
            if (groups != null && groups.Count != 0)
            {

                json.Append("{success:true,count:'"+count+"',");
                json.Append("list:");
                json.Append("[");
                for (int i = 0; i < groups.Count; i++)
                {
                    if (i == 0)
                    {
                        json.Append("{");
                    }
                    else
                    {
                        json.Append(",{");
                    }

                    json.Append("Id:" + groups[i].Id);
                    json.Append(",ShortName:'" + CY.Utility.Common.StringUtility.EscapeString(CY.Utility.Common.StringUtility.CutString(groups[i].Name, 20, "...")) + "'");
                    json.Append(",Name:'" + CY.Utility.Common.StringUtility.EscapeString(CY.Utility.Common.StringUtility.CutString(groups[i].Name,10,"..."))+"'");
                    json.Append(",WhoName:'" + CY.Utility.Common.StringUtility.EscapeString(groups[i].Name) + "'");
                    json.Append(",TypeName:'" + groups[i].GetGroupNameByType() + "'");
                    json.Append(",MemberNum:" + groups[i].MemberNum + "");
                    json.Append(",TopicesNum:" + groups[i].GetGroupTopicesNum() + "");
                    json.Append(",TopicesReplyNum:" + groups[i].GetGroupTopicReplyCount() + "");
                    json.Append("}");

                }
                json.Append("]}");

            }
            return json.ToString();
        }
Example #17
0
        /// <summary>
        /// 群组查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            IList<long> idList = CY.UME.Core.Business.Account.GetAccountIdByName(txtAccountName.Text.Trim());
            //HFCreatorId.Value = CY.UME.Core.Business.Account.GetAccountIdByName(txtAccountName.Text.Trim());
            HFMaxMenberNum.Value = txtMaxMenberNum.Text.Trim();
            HFStartTime.Value = txtStartTime.Text.Trim();
            HFEndTime.Value = txtEndTime.Text.Trim();
            HFSort.Value = DDLSort.SelectedValue;

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

            group.Name = txtName.Text.Trim();
            group.Type = CY.Utility.Common.ConvertUtility.ConvertToInt(DDLType.SelectedValue, -1);
            group.AddPermission = CY.Utility.Common.ConvertUtility.ConvertToInt(DDLAddPermission.SelectedValue, -1);
            group.MemberNum = CY.Utility.Common.ConvertUtility.ConvertToInt(txtMenberNum.Text.Trim(), -1);

            ViewState["Group"] = group;

            bind(group, HFCreatorId.Value, "", "", HFMaxMenberNum.Value, HFStartTime.Value, HFEndTime.Value, HFSort.Value, true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["groupId"] == null)
                {
                    throw new Exception("您访问的页面不存在");
                }

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

                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.CheckIsManager(CurrentAccount))
                {
                    throw new Exception("您无权查看该页面");
                }

                if (Request.QueryString["Role"] != null)
                {
                    DDLRole.SelectedValue = Request.QueryString["Role"].ToString();
                }

                BindData(group);

                SetTitle(group.Name + "-成员管理");
            }

            base.CSSName = "ume2";
        }
Example #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SetTitle("群组搜索");
     if (CurrentAccount == null)
     {
         Response.Redirect("../Login.aspx");
         return;
     }
     else
     {
         try
         {
             if (Request.QueryString["SearchText"] != null)
             {
                 this.sg_HiddenType.Value = "1";
                 this.sg_HiddenSText.Value = Request.QueryString["SearchText"];
                 CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                 string num = group.GetGroupCountBySearch(Server.UrlDecode(Request.QueryString["SearchText"]), 1).ToString();
                 this.sg_HiddenTotalRecords.Value = num;
                 this.LblSearchResults.Text = "共" + num + "个搜索结果";
             }
             else if (Request.QueryString["uid"] != null)
             {
                 this.sg_HiddenType.Value = "2";
                 this.sg_HiddenSText.Value = Request.QueryString["uid"];
                 CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();
                 string num = group.GetGroupCountBySearch(Request.QueryString["uid"], 2).ToString();
                 this.sg_HiddenTotalRecords.Value = num;
                 this.LblSearchResults.Text = "共" + num + "个搜索结果";
             }
         }
         catch
         {
             return;
         }
     }
 }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int spaceId;

            #region - Get Current Account and Space Account -

            if (CurrentAccount != null)
            {
                if (CY.Utility.Common.ParseUtility.TryParseInt32(Request.QueryString["uid"], out spaceId))
                {
                    spaceAccount = CY.UME.Core.Business.Account.Load(spaceId);
                    if (spaceAccount == null)
                    {
                        spaceAccount = base.CurrentAccount;
                    }
                    if (spaceAccount == null)
                    {
                        Response.Redirect(SiteUrl + "/Login.aspx");
                        return;
                    }

                    if (spaceAccount.Id != base.CurrentAccount.Id)
                    {
                        if (base.CurrentAccount.HasFriendshipWith(spaceAccount))
                        {
                            HF_IsFriend.Value = true.ToString();
                        }
                        else
                        {
                            HF_SiteUrl.Value = false.ToString();
                            if (base.CurrentAccount.HasFollowedWith(spaceAccount))
                            {
                                HF_IsFollower.Value = true.ToString();
                            }
                            else
                            {
                                HF_IsFollower.Value = false.ToString();
                            }
                        }
                    }

                    if (!IsPostBack)
                    {

                    }
                }
                else
                {
                    spaceAccount = base.CurrentAccount;
                }
            }
            else
            {
                if (CY.Utility.Common.ParseUtility.TryParseInt32(Request.QueryString["uid"], out spaceId))
                {
                    spaceAccount = CY.UME.Core.Business.Account.Load(spaceId);
                }

                if (spaceAccount == null)
                {
                    try
                    {
                        Response.Redirect(SiteUrl + "/Login.aspx");
                    }
                    catch
                    {

                    }

                    return;
                }

            }

            #endregion

            HF_SiteUrl.Value = SiteUrl;

            HF_InAccount_Id.Value = spaceAccount.Id.ToString();
            HF_CurrentAccount_Id.Value = CurrentAccount == null ? spaceAccount.Id.ToString() : CurrentAccount.Id.ToString();
            HF_SpaceAccountName.Value = spaceAccount.Name;

            BindUserInfo(spaceAccount.Id);
            BindFriendInfo(spaceAccount);
            BindBlog(spaceAccount);
            BindAlbum(spaceAccount);
            BindFavorites();
            BindComment(spaceAccount);

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

            //群组
            RPT_InGroup.DataSourceID = "";
            RPT_InGroup.DataSource = group.GetGroupsByAccountIdAndPages(spaceAccount, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 4 }, false);
            RPT_InGroup.DataBind();

            //活动
            RPT_ActivityList.DataSourceID = "";
            RPT_ActivityList.DataSource = CY.UME.Core.Business.Activities.GetMyActiviteCheck(spaceAccount.Id, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = 2 });
            RPT_ActivityList.DataBind();

            SetTitle(spaceAccount.Name + " ");

            base.ExecuteClientScript("$('#login_msg').html('用户名或密码不正确!');");
        }
Example #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int groupId = 0; long albumId = 0;

                if (Request.QueryString["albumId"] != null && long.TryParse(Request.QueryString["albumId"].ToString(), out albumId))
                {
                    CY.UME.Core.Business.Album album = CY.UME.Core.Business.Album.Load(albumId);

                    if (album != null)
                    {
                        TBXAlbumName.Text = album.Name;
                        selViewPermission.Value = album.ViewPermission.ToString();
                        HF_albumId.Value = albumId.ToString();

                        CY.UME.Core.Business.AlbumExtend ae = CY.UME.Core.Business.AlbumExtend.Load(album.Id);

                        if (ae == null)
                        {
                            throw new Exception("系统异常错误");
                        }

                        if (ae.Type != "group" || !int.TryParse(ae.InstanceId, out groupId))
                        {
                            throw new Exception("该群组相册不存在或已被删除");
                        }

                    }
                    else
                    {
                        if (Request.QueryString["groupId"] == null)
                        {
                            throw new Exception("页面不存在");
                        }

                        if (!int.TryParse(Request.QueryString["groupId"].ToString(), out groupId))
                        {
                            throw new Exception("页面不存在");
                        }
                    }
                }
                else
                {
                    if (Request.QueryString["groupId"] == null)
                    {
                        throw new Exception("页面不存在");
                    }

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

                HF_groupId.Value = group.Id.ToString();

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

            }
            SetTitle(group.Name + "-新建相册");

            base.CSSName = "ume2";
        }
Example #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CY.UME.Core.Business.Album album = new CY.UME.Core.Business.Album();
            #region validate

            al_HiddenSiteUrl.Value = SiteUrl;
            al_HiddenCurrentAccountId.Value = CurrentAccount.Id.ToString();

            long spaceId = 0, albumId = 0;
            int groupId = 0;
            SetTitle("上传照片 ");
            if (Request.QueryString["uid"] == null)
            {
                SpaceAccount = CurrentAccount;
            }
            else if (long.TryParse(Request.QueryString["uid"].ToString(), out spaceId))
            {
                SpaceAccount = CY.UME.Core.Business.Account.Load(spaceId);
            }
            else
            {
                SpaceAccount = CurrentAccount;
            }

            if (Request.QueryString["albumId"] != null && long.TryParse(Request.QueryString["albumId"].ToString(), out albumId))
            {
                album = CY.UME.Core.Business.Album.Load(albumId);
            }

            if (Request.QueryString["gid"] == null)
            {
                throw new Exception("页面不存在");
            }

            if (!int.TryParse(Request.QueryString["gid"].ToString(), out groupId))
            {
                throw new Exception("页面不存在");
            }
            al_HiddenGroupId.Value = groupId.ToString();
            group = CY.UME.Core.Business.Group.Load(groupId);
            #endregion

            //UserInfo1.SpaceAccount = SpaceAccount;

            if (!IsPostBack)
            {
                if (Request.QueryString["code"] != null)
                {
                    string advParam = Request.QueryString["code"].ToString();

                    CY.UME.Core.Business.AdvancedPage ap = CY.UME.Core.Business.AdvancedPage.SelectByCode(advParam);

                    if (ap != null)
                    {
                        flashUpload.QueryParameters = "code=" + advParam + "&";
                        album = GetActivityAlbum(ap.Code, ap.Id.ToString(), ap.Name);
                        HiddenActivityAlbumId.Value = album.Id.ToString();
                    }
                }
                /*********************第一天活动************************/
                else if (Request.QueryString["mfd"] != null)
                {
                    string myfirstdayParam = Server.UrlDecode(Request.QueryString["mfd"].ToString());
                    if (myfirstdayParam == "myfirstday")
                    {
                        flashUpload.QueryParameters = "IsFirstDay=myfirstday&";
                        HiddenIsFirstDay.Value = "myfirstday";
                        album = GetActivityAlbum("myfirstday", "myfirstday", "找人相册");
                        HiddenActivityAlbumId.Value = album.Id.ToString();
                    }
                }
                /***********************第一天活动结束*****************/

                if (album == null || album.Id == 0)
                {
                    string strAlbumId = BingAlbumType(CurrentAccount,group);
                    if (strAlbumId == "false")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content:'请先创建相册'});window.location.href='AlbumEdit.aspx?SpaceId=" + CurrentAccount.Id.ToString() + "'</script>");
                        return;
                    }
                    LblTitle.Text = "上传图片";
                    flashUpload.QueryParameters = "albumId=" + strAlbumId + "&accountId=" + CurrentAccount.Id.ToString() + "&groupId=" + groupId.ToString();
                    //LblAlbum.Visible = false;
                }
                else
                {
                    LblDescription.Visible = false;
                    DDLAlbum.Visible = false;
                    //LblAlbum.Visible = true;
                    //LblAlbum.Text = album.Name;
                    LblTitle.Text = album.Name;

                    flashUpload.QueryParameters += "albumId=" + album.Id.ToString() + "&accountId=" + CurrentAccount.Id.ToString() + "&groupId=" + groupId.ToString();
                }

                string noticeContent = String.Empty;

                noticeContent = TBXNoticeInfo.Text.Trim();

                if (noticeContent.Length == 0)
                {
                    noticeContent = "上传了新照片";
                }

                if (CBMagic.Checked)
                {
                    noticeContent = "<span class=\"magic\">" + noticeContent;
                    noticeContent += "</span>";
                }

                flashUpload.QueryParameters += "&noticeContent=" + Server.UrlEncode(noticeContent);
            }
        }
Example #23
0
        protected void CreatAlbum_OnClick(object sebder, EventArgs e)
        {
            int groupId = 0;
            CY.UME.Core.Business.Group group;

            #region validate
            if (TBXAlbumName.Text.Trim().Length == 0)
            {
                ShowAlert("提示", "相册名不能为空");
                return;
            }

            if (HF_groupId.Value != "" && int.TryParse(HF_groupId.Value.ToString(), out groupId))
            {
                group = CY.UME.Core.Business.Group.Load(groupId);

                if (group == null)
                {
                    throw new Exception("该群组不存在或已被删除");
                }
            }
            else
            {
                throw new Exception("参数错误");
            }
            #endregion

            #region creat album
            int viewPermission = 1;
            int.TryParse(selViewPermission.Value, out viewPermission);
            long albumId = 0;

            CY.UME.Core.Business.Album album = new CY.UME.Core.Business.Album();

            if (HF_albumId.Value != "" && long.TryParse(HF_albumId.Value.ToString(), out albumId))
            {
                album = CY.UME.Core.Business.Album.Load(albumId);

                if (album == null)
                {
                    album = group.CreateGroupAlbum(TBXAlbumName.Text.Trim(), viewPermission);

                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '创建相册成功' });window.location.href='PictureList.aspx?albumId=" + album.Id + "'</script>");
                }
                else
                {
                    album.Name = TBXAlbumName.Text.Trim();
                    album.ViewPermission = int.Parse(selViewPermission.Value);
                    album.Save();

                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '修改相册成功' });window.location.href='PictureList.aspx?albumId=" + album.Id + "'</script>");
                }
            }
            else
            {
                album = group.CreateGroupAlbum(TBXAlbumName.Text.Trim(), viewPermission);

                Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({ title: '提示', content: '创建相册成功' });window.location.href='PictureList.aspx?albumId=" + album.Id + "'</script>");
            }
            #endregion

            #region upload pic

            string strPicId = String.Empty;
            List<HttpPostedFile> hfList = new List<HttpPostedFile>();
            if (PortugueseFileUpload1.HasFile)
            {
                hfList.Add(PortugueseFileUpload1.PostedFile);
            }
            if (PortugueseFileUpload2.HasFile)
            {
                hfList.Add(PortugueseFileUpload2.PostedFile);
            }
            if (PortugueseFileUpload3.HasFile)
            {
                hfList.Add(PortugueseFileUpload3.PostedFile);
            }
            if (PortugueseFileUpload4.HasFile)
            {
                hfList.Add(PortugueseFileUpload4.PostedFile);
            }
            if (PortugueseFileUpload5.HasFile)
            {
                hfList.Add(PortugueseFileUpload5.PostedFile);
            }

            for (int i = 0; i < hfList.Count; i++)
            {
                HttpPostedFile imgFile = hfList[i];
                if (imgFile == null || imgFile.ContentLength == 0)
                {
                    break;
                }
                string imgExtention = CY.Utility.Common.FileUtility.GetFileExtension(imgFile.FileName).ToLower();
                string imgName = CY.Utility.Common.FileUtility.GetFileName(imgFile.FileName);

                string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath;
                string dirPath = appPath + "/Content/Group/Album/" + groupId + "/";
                string fileName = "/Content/Group/Album/" + groupId + "/" + DateTime.Now.ToString("yyyMMddhhmmss") + DateTime.Now.Millisecond.ToString();//相册图片以加时间命名

                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath);
                if (!di.Exists)
                {
                    di.Create();
                }

                string bImgName = appPath + fileName + "_big" + imgExtention;
                string mImgName = appPath + fileName + "_middle" + imgExtention;
                string sImgName = appPath + fileName + "_small" + imgExtention;

                imgFile.SaveAs(appPath + fileName + imgExtention);//临时保存原始图片

                Bitmap bmp = new Bitmap(appPath + fileName + imgExtention);
                int width = bmp.Width;
                int height = bmp.Height;

                bmp.Dispose();

                if (height <= width && width >= 600)
                {
                    height = Convert.ToInt32(width > 600 ? (600f / width) * height : height);
                    width = 600;
                }
                else if (width < height && height > 600)
                {
                    width = Convert.ToInt32(height > 600 ? (600f / height) * width : height);
                    height = 600;
                }

                // 将原始图压缩为大缩略图
                using (StreamReader reader = new StreamReader(appPath + fileName + imgExtention))
                {
                    CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, bImgName, width, height);
                }

                if (width > 200)
                {
                    height = Convert.ToInt32(width > 200 ? (200f / width) * height : height);
                    width = 200;
                }

                // 生成图片(好友上传图片最新通知中显示)
                using (StreamReader reader = new StreamReader(appPath + fileName + imgExtention))
                {
                    CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, sImgName, width, height);
                }

                if (height <= width && width >= 100)
                {
                    height = Convert.ToInt32(width > 100 ? (100f / width) * height : height);
                    width = 100;
                }
                else if (width < height && height > 100)
                {
                    width = Convert.ToInt32(height > 100 ? (100f / height) * width : height);
                    height = 100;
                }

                // 将大图片压缩为中等缩略图
                using (StreamReader reader = new StreamReader(appPath + fileName + imgExtention))
                {
                    CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, mImgName, width, height);
                }

                try
                {
                    File.Delete(appPath + fileName + imgExtention);
                }
                catch
                {
                    ;
                }

                //更换相册封面
                if (album.PhotoCount == 0 || album.CoverPath.Trim().Length == 0)
                {
                    album.CoverPath = fileName + "_middle" + imgExtention;
                    album.Save();
                }

                //将路径及图片信息保存到数据库
                CY.UME.Core.Business.Picture pic = new CY.UME.Core.Business.Picture();

                pic.AlbumId = album.Id;
                pic.BigPath = fileName + "_big" + imgExtention;
                pic.DateCreated = DateTime.Now;
                pic.MiddlePath = fileName + "_middle" + imgExtention;
                pic.Name = CY.Utility.Common.StringUtility.HTMLEncode(imgName.Substring(0, imgName.Length > 30 ? 30 : imgName.Length));
                pic.SmallPath = fileName + "_small" + imgExtention;

                pic.Save();

                strPicId += pic.Id.ToString() + ",";
                //保存pictureextend
                CY.UME.Core.Business.PictureExtend pe = new CY.UME.Core.Business.PictureExtend();

                pe.Id = pic.Id;
                pe.AccountId = CurrentAccount.Id;
                pe.ActivityId = "group";
                pe.ActivityPicId = "0";

                pe.Save();
            }

            if (viewPermission == 0 && strPicId.Length > 0)
            {
                IList<CY.UME.Core.Business.Friendship> fsList = CurrentAccount.GetFriendships();

                foreach (CY.UME.Core.Business.Friendship fs in fsList)
                {
                    CY.UME.Core.Business.Notice n = new CY.UME.Core.Business.Notice();

                    n.AccountId = fs.FriendId;
                    n.AuthorId = fs.AccountId;
                    n.Content = "上传了新照片";
                    n.DateCreated = DateTime.Now;
                    n.InstanceId = strPicId.Remove(strPicId.Length - 1);
                    n.IsReaded = false;
                    n.Type = "grouppicture";

                    n.Save();
                }
            }
            #endregion
        }
Example #24
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);
            }
        }
Example #25
0
        private void BindInfo(string type)
        {
            CY.UME.Core.PagingInfo pagingInfo = new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = int.MaxValue };
            switch (type)
            {
                case "New":
                    //LitTitle.Text = "最新活动";
                    List<CY.UME.Core.Business.Activities> listActiveNew = CY.UME.Core.Business.Activities.GetAllCheck(pagingInfo).ToList();
                    count = listActiveNew.Count;
                    LblSearchNum.Text = "最新活动:共" + count + "条记录";
                    SetTitle("最新活动");
                    hdType.Value = "New";
                    break;
                case "Hot":
                    //LitTitle.Text = "最热活动";
                    count = CY.UME.Core.Business.Activities.HotCheckCount();
                    LblSearchNum.Text = "最热活动:共" + count + "条记录";
                    SetTitle("最热活动");
                    hdType.Value = "Hot";
                    break;
                case "MyGroup":
                    //LitTitle.Text = "我的小组发起的活动";
                    CY.UME.Core.Business.Group g = new CY.UME.Core.Business.Group();
                    List<CY.UME.Core.Business.Group> groupList = g.GetGroupsByAccountId(CurrentAccount).ToList();//获取用户所在的群组列表
                    if (groupList != null && groupList.Count > 0)
                    {
                        count = CY.UME.Core.Business.Activities.getMyGroupCheckTotalCount(groupList, CurrentAccount.Id);
                    }
                    else
                    {
                        count = 0;
                    }
                    LblSearchNum.Text = "我的小组发起的活动:共" + count + "条记录";
                    SetTitle("我的小组发起的活动");
                    hdType.Value = "MyGroup";
                    break;
                case "MyFriend":
                    //LitTitle.Text = "我的好友参加的活动";
                    SetTitle("我的好友参加的活动");
                    hdType.Value = "MyFriend";

                    List<CY.UME.Core.Business.Friendship> ac = CurrentAccount.GetFriendships();
                    List<CY.UME.Core.Business.Account> accountList = new List<CY.UME.Core.Business.Account>();
                    if (ac != null && ac.Count > 0)
                    {
                        for (int i = 0; i < ac.Count; i++)
                        {
                            CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(ac[i].FriendId);
                            if (account != null)
                            {
                                accountList.Add(account);
                            }
                        }
                    }
                    List<CY.UME.Core.Business.ActivitieParticipants> GetMyFriendLoveList = CY.UME.Core.Business.Activities.GetMyFriendLoveCheck(accountList, pagingInfo).ToList();//找出所有的活动参与者列表
                    List<CY.UME.Core.Business.Activities> activiteListResult = new List<CY.UME.Core.Business.Activities>();
                    if (GetMyFriendLoveList != null && GetMyFriendLoveList.Count > 0)
                    {
                        //根据活动ID取得活动列表
                        for (int p = 0; p < GetMyFriendLoveList.Count; p++)
                        {
                            CY.UME.Core.Business.Activities acTivite = CY.UME.Core.Business.Activities.Load(GetMyFriendLoveList[p].ActivitieId);
                            if (acTivite != null && acTivite.IsCheck == true)
                            {
                                activiteListResult.Add(acTivite);
                            }
                        }
                        count = activiteListResult.Count;
                    }
                    else
                    {
                        count = 0;
                    }
                    LblSearchNum.Text = "我的好友参加的活动:共" + count + "条记录";
                    break;
                case "ActiveType":
                    int Typeid = CY.Utility.Common.ConvertUtility.ConvertToInt(Request.QueryString["id"].ToString(), 0);
                    List<CY.UME.Core.Business.Activities> listActiveByType = CY.UME.Core.Business.Activities.GetListByType(Typeid, pagingInfo).ToList();
                    count = listActiveByType.Count;
                    CY.UME.Core.Business.ActivitiesType at = CY.UME.Core.Business.ActivitiesType.Load(Typeid);
                    string typeName = string.Empty;
                    if (at != null && !string.IsNullOrEmpty(at.Name))
                    {
                        typeName = at.Name;
                    }
                    else
                    {
                        typeName = "全部活动";
                    }
                    LblSearchNum.Text = typeName + ":共" + count + "条记录";
                    //LitTitle.Text = typeName;
                    SetTitle(typeName + "活动");
                    hdType.Value = "ActiveType";
                    hdActiveTypeID.Value = Request.QueryString["id"].ToString();
                    break;
                case "MyParticipantActive":
                    //LitTitle.Text = "我要的活动";
                    //List<CY.UME.Core.Business.Activities> listMyParticipantActive = CY.UME.Core.Business.Activities.GetMyActiviteCheck(CurrentAccount.Id, pagingInfo).ToList();
                    count = CY.UME.Core.Business.Activities.MyActiviteCheckCount(CurrentAccount.Id);
                    LblSearchNum.Text = "我参加的活动:共" + count + "条记录";
                    SetTitle("我参加的活动");
                    hdType.Value = "MyParticipantActive";
                    //hdCurrentId.Value = CurrentAccount.Id.ToString();
                    break;
                case "OtherParticipantActive":
                    long uid = 0;
                    CY.UME.Core.Business.Account accountTemp;
                    if (Request.QueryString["uid"] == null)
                    {
                        uid = CurrentAccount.Id;
                        accountTemp = CurrentAccount;
                    }
                    else
                    {
                        long.TryParse(Request.QueryString["uid"].ToString(), out uid);
                        accountTemp = CY.UME.Core.Business.Account.Load(uid);
                    }

                    if (accountTemp == null)
                    {
                        break;
                    }

                    count = CY.UME.Core.Business.Activities.MyActiviteCheckCount(uid);
                    LblSearchNum.Text = "共" + count + "条记录";
                    SetTitle(accountTemp.Name + "参加的活动");
                    hdType.Value = "OtherParticipantActive";
                    hdUid.Value = uid.ToString();
                    //hdCurrentId.Value = CurrentAccount.Id.ToString();
                    break;
                case "HotOrganizer":
                    //LitTitle.Text = "最热主办方";
                    List<CY.UME.Core.Business.Activities> listHotOrganizer = CY.UME.Core.Business.Activities.GetHotOrganizerCheck(pagingInfo).ToList();
                    count = listHotOrganizer.Count;
                    LblSearchNum.Text = "最热主办方:共" + count + "条记录";
                    SetTitle("最热主办方");
                    hdType.Value = "HotOrganizer";
                    break;
                case "Search":
                    if (Request.QueryString["name"] != null)
                    {
                        string name = Server.UrlDecode(Request.QueryString["name"].ToString());
                        searchName.Value = Request.QueryString["name"].ToString();//不解码
                        List<CY.UME.Core.Business.Activities> listActiveSearch = CY.UME.Core.Business.Activities.SearchByName(name, pagingInfo).ToList();
                        count = listActiveSearch.Count;
                        LblSearchNum.Text = name + ":共" + count + "条记录";
                        SetTitle("搜索活动:" + name);
                        hdType.Value = "Search";
                        //LitTitle.Text = "活动搜索";
                    }
                    break;
                case "MemberInGroup":
                    if (Request.QueryString["aid"] != null)
                    {
                        int id = CY.Utility.Common.ConvertUtility.ConvertToInt(Request.QueryString["aid"], 1);
                        ActiveID = id;
                        count = CY.UME.Core.Business.Activities.GetJionGroupCount(id);
                        LblSearchNum.Text = "活动成员所在小组:共" + count + "条记录";
                        SetTitle("活动成员所在小组");
                        hdType.Value = "MemberInGroup";
                    }
                    break;
                case "InOtherActive":
                    if (Request.QueryString["aid"] != null)
                    {
                        int id = CY.Utility.Common.ConvertUtility.ConvertToInt(Request.QueryString["aid"], 1);
                        ActiveID = id;
                        count = CY.UME.Core.Business.Activities.GetOtherFollowActive(id);
                        LblSearchNum.Text = "他们还喜欢这些活动:共" + count + "条记录";
                        SetTitle("他们还喜欢这些活动");
                        hdType.Value = "InOtherActive";
                    }
                    break;
                default:
                    List<CY.UME.Core.Business.Activities> listActiveNew2 = CY.UME.Core.Business.Activities.GetAllCheck(pagingInfo).ToList();
                    count = listActiveNew2.Count;
                    LblSearchNum.Text = "最新活动:共" + count + "条记录";
                    SetTitle("最新活动");
                    hdType.Value = "New";
                    break;
            }

            RightControl2.activeID = ActiveID;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                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.CheckIsManager(CurrentAccount))
                {
                    throw new Exception("您无权查看该页面");
                }

                BindData(group);

                ViewState["groupId"] = groupId;

                mgp_HiddenOperation.Value = selOperation.Value;

                SetTitle(group.Name+"-图片管理");
            }

            base.CSSName = "ume2";
        }
Example #27
0
        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 + " - 话题");
                }
            }
        }
Example #28
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            try
            {
                long instanceId; // 空间用户的标识 || 群Id
                long referedId; // 回复留言的标识
                string content;
                string type = String.Empty;//类型(SpaceCommentExtend)
                CY.UME.Core.Business.Account currentAccount; // 留言的用户
                CY.UME.Core.Business.Account spaceAccount = new CY.UME.Core.Business.Account(); // 所在个人主页的用户
                CY.UME.Core.Business.SpaceComment referedComment = new CY.UME.Core.Business.SpaceComment(); // 所回复的留言
                CY.UME.Core.Business.SpaceComment comment = new CY.UME.Core.Business.SpaceComment(); // 留言
                CY.UME.Core.Business.Group group = new CY.UME.Core.Business.Group();//群组
                CY.UME.Core.Business.Activities active = new CY.UME.Core.Business.Activities();//活动

                #region Validateion and Get Basic Data

                if (!CY.Utility.Common.ParseUtility.TryParseInt64(context.Request.Form["uid"], out instanceId) ||
                    !CY.Utility.Common.ParseUtility.TryParseInt64(context.Request.Form["referedId"], out referedId))
                {
                    context.Response.Write("{success:false,msg:'参数错误'}");
                    return;
                }

                if (context.Request.Form["type"] != null)
                {
                    type = context.Request.Form["type"].ToString();
                }

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

                // 所在个人主页的用户
                if (instanceId == 0 && type.Length == 0)
                {
                    instanceId = currentAccount.Id;
                    spaceAccount = currentAccount;
                }
                else if (type.Length == 0)
                {
                    spaceAccount = CY.UME.Core.Business.Account.Load(instanceId);

                    if (spaceAccount == null)
                    {
                        context.Response.Write("{success:false,msg:'用户不存在'}");
                        return;
                    }
                }
                else if (type == "group")
                {
                    group = CY.UME.Core.Business.Group.Load((int)instanceId);

                    if (group == null)
                    {
                        context.Response.Write("{success:false,msg:'该群组不存在或已被删除'}");
                        return;
                    }
                }
                else if (type == "active")
                {
                    active = CY.UME.Core.Business.Activities.Load((int)instanceId);
                    if (active == null)
                    {
                        context.Response.Write("{success:false,msg:'该活动不存在或已被删除'}");
                        return;
                    }
                }

                // 所回复的留言
                if (referedId > 0)
                {
                    referedComment = CY.UME.Core.Business.SpaceComment.Load(referedId);
                    if (referedComment == null)
                    {
                        context.Response.Write("{success:false,msg:'所回复的留言已被删除'}");
                        return;
                    }
                }

                // 留言内容
                content = context.Request.Form["content"];
                if (string.IsNullOrEmpty(content))
                {
                    context.Response.Write("{success:false,msg:'留言内容不能为空'}");
                    return;
                }

                #endregion

                #region Leave Msg,Notice

                if (type.Length == 0)//个人空间留言
                {
                    // 将留言或者回复信息发送给空间主人
                    comment.AccountId = spaceAccount.Id;
                    comment.Content = content;
                    comment.IsPublic = (context.Request.Form["isPublic"] == "0") ? false : true;
                    comment.ReferedId = referedId;
                    comment.AuthorId = currentAccount.Id;
                    comment.DateCreated = DateTime.Now;
                    comment.InstanceId = 0;
                    comment.IP = CY.Utility.Common.RequestUtility.ClientIP;
                    comment.Save();

                    if (spaceAccount.Id != currentAccount.Id) // 不是在自己空间,留言则通知空间主人,回复则通知所回复的留言的作者
                    {
                        CY.UME.Core.Business.Notice notice = new CY.UME.Core.Business.Notice();
                        notice.AuthorId = comment.AuthorId;
                        notice.IsReaded = false;
                        notice.DateCreated = DateTime.Now;
                        notice.InstanceId = comment.Id.ToString();

                        if (comment.ReferedId < 1) // 留言
                        {
                            notice.Type = "info";
                            notice.AccountId = instanceId;
                            //notice.Content = currentAccount.Name + "给您留言了";
                            notice.Content = "给您留言了";
                            notice.Save();
                        }
                        else // 回复
                        {
                            if (referedComment.Id > 0)
                            {
                                notice.Type = "inforeply";
                                notice.AccountId = referedComment.AuthorId;

                                if (referedComment.AuthorId == spaceAccount.Id) // 回复空间主人
                                {
                                    //notice.Content = currentAccount.Name + "回复了您的留言";
                                    notice.Content = "回复了您的留言";
                                }
                                else // 在别人页面回复了另外一个人
                                {
                                    //notice.Content = currentAccount.Name + "回复了您在 " + spaceAccount.Name + " 处的留言";
                                    notice.Content = "回复了您在 " + spaceAccount.Name + " 处的留言";

                                    // 在所引用的留言的作者处添加一条回复副本
                                    CY.UME.Core.Business.SpaceComment commentCopy = new CY.UME.Core.Business.SpaceComment();
                                    commentCopy.AccountId = referedComment.AuthorId;
                                    commentCopy.AuthorId = currentAccount.Id;
                                    commentCopy.Content = comment.Content;
                                    commentCopy.DateCreated = comment.DateCreated;
                                    commentCopy.InstanceId = comment.InstanceId;
                                    commentCopy.IP = comment.IP;
                                    commentCopy.IsPublic = comment.IsPublic;
                                    commentCopy.ReferedId = comment.ReferedId;
                                    commentCopy.Save();

                                    notice.InstanceId = commentCopy.Id.ToString();
                                }
                                notice.Save();
                            }
                        }
                    }
                    else // 在自己空间内
                    {
                        if (referedComment.Id > 0 && referedComment.AuthorId != currentAccount.Id) // 为回复他人
                        {
                            CY.UME.Core.Business.Notice notice = new CY.UME.Core.Business.Notice();
                            notice.AuthorId = comment.AuthorId;
                            notice.IsReaded = false;
                            notice.DateCreated = DateTime.Now;
                            notice.Type = "inforeply";
                            notice.AccountId = referedComment.AuthorId;
                            //notice.Content = currentAccount.Name + "回复了您的留言";
                            notice.Content = "回复了您的留言";

                            // 在所引用的留言的作者处添加一条回复副本,方便其在他的个人空间内查看到
                            CY.UME.Core.Business.SpaceComment commentCopy = new CY.UME.Core.Business.SpaceComment();
                            commentCopy.AccountId = referedComment.AuthorId;
                            commentCopy.AuthorId = currentAccount.Id;
                            commentCopy.Content = comment.Content;
                            commentCopy.DateCreated = comment.DateCreated;
                            commentCopy.InstanceId = comment.InstanceId;
                            commentCopy.IP = comment.IP;
                            commentCopy.IsPublic = comment.IsPublic;
                            commentCopy.ReferedId = comment.ReferedId;
                            commentCopy.Save();

                            notice.InstanceId = commentCopy.Id.ToString();
                            notice.Save();
                        }
                    }
                }
                else if (type == "group")//群留言
                {
                    //保存留言
                    comment.AuthorId = currentAccount.Id;
                    comment.AccountId = 0;
                    comment.Content = content;
                    comment.DateCreated = DateTime.Now;
                    comment.InstanceId = group.Id;
                    comment.IP = CY.Utility.Common.RequestUtility.ClientIP;
                    comment.IsPublic = true;
                    comment.ReferedId = referedId;

                    comment.Save();

                    //保存到留言扩展信息
                    CY.UME.Core.Business.SpaceCommentExtend spaceCommentExtend = new CY.UME.Core.Business.SpaceCommentExtend();

                    spaceCommentExtend.AccountId = group.CreatorId;
                    spaceCommentExtend.Id = comment.Id;
                    spaceCommentExtend.InstanceId = group.Id.ToString();
                    spaceCommentExtend.Type = "group";

                    spaceCommentExtend.Save();

                    //留言回复通知
                    if (referedId > 0 && referedComment.AuthorId != currentAccount.Id)
                    {
                        CY.UME.Core.Business.Notice groupLeaveWordsNotice = new CY.UME.Core.Business.Notice();

                        groupLeaveWordsNotice.AccountId = referedComment.AuthorId;
                        groupLeaveWordsNotice.AuthorId = comment.AuthorId;
                        groupLeaveWordsNotice.Content = "回复了您的留言";
                        groupLeaveWordsNotice.DateCreated = DateTime.Now;
                        groupLeaveWordsNotice.InstanceId = comment.InstanceId.ToString();
                        groupLeaveWordsNotice.IsReaded = false;
                        groupLeaveWordsNotice.Type = "groupinforeply";

                        groupLeaveWordsNotice.Save();
                    }
                }
                else if (type == "active")//活动留言
                {
                    //保存留言
                    comment.AuthorId = currentAccount.Id;
                    comment.AccountId = active.Sponsor;
                    comment.Content = content;
                    comment.DateCreated = DateTime.Now;
                    comment.InstanceId = active.Id;
                    comment.IP = CY.Utility.Common.RequestUtility.ClientIP;
                    comment.IsPublic = true;
                    comment.ReferedId = referedId;

                    comment.Save();

                    //保存到留言扩展信息
                    CY.UME.Core.Business.SpaceCommentExtend spaceCommentExtend = new CY.UME.Core.Business.SpaceCommentExtend();

                    spaceCommentExtend.AccountId = active.Sponsor;
                    spaceCommentExtend.Id = comment.Id;
                    spaceCommentExtend.InstanceId = active.Id.ToString();
                    spaceCommentExtend.Type = "active";

                    spaceCommentExtend.Save();

                    //留言回复通知
                    if (referedId > 0 && referedComment.AuthorId != currentAccount.Id)
                    {
                        CY.UME.Core.Business.Notice groupLeaveWordsNotice = new CY.UME.Core.Business.Notice();

                        groupLeaveWordsNotice.AccountId = referedComment.AuthorId;
                        groupLeaveWordsNotice.AuthorId = comment.AuthorId;
                        groupLeaveWordsNotice.Content = "回复了您的留言";
                        groupLeaveWordsNotice.DateCreated = DateTime.Now;
                        groupLeaveWordsNotice.InstanceId = comment.InstanceId.ToString();
                        groupLeaveWordsNotice.IsReaded = false;
                        groupLeaveWordsNotice.Type = "activeinforeply";

                        groupLeaveWordsNotice.Save();
                    }
                }
                #endregion

                StringBuilder sb = new StringBuilder();
                sb.Append("{success:true, msg: '添加成功!', account: {");
                sb.Append("Id: " + comment.AuthorId);
                sb.Append(", Name: '");
                sb.Append(currentAccount.Name);
                sb.Append("'}, commentId: ");
                sb.Append(comment.Id);
                sb.Append("}");

                context.Response.Write(sb.ToString());
            }
            catch (Exception ex)
            {
                context.Response.Write("{success:false, msg:'添加失败!错误信息:" + CY.Utility.Common.StringUtility.RemoveIllegalCharacters(ex.Message) + "'}");
            }
        }
Example #29
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);
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetTitle("群组照片 ");

            #region 判断验证
            long pictureId = 0;
            int groupId = 0;

            if (Request.QueryString["pictureId"] == null)
            {
                throw new Exception("参数不存在");
            }
            else if (!long.TryParse(Request.QueryString["pictureId"].ToString(), out pictureId))
            {
                throw new Exception("参数不合法");
            }

            picture = CY.UME.Core.Business.Picture.Load(pictureId);

            if (picture == null)
            {
                throw new Exception("图片不存在或已被删除");
            }

            album = CY.UME.Core.Business.Album.Load(picture.AlbumId);

            albumExtend = CY.UME.Core.Business.AlbumExtend.Load(album.Id);

            SpaceAccount = CY.UME.Core.Business.Account.Load(albumExtend.AccountId);

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

            if (Request.QueryString["groupId"] == null)
            {
                throw new Exception("参数不存在");
            }

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

            group = CY.UME.Core.Business.Group.Load(groupId);
            al_HiddenGroupId.Value = groupId.ToString();
            if (CurrentAccount == null || CurrentAccount.Id != SpaceAccount.Id)
            {
                if (album.ViewPermission == 1)//仅好友才能访问
                {
                    if (CurrentAccount == null || !SpaceAccount.HasFriendshipWith(CurrentAccount))//判断是否是好友
                    {
                        Response.Write("您无权访问该页面");
                        return;
                    }
                }
                else if (album.ViewPermission == 2)//密码访问
                {
                    if (Session["AlbumPassword"] == null)
                    {
                        Response.Redirect("ViewEnAlbum.aspx?uid=" + SpaceAccount.Id + "&albumId=" + album.Id);
                        return;
                    }
                    else
                    {
                        string password = Session["AlbumPassword"].ToString();
                        if (password != album.ViewPassword)//判断密码是否正确
                        {
                            Response.Redirect("ViewEnAlbum.aspx?uid=" + SpaceAccount.Id + "&albumId=" + album.Id);
                            return;
                        }
                    }
                }
                else if (album.ViewPermission == 3)
                {
                    Response.Write("您无权访问该页面");
                    return;
                }
            }

            #endregion

            if (!IsPostBack)
            {
                if (CurrentAccount != null)
                {
                    HF_CurrentAccount_Id.Value = CurrentAccount.Id.ToString();
                }

                LblTitleName.Text = group.Name;
                picInfoMana.Visible = true;

                LblAlbumName.Text = album.Name;

                if (album.IsAvatar)
                {//头像相册
                    uploadPic.Visible = false;
                    UploadAvatar.Visible = true;
                }
                else
                {//普通相册
                    uploadPic.Visible = true;
                    UploadAvatar.Visible = false;
                }

                LBLAlbumNameAndLink.Text = "<a href=\"PictureList.aspx?albumId=" + album.Id + "&spaceId=" + CurrentAccount.Id + "\">" + LblAlbumName.Text + "</a>";

                //UserInfo1.SpaceAccount = SpaceAccount;//个人信息
                FollowerListId.CurrentFollower = SpaceAccount;

                CY.UME.Core.PagingInfo pagingInfo = new CY.UME.Core.PagingInfo();
                pagingInfo.CurrentPage = 1;
                pagingInfo.PageSize = int.MaxValue;

                IList<CY.UME.Core.Business.Picture> picList = CY.UME.Core.Business.Picture.GetAllPicture(album, pagingInfo);

                StringBuilder sb = new StringBuilder();

                sb.Append("{");
                sb.Append("TotalRecords:'" + album.PhotoCount.ToString() + "'");
                sb.Append(",AccountId:'" + SpaceAccount.Id.ToString() + "'");
                sb.Append(",CurrentId:'" + (CurrentAccount == null ? "0" : CurrentAccount.Id.ToString()) + "'");
                sb.Append(",AlbumId:'" + album.Id.ToString() + "'");
                sb.Append(",PictureId:'" + pictureId.ToString() + "'");
                sb.Append(",SiteUrl:'" + SiteUrl + "'");
                sb.Append(",Pictures:[");

                int Num = 1;
                bool IsCheck = false;

                foreach (CY.UME.Core.Business.Picture pic in picList)
                {
                    if (pic.Id == picture.Id)
                    {
                        IsCheck = true;
                    }
                    if (!IsCheck)
                    {
                        Num++;
                    }

                    sb.Append("{");
                    sb.Append("Id:'" + pic.Id + "'");
                    sb.Append(",Remark:'" + pic.Remark + "'");
                    sb.Append(",DateCreated:'" + pic.DateCreated.ToString("yyyy年MM月dd") + "'");
                    sb.Append(",Name:'" + pic.Name + "'");
                    sb.Append(",AlbumViewPermission:'" + album.ViewPermission + "'");
                    sb.Append("},");
                }

                sb.Remove(sb.Length - 1, 1);
                sb.Append("],CurrentNum:'" + Num.ToString() + "'");
                sb.Append("}");

                HiddenJson.Value = sb.ToString();
                HF_SiteUrl.Value = SiteUrl;
                HF_Album_Id.Value = album.Id.ToString();
                HF_TotalRecords.Value = CY.UME.Core.Business.Picture.GetAllPicture(album, pagingInfo).Count.ToString();//该相册照片数量
                //HiddenAccountDiff.Value = accountDiff;

                //绑定评论
                pictureCommentList = CY.UME.Core.Business.PictureComment.GetPicCommentByPagesAndPicId(picture);

                RPT_PicCommentList.DataSourceID = "";
                RPT_PicCommentList.DataSource = pictureCommentList;
                RPT_PicCommentList.DataBind();
            }
        }