/// <summary>
		/// Copies the elements of the specified <see cref="AlbumCategoryInfo">AlbumCategoryInfo</see> array to the end of the collection.
		/// </summary>
		/// <param name="value">An array of type <see cref="AlbumCategoryInfo">AlbumCategoryInfo</see> containing the Components to add to the collection.</param>
		public void AddRange(AlbumCategoryInfo[] value) 
		{
			for (int i = 0;	(i < value.Length); i = (i + 1)) 
			{
				this.Add(value[i]);
			}
		}
Ejemplo n.º 2
0
        public void AddAlbumCategory(AlbumCategoryInfo aci)
        {
            DbParameter[] parms = { 
                                        DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50, aci.Title),
                                        DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 300, aci.Description),
                                        DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, aci.Displayorder)
                                };

            string commandText = string.Format(@"INSERT INTO [{0}albumcategories]([title], [description], [albumcount], [displayorder]) VALUES(@title, @description, 0, @displayorder)", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
        }
Ejemplo n.º 3
0
        public void UpdateAlbumCategory(AlbumCategoryInfo aci)
        {
            DbParameter[] parms = { 
                                        DbHelper.MakeInParam("@albumcateid", (DbType)SqlDbType.Int, 4, aci.Albumcateid),
                                        DbHelper.MakeInParam("@title", (DbType)SqlDbType.NChar, 50, aci.Title),
                                        DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 300, aci.Description),
                                        DbHelper.MakeInParam("@displayorder", (DbType)SqlDbType.Int, 4, aci.Displayorder)
                                };

            string commandText = string.Format(@"UPDATE [{0}albumcategories] SET [title]=@title, [description]=@description, [displayorder]=@displayorder WHERE [albumcateid]=@albumcateid", BaseConfigs.GetTablePrefix);

            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
        }
