using System;
using System.Collections.Generic;
//by JuSNS v1.0系列
//官方站：www.juSNS.com，演示站:www.ju001.com，www.julala.cn
//QQ:655071(技术)，QQ:9170617（客服）
//MSN:simplt@163.com EMail:simplt@163.com
//program design by Simplt.Xie，arjun
//========================================
using System.Data;
using System.Text;
using JuSNS.Factory;

namespace JuSNS.Manage
{
    public class Blog
    {
        private IBlog dal;
        /// <summary>
        /// 构造函数
        /// </summary>
        public Blog()
        {
            dal = DataAccess.CreateBlog();
        }
        /// <summary>
        /// 日志搜索
        /// </summary>
        /// <param name="searchCondition">搜索条件:1.按作者姓名;2.按日志标题</param>
        /// <param name="keyword">搜索关键字</param>
        /// <param name="orderType">排序方式:1.按发表日期;2.按作者姓名;3.按评论数</param>
        /// <returns></returns>
        public DataTable Search(int searchCondition, string keyword, int orderType, int pageIndex, int pageSize, out int recordCount, out int pageCount)
        {
            return dal.Search(searchCondition, keyword, orderType, pageIndex, pageSize, out  recordCount, out  pageCount);
        }
        /// <summary>
        /// 锁定或解锁日志
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="blogId"></param>
        /// <param name="lockSate"></param>
        public int ChangeLock(int userId, int blogId, bool lockSate)
        {
            return dal.ChangeLock(userId, blogId, lockSate);
        }
        /// <summary>
        /// 删除日志
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="blogId"></param>
        /// <returns></returns>
        public int Delete(int userId, int blogId)
        {
            return dal.DelBlog(userId, blogId, true);
        }
        /// <summary>
        /// 推荐日志
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="blogId"></param>
        /// <returns></returns>
        public int Rec(int t, int blogId)
        {
            return dal.Rec(t, blogId);
        }
    }
}
