using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;

namespace Fm.Bussiness
{
    public class model_main
    {
       
        /// <summary>
        /// 文章模型内容修改
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public bool model_article_update(Fm.EntityClass.model_article article)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_article_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@docid", DbType.Int32, article.docid);
            DataAccess.DataAccess.db.AddInParameter(db, "@content", DbType.String, article.content);
            DataAccess.DataAccess.db.AddInParameter(db, "@author", DbType.String, article.author);
            DataAccess.DataAccess.db.AddInParameter(db, "@source", DbType.String, article.source);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 文章模型内容添加
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public bool model_article_add(Fm.EntityClass.model_article article)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_article_ADD");
            DataAccess.DataAccess.db.AddInParameter(db, "@docid", DbType.Int32, article.docid);
            DataAccess.DataAccess.db.AddInParameter(db,"@content",DbType.String,article.content);
            DataAccess.DataAccess.db.AddInParameter(db, "@author", DbType.String, article.author);
            DataAccess.DataAccess.db.AddInParameter(db, "@source", DbType.String, article.source);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 内容模型数据基表数据添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int model_main_add(Fm.EntityClass.model_main model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_main_ADD");
            DataAccess.DataAccess.db.AddOutParameter(db, "@docid",DbType.Int32,model.docid);
            DataAccess.DataAccess.db.AddInParameter(db, "@colid", DbType.Int32, model.colid);
           
            DataAccess.DataAccess.db.AddInParameter(db, "@title", DbType.String, model.title);
            DataAccess.DataAccess.db.AddInParameter(db, "@head", DbType.Boolean, model.head);
            DataAccess.DataAccess.db.AddInParameter(db, "@map", DbType.Boolean, model.map);
            DataAccess.DataAccess.db.AddInParameter(db, "@flash",DbType.Boolean,model.flash);
            DataAccess.DataAccess.db.AddInParameter(db, "@commend",DbType.Boolean,model.commend);
            DataAccess.DataAccess.db.AddInParameter(db, "@bold",DbType.Boolean,model.bold);
            DataAccess.DataAccess.db.AddInParameter(db, "@writertime",DbType.DateTime,model.writertime);
            DataAccess.DataAccess.db.AddInParameter(db, "@username",DbType.String,model.username);
            DataAccess.DataAccess.db.AddInParameter(db, "@click",DbType.Int32,model.click);
            DataAccess.DataAccess.db.AddInParameter(db, "@audit",DbType.Boolean,model.audit);
            DataAccess.DataAccess.db.AddInParameter(db, "@comment",DbType.Boolean,model.comment);
            DataAccess.DataAccess.db.AddInParameter(db, "@color",DbType.String,model.color);
            DataAccess.DataAccess.db.AddInParameter(db, "@keyword",DbType.String,model.keyword);
            DataAccess.DataAccess.db.AddInParameter(db, "@intro",DbType.String,model.intro);
            DataAccess.DataAccess.db.AddInParameter(db, "@html",DbType.Boolean,model.html);
            DataAccess.DataAccess.db.AddInParameter(db, "@topclick",DbType.Int32,model.topclick);
            DataAccess.DataAccess.db.AddInParameter(db, "@tread",DbType.Int32,model.tread);
            DataAccess.DataAccess.db.AddInParameter(db, "@thumbnail",DbType.String,model.thumbnail);
            DataAccess.DataAccess.GetData.Query<DbCommand>(db);
            model.docid=int.Parse(db.Parameters["@docid"].Value.ToString());
            return model.docid;
        }
        /// <summary>
        /// 内容模型数据基表数据修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool model_main_update(Fm.EntityClass.model_main model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_main_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@docid", DbType.Int32, model.docid);
            DataAccess.DataAccess.db.AddInParameter(db, "@colid", DbType.Int32, model.colid);
          
            DataAccess.DataAccess.db.AddInParameter(db, "@title", DbType.String, model.title);
            DataAccess.DataAccess.db.AddInParameter(db, "@head", DbType.Boolean, model.head);
            DataAccess.DataAccess.db.AddInParameter(db, "@map", DbType.Boolean, model.map);
            DataAccess.DataAccess.db.AddInParameter(db, "@flash", DbType.Boolean, model.flash);
            DataAccess.DataAccess.db.AddInParameter(db, "@commend", DbType.Boolean, model.commend);
            DataAccess.DataAccess.db.AddInParameter(db, "@bold", DbType.Boolean, model.bold);
            DataAccess.DataAccess.db.AddInParameter(db, "@writertime", DbType.DateTime, model.writertime);
            DataAccess.DataAccess.db.AddInParameter(db, "@username", DbType.String, model.username);
            DataAccess.DataAccess.db.AddInParameter(db, "@click", DbType.Int32, model.click);
            DataAccess.DataAccess.db.AddInParameter(db, "@audit", DbType.Boolean, model.audit);
            DataAccess.DataAccess.db.AddInParameter(db, "@comment", DbType.Boolean, model.comment);
            DataAccess.DataAccess.db.AddInParameter(db, "@color", DbType.String, model.color);
            DataAccess.DataAccess.db.AddInParameter(db, "@keyword", DbType.String, model.keyword);
            DataAccess.DataAccess.db.AddInParameter(db, "@intro", DbType.String, model.intro);
            DataAccess.DataAccess.db.AddInParameter(db, "@html", DbType.Boolean, model.html);
            DataAccess.DataAccess.db.AddInParameter(db, "@topclick", DbType.Int32, model.topclick);
            DataAccess.DataAccess.db.AddInParameter(db, "@tread", DbType.Int32, model.tread);
            DataAccess.DataAccess.db.AddInParameter(db, "@thumbnail", DbType.String, model.thumbnail);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 内容模型数据基表数据的删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool model_main_del(Fm.EntityClass.model_main model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_main_Delete");
            DataAccess.DataAccess.db.AddInParameter(db, "@docid", DbType.Int32, model.docid);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
