/// <summary>
		/// Copies the elements of the specified <see cref="PhotoCommentInfo">PhotoCommentInfo</see> array to the end of the collection.
		/// </summary>
		/// <param name="value">An array of type <see cref="PhotoCommentInfo">PhotoCommentInfo</see> containing the Components to add to the collection.</param>
		public void AddRange(PhotoCommentInfo[] value) 
		{
			for (int i = 0;	(i < value.Length); i = (i + 1)) 
			{
				this.Add(value[i]);
			}
		}
Ejemplo n.º 2
0
        public static Discuz.Common.Generic.List<PhotoCommentInfo> GetPhotoCommentCollection(int photoid)
        {
            Discuz.Common.Generic.List<PhotoCommentInfo> comments = new Discuz.Common.Generic.List<PhotoCommentInfo>();
            IDataReader reader = Data.DbProvider.GetInstance().GetPhotoCommentCollection(photoid);
            while (reader.Read())
            {
                PhotoCommentInfo comment = new PhotoCommentInfo();
                comment.Commentid = TypeConverter.ObjectToInt(reader["commentid"]);
                comment.Content = Utils.RemoveHtml(reader["content"].ToString());
                comment.Ip = reader["ip"].ToString();
                comment.Photoid = TypeConverter.ObjectToInt(reader["photoid"]);
                comment.Postdatetime = Convert.ToDateTime(reader["postdatetime"]);
                comment.Userid = TypeConverter.ObjectToInt(reader["userid"]);
                comment.Username = reader["username"].ToString();

                comments.Add(comment);
            }
            reader.Close();
            return comments;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 发送相册图片评论通知
 /// </summary>
 /// <param name="pcomment">评论信息</param>
 private void SendPhotoComment(PhotoCommentInfo pcomment)
 {
     //当回复人与相册所有人不是同一人时,则向相册所有人发送通知
     if (album.Userid != pcomment.Userid && pcomment.Commentid > 0)
     {
         NoticeInfo noticeinfo = new NoticeInfo();
         noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 评论了您的{2}--\"{3}\" , 请<a href =\"showphoto.aspx?photoid={4}&reply={5}#comments\">点击这里</a>查看详情.", pcomment.Userid, pcomment.Username, config.Albumname, album.Title, pcomment.Photoid, pcomment.Commentid));
         noticeinfo.Type = Noticetype.AlbumCommentNotice;
         noticeinfo.New = 1;
         noticeinfo.Posterid = pcomment.Userid;
         noticeinfo.Poster = pcomment.Username;
         noticeinfo.Postdatetime = Utils.GetDateTime();
         noticeinfo.Uid = album.Userid;
         Notices.CreateNoticeInfo(noticeinfo);
     }
 }
