protected void BindData(CY.UME.Core.Business.Group group) { CY.UME.Core.PagingInfo pageInfo = new CY.UME.Core.PagingInfo(); pageInfo.CurrentPage = 1; pageInfo.PageSize = 15; CY.UME.Core.Business.Album album =new CY.UME.Core.Business.Album(); if (group != null) { album = group.GetGroupAlbum(); picList = album.GetPictures(pageInfo); } int count = album.GetPictureCount(); DDLGroup.SelectedValue = group.Id.ToString(); minPubDate.Value = ""; maxPubDate.Value = ""; picname.Value = ""; authorName.Value = ""; gpm_HiddenPageSize.Value = "15"; gpm_HiddenRecordCount.Value = count.ToString(); gpm_HiddenSiteUrl.Value = SiteUrl; }
//绑定所有的相册 private string BingAlbumType(CY.UME.Core.Business.Account account,CY.UME.Core.Business.Group group) { if (group == null) { throw new Exception("该群组不存在或已被删除"); } int pageSize = 8; int viewPermission = 0; int albumCount = 0; if (!group.CheckIsGroupMember(account)) {//判断是否是群组成员 viewPermission = 1; } else { isManage = true; } albumList = group.GetGroupAlbum(viewPermission, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = pageSize }); albumCount = group.GetGroupAlbumCount(viewPermission); if (albumList == null || albumCount == 0) { return "false"; } DDLAlbum.DataTextField = "Name"; DDLAlbum.DataValueField = "Id"; DDLAlbum.DataSource = albumList; DDLAlbum.DataBind(); return DDLAlbum.Items[0].Value; }
protected void BindData(CY.UME.Core.Business.Group group) { TBXGroupName.Text = group.Name;//群组名 CY.UME.Core.Business.Album album = group.GetGroupAlbum(); string imgUrl = CY.UME.Core.Global.GroupCoverAddress; if (album == null) { album = group.CreateGroupAlbum(); } if (album.CoverPath.Length != 0) { imgUrl = album.CoverPath; } SelAddPermission.Value = group.AddPermission.ToString(); this.ScanRight.Value = group.ViewPermission.ToString(); DDLGroupType.SelectedValue = group.Type.ToString(); this.LeaveWords.Value = group.LeaveWordsPermission.ToString(); this.AddTopic.Value = group.AddTopicPermission.ToString(); this.AddPicture.Value = group.AddPicturePermission.ToString(); this.TopicReply.Value = group.AddTopicReplyPermission.ToString(); this.PictureReply.Value = group.AddPictureReplyPermission.ToString(); ImgGroupCover.ImageUrl = SiteUrl + imgUrl;//封面图片 TBXPlaCard.Text = group.PlaCard;//群组公告 }
protected void SetGroupCover(CY.UME.Core.Business.Group group) { if (group == null) { return; } CY.UME.Core.Business.Album album = group.GetGroupAlbum(); HttpPostedFile hpf = FUGroupCover.PostedFile; string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath; string dirPath = appPath + "/Content/Group/Album/" + group.Id + "/"; string fileName = "/Content/Group/Album/" + group.Id + "/" + DateTime.Now.ToString("yyyMMddhhmmss") + DateTime.Now.Millisecond.ToString() + ".jpg";//相册图片以加时间命名 string fileTempName = appPath + "/Content/temp/" + FUGroupCover.FileName; System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } hpf.SaveAs(fileTempName);//临时保存原始图片 Bitmap bmp = new Bitmap(fileTempName); int width = bmp.Width; int height = bmp.Height; bmp.Dispose(); 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; } CY.Utility.Common.ImageUtility.ThumbAsJPG(FUGroupCover.FileContent, appPath + fileName, width, height); if (File.Exists(fileTempName)) { File.Delete(fileTempName); } CY.UME.Core.Business.Album albumTemp = CY.UME.Core.Business.Album.Load(album.Id); if (albumTemp != null) { albumTemp.CoverPath = fileName; albumTemp.Save(); } }
private void BingAlbum(CY.UME.Core.Business.Group group, long albumId) { if (group == null) { return; } IList<CY.UME.Core.Business.Album> albumList = group.GetGroupAlbum(0, new CY.UME.Core.PagingInfo { CurrentPage = 1, PageSize = int.MaxValue }); List<CY.UME.Core.Business.Album> albums = new List<CY.UME.Core.Business.Album>(); foreach (CY.UME.Core.Business.Album a in albumList) { if (a.Id == albumId) { continue; } albums.Add(a); } if (albums.Count == 0) { toGroupAlbum.Visible = false; return; } DDLGroupAlbum.DataTextField = "Name"; DDLGroupAlbum.DataValueField = "Id"; DDLGroupAlbum.DataSource = albums; DDLGroupAlbum.DataBind(); }