Ejemplo n.º 4
0
 protected void Save_Click(object sender, EventArgs e)
 {
     string title = this.albumcateTitle.Text;
     string description = this.description.Text;
     int displayorder = Utils.StrToInt(this.displayorder.Text, 0);
     //bool error = false;
     if(title == "" || this.displayorder.Text == "")
     {
         //error = true;
         return;
     }
     AlbumCategoryInfo aci = new AlbumCategoryInfo();
     aci.Title = title;
     aci.Description = description;
     aci.Displayorder = displayorder;
     DbProvider.GetInstance().AddAlbumCategory(aci);
 }
		public int Add(AlbumCategoryInfo value) 
		{
			return this.List.Add(value);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</see> class containing the specified array of <see cref="AlbumCategoryInfo">AlbumCategoryInfo</see> Components.
		/// </summary>
		/// <param name="value">An array of <see cref="AlbumCategoryInfo">AlbumCategoryInfo</see> Components with which to initialize the collection. </param>
		public AlbumCategoryInfoCollection(AlbumCategoryInfo[] value)
		{
			this.AddRange(value);
		}
		public void Remove(AlbumCategoryInfo value) 
		{
			List.Remove(value);
		}
 public void Insert(int index, AlbumCategoryInfo value)
 {
     List.Insert(index, value);
 }
Ejemplo n.º 9
0
        protected override void ShowPage()
        {
            pagetitle = "相册列表";

            if (config.Enablealbum != 1)
            {
                AddErrLine("相册功能已被关闭");
                return;
            }

            if (albumsuserid == -1 && userid != -1)
                albumsuserid = userid;

            if (currentcate != 0)
            {
                currentalbumcategory = DTOProvider.GetAlbumCategory(currentcate);
                pagetitle = currentalbumcategory.Title;
            }
            if (albumsuserid != 0)
            {
                ShortUserInfo shortUserInfo = Users.GetShortUserInfo(albumsuserid);
                albumusername = shortUserInfo == null ? "" : shortUserInfo.Username;
                pagetitle = albumusername + "的" + pagetitle;
            }

            albumscount = DTOProvider.GetSpaceAlbumListCount(albumsuserid, currentcate);
            pagecount = albumscount % pageSize == 0 ? albumscount / pageSize : albumscount / pageSize + 1;
            if (pagecount == 0)
                pagecount = 1;

            if (currentpage < 1)
                currentpage = 1;

            if (currentpage > pagecount)
                currentpage = pagecount;

            string parm = string.Empty;
            if (currentcate != 0)
            {
                parm = "cate=" + currentcate;
                if (albumsuserid != 0)
                    parm += "&uid=" + albumsuserid;
            }
            else if (albumsuserid != 0)
                parm += "uid=" + albumsuserid;

            if (parm != string.Empty)
                parm += "&page=";
            else
                parm += "page=";

            if (currentpage > 1)
                prevpage = "<a href='showalbumlist.aspx?" + parm + (currentpage - 1) + "'>上一页</a>";

            if (currentpage < pagecount)
                nextpage = "<a href='showalbumlist.aspx?" + parm + (currentpage + 1) + "'>下一页</a>";

            pagenumbers = Utils.GetPageNumbers(currentpage, pagecount, "showalbumlist.aspx", 8);
            albumlist = DTOProvider.GetSpaceAlbumList(albumsuserid, currentcate, pageSize, currentpage);

            if (albumlist.Count == 0)
                AddMsgLine("暂无相册");
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            #region 保存相册分类
            if (this.CheckCookie())
            {
                //

                //AlbumCategoryInfo aci = new AlbumCategoryInfo();
                //aci.Title = title;
                //aci.Description = description;
                //aci.Displayorder = displayorder;

                //int albumcateid = Utils.StrToInt(this.albumCateId.Value, 0);
                ////增加新分类
                //if (albumcateid == 0)
                //{
                //    DatabaseProvider.GetInstance().AddAlbumCategory(aci);
                //}
                //else//更新原分类
                //{
                //    aci.Albumcateid = albumcateid;
                //    DatabaseProvider.GetInstance().UpdateAlbumCategory(aci);
                //}
                int row = 0;
                bool error = false;
                foreach (object o in DataGrid1.GetKeyIDArray())
                {
                    int id = int.Parse(o.ToString());
                    string title = DataGrid1.GetControlValue(row, "title").Trim();
                    string description = DataGrid1.GetControlValue(row, "description").Trim();
                    string displayorder = DataGrid1.GetControlValue(row, "displayorder");
                    if (title == "" || displayorder == "")
                    {
                        error = true;
                        continue;
                    }
                    AlbumCategoryInfo aci = new AlbumCategoryInfo();
                    aci.Title = title;
                    aci.Description = description;
                    aci.Displayorder = int.Parse(displayorder);
                    aci.Albumcateid = id;
                    DbProvider.GetInstance().UpdateAlbumCategory(aci);
                    row++;
                    if (error)
                    {
                        //
                    }
                }

                //更新缓存
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Space/AlbumCategory");
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Photo/AlbumCategoryMenu");
                BindData();
      			Response.Redirect("album_categorymanage.aspx");
            }
            #endregion
        }
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</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(AlbumCategoryInfo value)
 {
     return(this.List.Contains(value));
 }
 public int Add(AlbumCategoryInfo value)
 {
     return(this.List.Add(value));
 }
 public void Remove(AlbumCategoryInfo value)
 {
     List.Remove(value);
 }
		/// <summary>
		/// Gets a value indicating whether the collection contains the specified <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</see>.
		/// </summary>
		/// <param name="value">The <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</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(AlbumCategoryInfo value) 
		{
			return this.List.Contains(value);
		}
		/// <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(AlbumCategoryInfo[] array, int index) 
		{
			this.List.CopyTo(array, index);
		}
Ejemplo n.º 17
0
        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();
            }
        }
		/// <summary>
		/// Gets the index in the collection of the specified <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</see>, if it exists in the collection.
		/// </summary>
		/// <param name="value">The <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</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(AlbumCategoryInfo value) 
		{
			return this.List.IndexOf(value);
		}
		public void Insert(int index, AlbumCategoryInfo value)	
		{
			List.Insert(index, value);
		}
Ejemplo n.º 20
0
        public Discuz.Common.Generic.List<AlbumCategoryInfo> GetAlbumCategory()
        {
            string sql = string.Format("SELECT * FROM [{0}albumcategories] ORDER BY [displayorder]", BaseConfigs.GetTablePrefix);

            IDataReader reader = DbHelper.ExecuteReader(CommandType.Text, sql);

            Discuz.Common.Generic.List<AlbumCategoryInfo> acic = new Discuz.Common.Generic.List<AlbumCategoryInfo>();

            if (reader != null)
            {
                while (reader.Read())
                {
                    AlbumCategoryInfo aci = new AlbumCategoryInfo();
                    aci.Albumcateid = Utils.StrToInt(reader["albumcateid"], 0);
                    aci.Albumcount = Utils.StrToInt(reader["albumcount"], 0);
                    aci.Description = reader["description"].ToString();
                    aci.Displayorder = Utils.StrToInt(reader["displayorder"], 0);
                    aci.Title = reader["title"].ToString();
                    acic.Add(aci);
                }
                reader.Close();
            }
            return acic;
        }
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="AlbumCategoryInfoCollection">AlbumCategoryInfoCollection</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(AlbumCategoryInfo value)
 {
     return(this.List.IndexOf(value));
 }