Ejemplo n.º 4
0
        private void SavePhotoComment(string message)
        {
            if (ForumUtils.IsCrossSitePost())
            {
                AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                return;
            }
            if (userid < 1)
            {
                AddErrLine("请登录后发表评论");
                return;
            }
            if (userid != photo.Userid && photo.Commentstatus == PhotoStatus.Owner)
            {
                AddErrLine("此图片禁止评论");
                return;
            }
            if (message.Length < 1)
            {
                AddErrLine("评论内容不能为空");
                return;
            }
            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            if (admininfo == null || admininfo.Disablepostctrl != 1)
            {
                if (message.Length < config.Minpostsize)
                {
                    AddErrLine("您发表的内容过少, 系统设置要求评论内容不得少于 " + config.Minpostsize.ToString() + " 字");
                    return;
                }
                else if (message.Length > 2000)
                {
                    AddErrLine("您发表的内容过多, 系统设置要求评论内容不得多于 2000 字");
                    return;
                }

                int interval = Utils.StrDateDiffSeconds(lastposttime, config.Postinterval);
                if (interval < 0)
                {
                    AddErrLine("系统规定发帖间隔为" 
                        + config.Postinterval.ToString() 
                        + "秒, 您还需要等待 " 
                        + (interval*-1).ToString() 
                        + " 秒");
                    return;
                }
            }

            PhotoCommentInfo pcomment = new PhotoCommentInfo();
            pcomment.Content = Utils.RemoveHtml(ForumUtils.BanWordFilter(message));
            pcomment.Ip = DNTRequest.GetIP();
            pcomment.Parentid = DNTRequest.GetFormInt("parent", 0);
            pcomment.Photoid = photo.Photoid;
            pcomment.Postdatetime = DateTime.Now;
            pcomment.Userid = userid;
            pcomment.Username = username;
            pcomment.Commentid = DbProvider.GetInstance().CreatePhotoComment(pcomment);

            //更新最后发帖时间
            OnlineUsers.UpdatePostTime(olid);

            //更新评论数
            DbProvider.GetInstance().UpdatePhotoComments(photo.Photoid, 1);

            //发送相册图片评论通知
            if (DNTRequest.GetString("sendnotice") == "on")
                SendPhotoComment(pcomment);

            HttpContext.Current.Response.Redirect(string.Format("{0}showphoto.aspx?photoid={1}&reply=1#comments", BaseConfigs.GetForumPath, photo.Photoid));
        }
		/// <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(PhotoCommentInfo[] array, int index) 
		{
			this.List.CopyTo(array, index);
		}
		/// <summary>
		/// Gets a value indicating whether the collection contains the specified <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</see>.
		/// </summary>
		/// <param name="value">The <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</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(PhotoCommentInfo value) 
		{
			return this.List.Contains(value);
		}
 public void Insert(int index, PhotoCommentInfo value)
 {
     List.Insert(index, value);
 }
		public void Remove(PhotoCommentInfo value) 
		{
			List.Remove(value);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</see> class containing the specified array of <see cref="PhotoCommentInfo">PhotoCommentInfo</see> Components.
		/// </summary>
		/// <param name="value">An array of <see cref="PhotoCommentInfo">PhotoCommentInfo</see> Components with which to initialize the collection. </param>
		public PhotoCommentInfoCollection(PhotoCommentInfo[] value)
		{
			this.AddRange(value);
		}
		/// <summary>
		/// Gets the index in the collection of the specified <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</see>, if it exists in the collection.
		/// </summary>
		/// <param name="value">The <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</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(PhotoCommentInfo value) 
		{
			return this.List.IndexOf(value);
		}
		public void Insert(int index, PhotoCommentInfo value)	
		{
			List.Insert(index, value);
		}
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</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(PhotoCommentInfo value)
 {
     return(this.List.Contains(value));
 }
 public int Add(PhotoCommentInfo value)
 {
     return(this.List.Add(value));
 }
 public void Remove(PhotoCommentInfo value)
 {
     List.Remove(value);
 }
Ejemplo n.º 15
0
 public int CreatePhotoComment(PhotoCommentInfo pcomment)
 {
     DbParameter[] parms = {
                                 DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4, pcomment.Userid),
                                 DbHelper.MakeInParam("@username", (DbType)SqlDbType.NVarChar, 20, pcomment.Username),
                                 DbHelper.MakeInParam("@photoid", (DbType)SqlDbType.Int, 4, pcomment.Photoid),
                                 DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.SmallDateTime, 4, pcomment.Postdatetime),
                                 DbHelper.MakeInParam("@ip", (DbType)SqlDbType.VarChar, 100, pcomment.Ip),
                                 DbHelper.MakeInParam("@content", (DbType)SqlDbType.NVarChar, 2000, pcomment.Content)
                             };
     string commandText = string.Format("INSERT INTO [{0}photocomments]([userid], [username], [photoid], [postdatetime], [ip], [content]) VALUES(@userid, @username, @photoid, @postdatetime, @ip, @content);SELECT SCOPE_IDENTITY()", BaseConfigs.GetTablePrefix);
     return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.Text, commandText, parms), 0);
 }
		public int Add(PhotoCommentInfo value) 
		{
			return this.List.Add(value);
		}
Ejemplo n.º 17
0
		public void CreatePhotoComment(PhotoCommentInfo pcomment)
		{
			IDataParameter[] parms = {
									  DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4, pcomment.Userid),
									  DbHelper.MakeInParam("@username", (DbType)SqlDbType.NVarChar, 20, pcomment.Username),
									  DbHelper.MakeInParam("@photoid", (DbType)SqlDbType.Int, 4, pcomment.Photoid),
									  DbHelper.MakeInParam("@postdatetime", (DbType)SqlDbType.SmallDateTime, 4, pcomment.Postdatetime),
									  DbHelper.MakeInParam("@ip", (DbType)SqlDbType.VarChar, 100, pcomment.Ip),
									  DbHelper.MakeInParam("@content", (DbType)SqlDbType.NVarChar, 2000, pcomment.Content)
								  };
			string commandText = string.Format("INSERT INTO [{0}photocomments]([userid], [username], [photoid], [postdatetime], [ip], [content]) VALUES(@userid, @username, @photoid, @postdatetime, @ip, @content)", BaseConfigs.GetTablePrefix);
			DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
		}
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="PhotoCommentInfoCollection">PhotoCommentInfoCollection</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(PhotoCommentInfo value)
 {
     return(this.List.IndexOf(value));
 }