/// <summary> /// 0 登录失败 -1请求失败 -2系统错误 albumId 成功 /// </summary> /// <param name="context"></param> /// <returns></returns> public string AddAlbum(HttpContext context) { string albumName = String.Empty;//相册名 CY.UME.Core.Business.AccountExtend ae;//当前用户 string email = context.Request.QueryString["email"].ToString().Trim(); #region validate if (String.IsNullOrEmpty(email)) { return "0"; } ae = CY.UME.Core.Business.AccountExtend.Load(email); if (ae == null) { return "0"; } if (context.Request.QueryString["Name"] != null) { albumName = context.Request.QueryString["Name"].ToString().Trim(); } #endregion try { CY.UME.Core.Business.Album album = new CY.UME.Core.Business.Album(); album.AccountId = ae.Id; album.DateCreated = DateTime.Now; album.IsAvatar = false; album.LastModifiedTime = DateTime.Now; album.Name = albumName; album.ViewPermission = 0; album.CoverPath = CY.UME.Core.Global.AlbumCoverAddress; album.Save(); return album.Id.ToString(); } catch { return "-2"; } }
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 }
private CY.UME.Core.Business.Album GetActivityAlbum(string type, string instanceId, string albumName) { IList<CY.UME.Core.Business.AlbumExtend> aeList = CY.UME.Core.Business.AlbumExtend.GetAlbumExtend(CurrentAccount.Id, type, instanceId); long aId = 0; CY.UME.Core.Business.Album album = new CY.UME.Core.Business.Album(); if (aeList.Count != 0) { aId = aeList[0].Id; } //创建活动相册 if (aId == 0) { album.AccountId = CurrentAccount.Id; album.DateCreated = DateTime.Now; album.IsAvatar = false; album.LastModifiedTime = DateTime.Now; album.Name = albumName; album.ViewPermission = 0; album.Save(); CY.UME.Core.Business.AlbumExtend ae = new CY.UME.Core.Business.AlbumExtend(); ae.Type = type; ae.InstanceId = instanceId; ae.AccountId = album.AccountId; ae.Id = album.Id; ae.Save(); aId = album.Id; } else { album = CY.UME.Core.Business.Album.Load(aId); } return album; }
/// <summary> /// 接受手机上传图片 /// </summary> /// <param name="context"></param> /// <returns>0 登录失败 -1请求失败 -2系统错误 -3无图片</returns> public string UploadPicture(HttpContext context) { string email = String.Empty; string description = String.Empty; string strAlbumId = String.Empty; long albumId = 0; string imgName = String.Empty; CY.UME.Core.Business.AccountExtend accountExtend; try { System.IO.Stream s1 = context.Request.InputStream; System.IO.StreamReader sr1 = new System.IO.StreamReader(s1); #region 获取参数并验证 //取参数 if (context.Request.QueryString["AlbumId"] == null || context.Request.QueryString["email"] == null) { return "-1"; } strAlbumId = context.Request.QueryString["AlbumId"].ToString(); if (context.Request.QueryString["Description"] != null) { description = context.Request.QueryString["Description"].ToString(); } email = context.Request.QueryString["email"].ToString(); if (context.Request.QueryString["ImgName"] != null) { imgName = context.Request.QueryString["ImgName"].ToString(); } if (!long.TryParse(strAlbumId, out albumId)) { return "-1"; } accountExtend = CY.UME.Core.Business.AccountExtend.Load(email); if (accountExtend == null) { return "0"; } #endregion string imgExtention = CY.Utility.Common.FileUtility.GetFileExtension(imgName); string imgRealName = CY.Utility.Common.FileUtility.GetFileName(imgName); string appPath = CY.Utility.Common.RequestUtility.CurPhysicalApplicationPath; string dirPath = appPath + "/Content/Album/" + accountExtend.Id + "/"; string fileName = "/Content/Album/" + accountExtend.Id + "/" + DateTime.Now.ToString("yyyMMddhhmmss") + DateTime.Now.Millisecond.ToString();//相册图片以加时间命名 System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dirPath); if (!di.Exists) { di.Create(); } if (context.Request.InputStream.Length == 0) { return "-3"; } System.IO.Stream s = context.Request.InputStream; byte[] bytes = new byte[s.Length]; s.Read(bytes, 0, bytes.Length); s.Seek(0, SeekOrigin.Begin); Stream stream = new MemoryStream(bytes); Image image = Image.FromStream(stream); s.Close(); int width = image.Width; int height = image.Height; string bImgName = appPath + fileName + "_big" + imgExtention; string mImgName = appPath + fileName + "_middle" + imgExtention; string sImgName = appPath + fileName + "_small" + imgExtention; if (height < width) { if (width > 600) { height = Convert.ToInt32(width > 600 ? (600f / width) * height : height); width = 600; } } else { if (height > 600) { width = Convert.ToInt32(height > 600 ? (600f / height) * width : height); height = 600; } } CY.Utility.Common.ImageUtility.ThumbAsJPG(stream, bImgName, width, height);//大图片 if (height < width) { if (width > 200) { height = Convert.ToInt32(width > 200 ? (200f / width) * height : height); width = 200; } } else { if (height > 200) { width = Convert.ToInt32(height > 200 ? (200f / height) * width : height); height = 200; } } CY.Utility.Common.ImageUtility.ThumbAsJPG(stream, sImgName, width, height); if (height < width) { if (width > 100) { height = Convert.ToInt32(width > 100 ? (100f / width) * height : height); width = 100; } } else { if (height > 100) { width = Convert.ToInt32(height > 100 ? (100f / height) * width : height); height = 100; } } CY.Utility.Common.ImageUtility.ThumbAsJPG(stream, mImgName, width, height); //更换相册封面 CY.UME.Core.Business.Album album = CY.UME.Core.Business.Album.Load(albumId); if (album == null) { album = new CY.UME.Core.Business.Album(); album.AccountId = accountExtend.Id; album.DateCreated = DateTime.Now; album.IsAvatar = false; album.Name = "默认相册"; album.ViewPermission = 0; album.CoverPath = fileName + "_middle" + imgExtention; album.Save(); } else 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(imgRealName); pic.SmallPath = fileName + "_small" + imgExtention; pic.Remark = description; pic.Save(); CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(accountExtend.Id); account.SendNoticeToAllFriendAndFollower("picture", "上传了新照片", pic.Id.ToString()); return "1"; } catch (Exception e) { return e.Message; } }
/// <summary> /// 0 登录失败 -1请求失败 -2系统错误 /// </summary> /// <param name="context"></param> /// <returns></returns> public string GetAlbumList(HttpContext context) { string email = context.Request.QueryString["email"].ToString().Trim(); if (String.IsNullOrEmpty(email)) { return "0"; } try { CY.UME.Core.Business.AccountExtend ae = CY.UME.Core.Business.AccountExtend.Load(email); if (ae == null || ae.Id == 0) { return "0"; } CY.UME.Core.Business.Account account; long accountId = 0; if (context.Request.QueryString["FriendId"] == null) { account = CY.UME.Core.Business.Account.Load(ae.Id); } else { if (!long.TryParse(context.Request.QueryString["FriendId"].ToString(), out accountId)) { account = CY.UME.Core.Business.Account.Load(ae.Id); } else { account = CY.UME.Core.Business.Account.Load(accountId); } } if (account == null) { return "-1"; } List<CY.UME.Core.Business.Album> albumAvatarList = CY.UME.Core.Business.Album.GetAll(account, true); CY.UME.Core.Business.Album albumAvatar = new CY.UME.Core.Business.Album(); if (albumAvatarList.Count > 0) { albumAvatar = albumAvatarList[0]; } List<CY.UME.Core.Business.Album> albumList = CY.UME.Core.Business.Album.GetAll(account, false); if (albumList == null || albumList.Count == 0) { CY.UME.Core.Business.Album al = new CY.UME.Core.Business.Album(); al.AccountId = account.Id; al.DateCreated = DateTime.Now; al.IsAvatar = false; al.LastModifiedTime = DateTime.Now; al.Name = "默认相册"; al.ViewPermission = 0; al.Save(); albumList.Add(al); } StringBuilder sb = new StringBuilder(); sb.Append("["); if (albumAvatar != null) { sb.Append("{\"Id\":" + albumAvatar.Id); sb.Append(",\"Name\":\"" + albumAvatar.Name + "\""); sb.Append(",\"Count\":" + albumAvatar.PhotoCount + "},"); } foreach (CY.UME.Core.Business.Album album in albumList) { sb.Append("{\"Id\":" + album.Id); sb.Append(",\"Name\":\"" + album.Name.Replace("\"", """) + "\""); sb.Append(",\"Count\":" + album.PhotoCount + "},"); } sb.Remove(sb.Length - 1, 1); sb.Append("]"); return sb.ToString(); } catch { return "-2"; } }
private void SaveFiles(int id, string name, HttpPostedFile files) { string fileExtension = CY.Utility.Common.FileUtility.GetFileExtension(files.FileName).ToLower();//后缀名 if (fileExtension != ".jpg" && fileExtension != ".jpeg" && fileExtension != ".gif" && fileExtension != ".png" && fileExtension != ".bmp") { base.ExecuteClientScript("$('#add_msg').html('图片格式不正确,请重新选择图片上传。').fadeOut(10000, function () { $(this).html('').show(); });"); return; } CY.UME.Core.Business.Album album = new CY.UME.Core.Business.Album(); album.AccountId = 0;// CurrentAccount.Id;//当前用户ID() album.DateCreated = DateTime.Now; album.IsAvatar = false; album.Name = name;//活动名称 string appPath = Request.PhysicalApplicationPath; string baseurl = "/Content/Activites/" + CurrentAccount.Id; string bPath = @"\Content\Activites\" + CurrentAccount.Id; DirectoryInfo di = new DirectoryInfo(appPath + bPath); if (!di.Exists) { di.Create(); } string fileSHowName = files.FileName; int dotIndex = files.FileName.IndexOf("\\"); string fileName = string.Empty; if (dotIndex == -1) { fileName = CY.Utility.Common.FileUtility.GetFileName(files.FileName);//文件名 } else { string fileNameTemp = CY.Utility.Common.FileUtility.GetFileName(files.FileName); int indElx = fileNameTemp.LastIndexOf("\\") + 1; fileName = fileNameTemp.Substring(indElx); } //string saveFileName = fileName + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString(); string saveFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString(); files.SaveAs(appPath + bPath + "\\" + saveFileName + fileExtension); album.CoverPath = baseurl + "/" + saveFileName + fileExtension; album.Save(); string temp = bPath + "\\" + saveFileName; CompressImg(appPath, temp, fileExtension, id, album.Id); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; CY.UME.Core.Business.Account account; string bigImgPath, smallImgPath, imgExtention, imgName; string sitePath = CY.Utility.Common.SiteUtility.CurSitePath; String Id = context.Request.QueryString["accountId"].ToString(); long accountId = CY.Utility.Common.ConvertUtility.ConvertToInt(Id, -1); #region -Validation and Get Basic Data- //account = CY.UME.Core.Global.GetCurrentAccount(); account = CY.UME.Core.Business.Account.Load(accountId); if (account == null) { context.Response.Write("{success: false, msg: '用户登录超时,请重新登录!'}"); return; } // post data bigImgPath = context.Request.Form["bigImgPath"]; smallImgPath = context.Request.Form["smallImgPath"]; imgExtention = context.Request.Form["imgExtention"]; imgName = context.Request.Form["imgName"]; if (string.IsNullOrEmpty(bigImgPath) || string.IsNullOrEmpty(smallImgPath) || string.IsNullOrEmpty(imgExtention)) { context.Response.Write("{success: false, msg: '参数错误'}"); return; } if (!File.Exists(sitePath + bigImgPath)) { context.Response.Write("{success: false, msg: '照片不存在'}"); return; } if (!File.Exists(sitePath + smallImgPath)) { context.Response.Write("{success: false, msg: '小头像不存在'}"); return; } #endregion CY.UME.Core.Business.Album avatarAlbum = account.GetMyAvatarAlbum(); if (avatarAlbum == null) { avatarAlbum = new CY.UME.Core.Business.Album(); avatarAlbum.AccountId = account.Id; avatarAlbum.DateCreated = DateTime.Now; avatarAlbum.IsAvatar = true; avatarAlbum.LastModifiedTime = avatarAlbum.DateCreated; avatarAlbum.Name = "头像相册"; avatarAlbum.Save(); } // 相册目录为: 网站根目录 + /Content/Avatar/ + 用户标识 string avatarRelativePath = "/Content/Avatar/" + account.Id + "/"; DirectoryInfo di = new DirectoryInfo(sitePath + avatarRelativePath); // 相册目录 if (!di.Exists) { di.Create(); } string uniqueId = Guid.NewGuid().ToString("N"); string bImgName = uniqueId + "_big" + imgExtention; string mImgName = uniqueId + "_mid" + imgExtention; string sImgName = uniqueId + "_small" + imgExtention; try { Bitmap bmp = new Bitmap(sitePath + bigImgPath); int width = bmp.Width; int height = bmp.Height; bmp.Dispose(); height = Convert.ToInt32(width > 200 ? (200f / width) * height : height); width = 200; // 将大图片压缩为中等缩略图 using (StreamReader reader = new StreamReader(sitePath + bigImgPath)) { CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, di.FullName + mImgName, width, height); } // 将小头像从120*120压缩到48*48 using (StreamReader reader = new StreamReader(sitePath + smallImgPath)) { CY.Utility.Common.ImageUtility.ThumbAsJPG(reader.BaseStream, di.FullName + sImgName, 48, 48); } // 将大图移动到头像目录下 FileInfo fi = new FileInfo(sitePath + bigImgPath); fi.MoveTo(di.FullName + bImgName); try { // File.Delete(sitePath + bigImgPath); File.Delete(sitePath + smallImgPath); } catch { ; } // 添加照片记录 CY.UME.Core.Business.Picture picture = new CY.UME.Core.Business.Picture(); picture.AlbumId = avatarAlbum.Id; picture.BigPath = avatarRelativePath + bImgName; picture.DateCreated = DateTime.Now; picture.MiddlePath = avatarRelativePath + mImgName; picture.Name = imgName; picture.Remark = string.Empty; picture.SmallPath = avatarRelativePath + sImgName; picture.Save(); if (!account.HasAvatar) { account.HasAvatar = true; #region 积分 int uploadAvatarCredit; if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditUploadAvatar", out uploadAvatarCredit) && (uploadAvatarCredit != 0)) { int orgCredit = account.Credit; int modifiedCredit = orgCredit + uploadAvatarCredit; account.Credit = modifiedCredit; CY.UME.Core.Business.CreditHistory ch = new CY.UME.Core.Business.CreditHistory(); ch.AccountId = account.Id; ch.DateCreated = DateTime.Now; ch.Id = Guid.NewGuid(); ch.InstanceId = ""; ch.Original = orgCredit; ch.Modified = modifiedCredit; ch.Variation = uploadAvatarCredit; ch.Type = "uploadavatar"; ch.Description = "上传头像"; ch.Save(); } #endregion account.Save(); } //添加通知 //account.SendNoticeToAllFriend("picture", "更新了头像", picture.Id.ToString()); context.Response.Write("{success: true}"); return; } catch { context.Response.Write("{success: false, msg: '保存头像失败'}"); return; } }
protected void Save_OnClick(object sender, EventArgs e) { if (ViewState["accountId"] == null) { throw new Exception("系统异常"); } CY.UME.Core.Business.Album alb = new CY.UME.Core.Business.Album(); if (ViewState["albumId"] != null && ViewState["IsModify"] != null && bool.Parse(ViewState["IsModify"].ToString())) { alb = CY.UME.Core.Business.Album.Load(long.Parse(ViewState["albumId"].ToString())); } else { alb.AccountId = int.Parse(ViewState["accountId"].ToString()); alb.DateCreated = DateTime.Now; alb.CoverPath = CY.UME.Core.Global.AlbumCoverAddress; } alb.LastModifiedTime = DateTime.Now; alb.Name = TBXAlbumName.Text.Trim(); if (alb.ViewPermission==2 && alb.ViewPermission != int.Parse(SelViewPermission.Value)) { alb.ViewPassword = String.Empty; } alb.ViewPermission = int.Parse(SelViewPermission.Value); if (SelViewPermission.Value == "2") { if (TBXpassword.Text.Trim().Length == 0) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({title: '错误', content: '密码不能为空'})</script>"); return; } CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper(); alb.ViewPassword =sh.ComputeMD5Hash(TBXpassword.Text.Trim()); alb.CoverPath = CY.UME.Core.Global.AlbumCoverNoPublishAddress; } else { CY.UME.Core.PagingInfo pageinfo = new CY.UME.Core.PagingInfo(); pageinfo.CurrentPage=1; pageinfo.PageSize =1; List<CY.UME.Core.Business.Picture> picList = CY.UME.Core.Business.Picture.GetAllPicture(album, pageinfo); if (picList != null && picList.Count > 0) alb.CoverPath = picList[0].MiddlePath; } try { alb.Save(); Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({title: '提示', content: '修改成功'});window.location.href='AlbumList.aspx?spaceId=" + long.Parse(ViewState["accountId"].ToString()) + "'</script>"); } catch { Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>cy.ume.ui.window({title: '错误', content: '保存失败,发生意外错误'});</script>"); } }