示例#1
0
        /// <summary>
        /// ��ȡ���ظ��б�
        /// </summary>
        /// <param name="active"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List<TopicReply> GetActiveTopicReplyList(Activities active, PagingInfo pageInfo)
        {
            List<Core.Business.TopicReply> topicReplylist = new List<Core.Business.TopicReply>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sorts = String.Empty;
            string filter = String.Empty;
            string fields = String.Empty;

            if (active == null)
            {
                return topicReplylist;
            }

            sorts = "DateCreated desc";
            filter = "[InstanceId] in (select [Id] from TopicExtend where InstanceId='" +active.Id + "' and [Type]='active')";
            fields = "[Id],[DateCreated],[InstanceId],[AccountId],[AuthorId],[ReferedId],[Content],[IP]";

            sql.AddParameter("@PageNumber", SqlDbType.Int, pageInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageInfo.PageSize);

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "TopicReply");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, sorts);
            sql.AddParameter("@Fields", SqlDbType.NVarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.NVarChar, filter);

            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TopicReply topicReply = new Core.Business.TopicReply();

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

                    topicReply.MarkOld();
                    topicReplylist.Add(topicReply);
                }
                reader.Close();
            }
            return topicReplylist;
        }
示例#2
0
        public IList<Core.Business.TopicReply> GetAllTopicReply()
        {
            IList<Core.Business.TopicReply> topicReplylist = new List<Core.Business.TopicReply>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            SqlDataReader reader = sql.ExecuteSPReader("USP_TopicReply_SelectAll");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TopicReply topicReply = new Core.Business.TopicReply();

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

                    topicReply.MarkOld();
                    topicReplylist.Add(topicReply);
                }
                reader.Close();
            }
            return topicReplylist;
        }
示例#3
0
        public Core.Business.TopicReply Select(Int64 id)
        {
            SqlServerUtility sql = new SqlServerUtility(connectionString);

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

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

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

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

                return null;
            }
        }
示例#4
0
        public List<TopicReply> SearchTopicReply(Activities active, string con, string title, string authorName, DateTime minDate, DateTime maxDate, PagingInfo pageInfo)
        {
            List<Core.Business.TopicReply> topicReplylist = new List<Core.Business.TopicReply>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sorts = String.Empty;
            string filter = String.Empty;
            string fields = String.Empty;

            filter += "1=1";
            if (active != null)
            {
                filter += " and [InstanceId] in (select [Id] from TopicExtend where InstanceId='" +active.Id+ "' and [Type]='active')";
            }
            if (con.Length > 0)
            {
                filter += " and [Content] like '%" + con + "%'";
            }
            if (title.Length > 0)
            {
                filter += " and [InstanceId] in (select [Id] from [Topic] where [Title] like '%" + title + "%')";
            }
            if (authorName.Length > 0)
            {
                filter += " and [AuthorId] in (select [Id] from [Account] where [Name] like '%" + authorName + "%')";
            }
            filter += " and [DateCreated] between '" + minDate.ToString() + "' and '" + maxDate.ToString() + "'";

            sorts = "DateCreated desc";
            fields = "[Id],[DateCreated],[InstanceId],[AccountId],[AuthorId],[ReferedId],[Content],[IP]";

            sql.AddParameter("@PageNumber", SqlDbType.Int, pageInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageInfo.PageSize);

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "TopicReply");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, sorts);
            sql.AddParameter("@Fields", SqlDbType.NVarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.NVarChar, filter);

            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TopicReply topicReply = new Core.Business.TopicReply();

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

                    topicReply.MarkOld();
                    topicReplylist.Add(topicReply);
                }
                reader.Close();
            }
            return topicReplylist;
        }
示例#5
0
        public IList<CY.UME.Core.Business.TopicReply> GetReplyByTopicIdAndPagesDESC(Guid topicId, PagingInfo pageInfo)
        {
            IList<Core.Business.TopicReply> topicReplylist = new List<Core.Business.TopicReply>();
            SqlServerUtility sql = new SqlServerUtility(connectionString);

            string sorts = String.Empty;
            string filter = String.Empty;
            string fields = String.Empty;

            sorts = "Id";
            filter = "Id IN(SELECT TOP (" + pageInfo.PageSize + ") [Id] FROM [TopicReply] WHERE [InstanceId] = '" + topicId.ToString() + "' ORDER BY [DateCreated])";
            fields = "[Id],[DateCreated],[InstanceId],[AccountId],[AuthorId],[ReferedId],[Content],[IP]";

            sql.AddParameter("@PageNumber", SqlDbType.Int, pageInfo.CurrentPage);
            sql.AddParameter("@PageSize", SqlDbType.Int, pageInfo.PageSize);

            sql.AddParameter("@Tables", SqlDbType.NVarChar, "TopicReply");
            sql.AddParameter("@PK", SqlDbType.NVarChar, "Id");
            sql.AddParameter("@Sort", SqlDbType.NVarChar, sorts);
            sql.AddParameter("@Fields", SqlDbType.NVarChar, fields);
            sql.AddParameter("@Filter", SqlDbType.NVarChar, filter);

            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TopicReply topicReply = new Core.Business.TopicReply();

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

                    topicReply.MarkOld();
                    topicReplylist.Add(topicReply);
                }
                reader.Close();
            }
            return topicReplylist;
        }