/// <summary> /// Copies the elements of the specified <see cref="AlbumInfo">AlbumInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="AlbumInfo">AlbumInfo</see> containing the Components to add to the collection.</param> public void AddRange(AlbumInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
public bool SaveSpaceAlbum(AlbumInfo spaceAlbum) { DbParameter[] parms = { DbHelper.MakeInParam("@albumid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumid), DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumcateid), DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title), DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description), DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password), DbHelper.MakeInParam("@imgcount", (DbType)SqlDbType.Int, 4,spaceAlbum.Imgcount), DbHelper.MakeInParam("@logo", (DbType)SqlDbType.NChar, 255, spaceAlbum.Logo), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type) }; string commandText = String.Format("UPDATE [{0}albums] SET [albumcateid] = @albumcateid, [title] = @title, [description] = @description, [password] = @password, [imgcount] = @imgcount, [logo] = @logo, [type] = @type WHERE [albumid] = @albumid", BaseConfigs.GetTablePrefix); DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); return true; }
public static AlbumInfo[] GetSpaceAlbumsInfo(DataTable dt) { if (dt == null || dt.Rows.Count == 0) return null; AlbumInfo[] albumsinfoarray = new AlbumInfo[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { albumsinfoarray[i] = new AlbumInfo(); albumsinfoarray[i].Albumid = TypeConverter.ObjectToInt(dt.Rows[i]["albumid"]); albumsinfoarray[i].Userid = TypeConverter.ObjectToInt(dt.Rows[i]["userid"]); albumsinfoarray[i].Title = dt.Rows[i]["title"].ToString(); albumsinfoarray[i].Description = dt.Rows[i]["description"].ToString(); albumsinfoarray[i].Logo = dt.Rows[i]["logo"].ToString(); albumsinfoarray[i].Password = dt.Rows[i]["password"].ToString(); albumsinfoarray[i].Imgcount = TypeConverter.ObjectToInt(dt.Rows[i]["imgcount"]); albumsinfoarray[i].Views = TypeConverter.ObjectToInt(dt.Rows[i]["views"]); albumsinfoarray[i].Type = TypeConverter.ObjectToInt(dt.Rows[i]["type"]); albumsinfoarray[i].Createdatetime = dt.Rows[i]["createdatetime"].ToString(); } dt.Dispose(); return albumsinfoarray; }
public bool AddSpaceAlbum(AlbumInfo spaceAlbum) { DbParameter[] parms = { DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4,spaceAlbum.Userid), DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4,spaceAlbum.Albumcateid), DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title), DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description), DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type), DbHelper.MakeInParam("@username", (DbType)SqlDbType.NChar, 20, spaceAlbum.Username) }; string commandText = String.Format("INSERT INTO [{0}albums] ([userid], [username], [albumcateid], [title], [description], [password], [type]) VALUES ( @userid, @username, @albumcateid, @title, @description, @password, @type)", BaseConfigs.GetTablePrefix); //向关联表中插入相关数据 DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); return true; }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(AlbumInfo[] array, int index) { this.List.CopyTo(array, index); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="AlbumInfoCollection">AlbumInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="AlbumInfoCollection">AlbumInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(AlbumInfo value) { return this.List.Contains(value); }
public int Add(AlbumInfo value) { return this.List.Add(value); }
/// <summary> /// Initializes a new instance of the <see cref="AlbumInfoCollection">AlbumInfoCollection</see> class containing the specified array of <see cref="AlbumInfo">AlbumInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="AlbumInfo">AlbumInfo</see> Components with which to initialize the collection. </param> public AlbumInfoCollection(AlbumInfo[] value) { this.AddRange(value); }
protected override void ShowPage() { if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } //一周热图总排行 weekhotphotolist = AggregationFacade.AlbumAggregation.GetWeekHotPhotoList(photoconfig.Weekhot); string go = DNTRequest.GetString("go"); switch (go) { case "prev": mode = 1; break; case "next": mode = 2; break; default: mode = 0; break; } if (photoid < 1) { AddErrLine("指定的图片不存在"); return; } photo = DTOProvider.GetPhotoInfo(photoid, 0, 0); if (photo == null) { AddErrLine("指定的图片不存在"); return; } album = DTOProvider.GetAlbumInfo(photo.Albumid); if (album == null) { AddErrLine("指定的相册不存在"); return; } if (mode != 0) { photo = DTOProvider.GetPhotoInfo(photoid, photo.Albumid, mode); if (photo == null) { AddErrLine("指定的图片不存在"); return; } } if (config.Rssstatus == 1) { if (GeneralConfigs.GetConfig().Aspxrewrite == 1) photorssurl = string.Format("photorss-{0}{1}", photo.Userid, GeneralConfigs.GetConfig().Extname); else photorssurl = string.Format("rss.aspx?uid={0}&type=photo", photo.Userid); AddLinkRss(string.Format("tools/{0}", photorssurl), "最新图片"); } comments = DTOProvider.GetPhotoCommentCollection(photo.Photoid); pagetitle = photo.Title; //权限验证部分,私有相册,不是相册所有者 if (album.Type == 1 && album.Userid != userid) { if (ForumUtils.GetCookie("album" + photo.Albumid + "password") != Utils.MD5(album.Password)) { //首先验证Cookie中如果相册密码不正确,则要求输入密码,并以输入值验证 string password = DNTRequest.GetFormString("albumpassword"); if (album.Password == password) { ForumUtils.WriteCookie("album" + photo.Albumid + "password", Utils.MD5(password)); needpassword = false; } } else needpassword = false; } else needpassword = false; if (Utils.InArray(usergroupid.ToString(), config.Photomangegroups)) needpassword = false; albumcategory = DTOProvider.GetAlbumCategory(album.Albumcateid); jsonfilename = "cache/album/" + (album.Albumid/1000+1).ToString() + "/" + album.Albumid.ToString() + "_json.txt"; //非图片所有者时更新图片浏览量 if (userid != photo.Userid) DTOProvider.UpdatePhotoViews(photoid); //判断权限 { switch (photo.Commentstatus) { case PhotoStatus.Owner: if (userid != photo.Userid) commentable = false; break; } if (userid < 1) commentable = false; //重构时加入指定管理用户组 if (userid == photo.Userid || Utils.InArray(usergroupid.ToString(), config.Photomangegroups)) editable = true; } // 如果评论数不同步则同步 if (photo.Comments != comments.Count) DbProvider.GetInstance().UpdatePhotoComments(photo.Photoid, comments.Count - photo.Comments);//更新评论数 if (ispost) { string message = DNTRequest.GetFormString("message").Trim(); int delcid = DNTRequest.GetFormInt("delcommentid", 0); if (message != string.Empty) { SavePhotoComment(message); return; } else if (delcid > 0) { if (editable) { DbProvider.GetInstance().DeletePhotoComment(delcid); //更新评论数 DbProvider.GetInstance().UpdatePhotoComments(photo.Photoid, -1); AddMsgLine("删除成功!"); SetUrl("showphoto.aspx?photoid=" + photo.Photoid); SetMetaRefresh(); return; } } AddErrLine("非法操作"); SetMetaRefresh(); } }
public void Insert(int index, AlbumInfo value) { List.Insert(index, value); }
/// <summary> /// Gets the index in the collection of the specified <see cref="AlbumInfoCollection">AlbumInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="AlbumInfoCollection">AlbumInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(AlbumInfo value) { return this.List.IndexOf(value); }
public static AlbumInfo GetAlbumEntity(IDataReader reader) { AlbumInfo album = new AlbumInfo(); album.Albumid = TypeConverter.ObjectToInt(reader["albumid"]); album.Userid = TypeConverter.ObjectToInt(reader["userid"]); album.Username = reader["username"].ToString(); album.Title = reader["title"].ToString(); album.Description = reader["description"].ToString(); album.Logo = reader["logo"].ToString(); album.Password = reader["password"].ToString(); album.Imgcount = TypeConverter.ObjectToInt(reader["imgcount"]); album.Views = TypeConverter.ObjectToInt(reader["views"]); album.Type = TypeConverter.ObjectToInt(reader["type"]); album.Createdatetime = reader["createdatetime"].ToString(); album.Albumcateid = TypeConverter.ObjectToInt(reader["albumcateid"]); return album; }
/// <summary> /// 获得推荐相册列表 /// </summary> /// <param name="nodename">节点名称</param> /// <returns></returns> public Discuz.Common.Generic.List<AlbumInfo> GetRecommandAlbumList(string nodeName) { Discuz.Common.Generic.List<AlbumInfo> __recommandAlbumList = null; switch (nodeName) { case "Website": __recommandAlbumList = __recommandAlbumListForWebSite; break; case "Spaceindex": __recommandAlbumList = __recommandAlbumListForSpaceIndex; break; case "Albumindex": __recommandAlbumList = __recommandAlbumListForAlbumIndex; break; default: __recommandAlbumList = __recommandAlbumListForWebSite; break; } //当文件未被修改时将直接返回相关记录 if (__recommandAlbumList != null) return __recommandAlbumList; __recommandAlbumList = new Discuz.Common.Generic.List<AlbumInfo>(); XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/" + nodeName + "_albumlist/Album"); foreach (XmlNode xmlnode in xmlnodelist) { AlbumInfo album = new AlbumInfo(); album.Albumid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumid")); album.Userid = (xmlDoc.GetSingleNodeValue(xmlnode, "userid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "userid")); album.Username = (xmlDoc.GetSingleNodeValue(xmlnode, "username") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "username"); album.Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title"); album.Description = (xmlDoc.GetSingleNodeValue(xmlnode, "description") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "description"); album.Logo = (xmlDoc.GetSingleNodeValue(xmlnode, "logo") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "logo"); album.Password = (xmlDoc.GetSingleNodeValue(xmlnode, "password") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "password"); album.Imgcount = (xmlDoc.GetSingleNodeValue(xmlnode, "imgcount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "imgcount")); album.Views = (xmlDoc.GetSingleNodeValue(xmlnode, "views") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "views")); album.Type = (xmlDoc.GetSingleNodeValue(xmlnode, "type") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "type")); album.Createdatetime = (xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime"); album.Albumcateid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid")); __recommandAlbumList.Add(album); } switch (nodeName) { case "Website": __recommandAlbumListForWebSite = __recommandAlbumList; break; case "Spaceindex":__recommandAlbumListForSpaceIndex = __recommandAlbumList; break; case "Albumindex":__recommandAlbumListForAlbumIndex = __recommandAlbumList; break; default: __recommandAlbumListForWebSite = __recommandAlbumList; break; } return __recommandAlbumList; }
private void ModifyAlbumInfo() { string errorinfo = ""; string id = DNTRequest.GetFormString("albumid"); if (id == "0") { AlbumInfo albumInfo = new AlbumInfo(); albumInfo.Userid = userid; albumInfo.Username = username; albumInfo.Albumcateid = DNTRequest.GetFormInt("albumcate", 0); albumInfo.Title = DNTRequest.GetFormString("albumtitle"); albumInfo.Description = DNTRequest.GetFormString("albumdescription"); albumInfo.Password = DNTRequest.GetFormString("password"); albumInfo.Type = DNTRequest.GetFormInt("type", 0); Data.DbProvider.GetInstance().AddSpaceAlbum(albumInfo); } else { AlbumInfo albumInfo = DTOProvider.GetAlbumInfo(Convert.ToInt32(id)); if (albumInfo.Userid != userid) { AddErrLine("您所编辑的相册不存在"); return; } albumInfo.Title = DNTRequest.GetFormString("albumtitle"); albumInfo.Albumcateid = DNTRequest.GetFormInt("albumcate", 0); albumInfo.Description = DNTRequest.GetFormString("albumdescription"); albumInfo.Password = DNTRequest.GetFormString("password"); albumInfo.Type = DNTRequest.GetFormInt("type", 0); Data.DbProvider.GetInstance().SaveSpaceAlbum(albumInfo); } if (errorinfo == "") { SetUrl(string.Format("usercpspacemanagealbum.aspx?page={0}", DNTRequest.GetInt("page", 1))); SetMetaRefresh(); SetShowBackLink(true); if (id == "0") AddMsgLine("相册增加成功"); else AddMsgLine("相册修改成功"); return; } else { AddErrLine(errorinfo); return; } }
public bool AddSpaceAlbum(AlbumInfo spaceAlbum) { //try //{ IDataParameter[] prams = { DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4,spaceAlbum.Userid), DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4,spaceAlbum.Albumcateid), DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title), DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description), DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type), DbHelper.MakeInParam("@username", (DbType)SqlDbType.NChar, 20, spaceAlbum.Username) //DbHelper.MakeInParam("@creatdatetime", (DbType)SqlDbType.DateTime, 8,spaceAlbum.Createdatetime) }; string sqlstring = String.Format("INSERT INTO [{0}albums] ([userid], [username], [albumcateid], [title], [description], [password], [type]) VALUES ( @userid, @username, @albumcateid, @title, @description, @password, @type)", BaseConfigs.GetTablePrefix); //向关联表中插入相关数据 DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, prams); return true; //} //catch (Exception ex) //{ // errormsg = Globals.TransferSqlErrorInfo(ex.Message); // return false; //} }
public void Remove(AlbumInfo value) { List.Remove(value); }
public bool SaveSpaceAlbum(AlbumInfo spaceAlbum) { //try //{ IDataParameter[] prams = { DbHelper.MakeInParam("@albumid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumid), DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4, spaceAlbum.Albumcateid), DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50,spaceAlbum.Title), DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceAlbum.Description), DbHelper.MakeInParam("@password", (DbType)SqlDbType.NChar, 50,spaceAlbum.Password), DbHelper.MakeInParam("@imgcount", (DbType)SqlDbType.Int, 4,spaceAlbum.Imgcount), DbHelper.MakeInParam("@logo", (DbType)SqlDbType.NChar, 255, spaceAlbum.Logo), DbHelper.MakeInParam("@type", (DbType)SqlDbType.Int, 8,spaceAlbum.Type) }; string sqlstring = String.Format("UPDATE [{0}albums] SET [albumcateid] = @albumcateid, [title] = @title, [description] = @description, [password] = @password, [imgcount] = @imgcount, [logo] = @logo, [type] = @type WHERE [albumid] = @albumid", BaseConfigs.GetTablePrefix); DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, prams); return true; //} //catch (Exception ex) //{ // errormsg = Globals.TransferSqlErrorInfo(ex.Message); // return false; //} }
protected override void ShowPage() { if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } forumpath = BaseConfigs.GetForumPath; if (albumid < 1) { AddErrLine("指定的相册不存在"); return; } album = DTOProvider.GetAlbumInfo(albumid); if (album == null) { AddErrLine("指定的相册不存在"); return; } if (config.Rssstatus == 1) { if (GeneralConfigs.GetConfig().Aspxrewrite == 1) photorssurl = string.Format("photorss-{0}{1}", album.Userid, GeneralConfigs.GetConfig().Extname); else photorssurl = string.Format("rss.aspx?uid={0}&type=photo", album.Userid); AddLinkRss(string.Format("tools/{0}", photorssurl), "最新图片"); } pagetitle = album.Title; //权限验证部分,私有相册,不是相册所有者 if (album.Type == 1 && album.Userid != userid) { if (ForumUtils.GetCookie("album" + albumid + "password") != Utils.MD5(album.Password)) { //首先验证Cookie中如果相册密码不正确,则要求输入密码,并以输入值验证 string password = DNTRequest.GetFormString("albumpassword"); if (album.Password == password) { ForumUtils.WriteCookie("album" + albumid + "password", Utils.MD5(password)); needpassword = false; } } else needpassword = false; } else needpassword = false; if (Utils.InArray(usergroupid.ToString(), config.Photomangegroups)) needpassword = false; albumcategory = DTOProvider.GetAlbumCategory(album.Albumcateid); photoscount = DTOProvider.GetSpacePhotosCount(albumid); pageCount = photoscount % pageSize == 0 ? photoscount / pageSize : photoscount / pageSize + 1; if (pageCount == 0) pageCount = 1; if (currentpage < 1) currentpage = 1; if (currentpage > pageCount) currentpage = pageCount; pagenumbers = Utils.GetPageNumbers(currentpage, pageCount, string.Format("showalbum.aspx?albumid={0}", albumid), 8); photolist = DTOProvider.GetSpacePhotosInfo(DbProvider.GetInstance().SpacePhotosList(pageSize, currentpage, album.Userid, album.Albumid)); foreach (PhotoInfo photo in photolist) { //当是远程照片时 if (photo.Filename.IndexOf("http") < 0) photo.Filename = forumpath + Globals.GetThumbnailImage(photo.Filename); else photo.Filename = Globals.GetThumbnailImage(photo.Filename); } if (photolist.Count == 0) AddMsgLine("暂无图片"); ForumUtils.WriteCookie("referer", string.Format("showalbum.aspx?albumid={0}&page={1}", albumid, currentpage)); }