コード例 #1
0
        public IList<Core.Business.PictureComment> GetAllPictureComment()
        {
            IList<Core.Business.PictureComment> pictureCommentlist = new List<Core.Business.PictureComment>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            SqlDataReader reader = sql.ExecuteSPReader("");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PictureComment pictureComment = new Core.Business.PictureComment();

                    if (!reader.IsDBNull(0)) pictureComment.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) pictureComment.DateCreated = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) pictureComment.InstanceId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) pictureComment.AccountId = reader.GetInt64(3);
                    if (!reader.IsDBNull(4)) pictureComment.AuthorId = reader.GetInt64(4);
                    if (!reader.IsDBNull(5)) pictureComment.ReferedId = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) pictureComment.Content = reader.GetString(6);
                    if (!reader.IsDBNull(7)) pictureComment.IP = reader.GetString(7);

                    pictureComment.MarkOld();
                    pictureCommentlist.Add(pictureComment);
                }
                reader.Close();
            }
            return pictureCommentlist;
        }
コード例 #2
0
        public IList<CY.UME.Core.Business.PictureComment> GetPicCommentByPagesAndPicId(CY.UME.Core.Business.Picture picture)
        {
            IList<Core.Business.PictureComment> picCommentlist = new List<Core.Business.PictureComment>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            sql.AddParameter("@InstanceId", SqlDbType.BigInt, picture.Id);
            SqlDataReader reader = sql.ExecuteSPReader("USP_PictureComment_Select_Top_By_InstanceId");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PictureComment picComment = new Core.Business.PictureComment();
                    long id = 0;
                    if (!reader.IsDBNull(0)) id = reader.GetInt64(0);
                    picComment = CY.UME.Core.Business.PictureComment.Load(id);

                    picComment.MarkOld();
                    picCommentlist.Add(picComment);
                }
                reader.Close();
            }
            return picCommentlist;
        }
コード例 #3
0
        public IList<CY.UME.Core.Business.PictureComment> GetPicCommentByPagesAndPicId(CY.UME.Core.Business.Picture picture, CY.UME.Core.PagingInfo pageInfo)
        {
            IList<Core.Business.PictureComment> picCommentlist = new List<Core.Business.PictureComment>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);
            if (picture == null)
            {
                return picCommentlist;
            }

            #region ����

            string tables = "PictureComment";
            string pK = "Id";
            string sort = "Id desc";
            int pageNum = pageInfo.CurrentPage;
            int pageSize = pageInfo.PageSize;
            string fields = "[Id], [DateCreated],[InstanceId],[AccountId],[AuthorId],[ReferedId],[Content],[IP]";
            string filter = "[InstanceId]=" + picture.Id;

            #endregion

            sql.AddParameter("@Tables", SqlDbType.VarChar, tables);
            sql.AddParameter("@PK", SqlDbType.VarChar, pK);
            sql.AddParameter("@Sort", SqlDbType.VarChar, sort);
            sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageSize);
            sql.AddParameter("@Fields", SqlDbType.VarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.VarChar, filter);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PictureComment pictureComment = new Core.Business.PictureComment();

                    if (!reader.IsDBNull(0)) pictureComment.Id = reader.GetInt64(0);
                    if (!reader.IsDBNull(1)) pictureComment.DateCreated = reader.GetDateTime(1);
                    if (!reader.IsDBNull(2)) pictureComment.InstanceId = reader.GetInt64(2);
                    if (!reader.IsDBNull(3)) pictureComment.AccountId = reader.GetInt64(3);
                    if (!reader.IsDBNull(4)) pictureComment.AuthorId = reader.GetInt64(4);
                    if (!reader.IsDBNull(5)) pictureComment.ReferedId = reader.GetInt64(5);
                    if (!reader.IsDBNull(6)) pictureComment.Content = reader.GetString(6);
                    if (!reader.IsDBNull(7)) pictureComment.IP = reader.GetString(7);

                    pictureComment.MarkOld();
                    picCommentlist.Add(pictureComment);
                }
                reader.Close();
            }
            return picCommentlist;
        }
コード例 #4
0
        public Core.Business.PictureComment Select(Int64 id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            sql.AddParameter("@Id", SqlDbType.BigInt, id);
            SqlDataReader reader = sql.ExecuteSPReader("USP_PictureComment_Select_By_Id");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.PictureComment pictureComment = new Core.Business.PictureComment();

                if (!reader.IsDBNull(0)) pictureComment.Id = reader.GetInt64(0);
                if (!reader.IsDBNull(1)) pictureComment.DateCreated = reader.GetDateTime(1);
                if (!reader.IsDBNull(2)) pictureComment.InstanceId = reader.GetInt64(2);
                if (!reader.IsDBNull(3)) pictureComment.AccountId = reader.GetInt64(3);
                if (!reader.IsDBNull(4)) pictureComment.AuthorId = reader.GetInt64(4);
                if (!reader.IsDBNull(5)) pictureComment.ReferedId = reader.GetInt64(5);
                if (!reader.IsDBNull(6)) pictureComment.Content = reader.GetString(6);
                if (!reader.IsDBNull(7)) pictureComment.IP = reader.GetString(7);

                reader.Close();
                return pictureComment;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }