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

namespace Fm.Bussiness
{
    public class model
    {
        /// <summary>
        /// 添加新的内容模型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool model_add(Fm.Entity.model model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_ADD");
         
            DataAccess.DataAccess.db.AddInParameter(db, "@enmark",DbType.String,model.enmark);
            DataAccess.DataAccess.db.AddInParameter(db, "@cnmark",DbType.String,model.cnmark);
            DataAccess.DataAccess.db.AddInParameter(db, "@tablename",DbType.String,model.tablename);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminadd",DbType.String,model.adminadd);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminlist",DbType.String,model.adminlist);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminedit",DbType.String,model.adminedit);
            DataAccess.DataAccess.db.AddInParameter(db, "@useradd",DbType.String,model.useradd);
            DataAccess.DataAccess.db.AddInParameter(db, "@userlist",DbType.String,model.userlist);
            DataAccess.DataAccess.db.AddInParameter(db, "@useredit",DbType.String,model.useredit);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 修改内容模型信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool model_update(Fm.Entity.model model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@mid", DbType.Int32, model.mid);
            DataAccess.DataAccess.db.AddInParameter(db, "@enmark", DbType.String, model.enmark);
            DataAccess.DataAccess.db.AddInParameter(db, "@cnmark", DbType.String, model.cnmark);
            DataAccess.DataAccess.db.AddInParameter(db, "@tablename", DbType.String, model.tablename);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminadd", DbType.String, model.adminadd);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminlist", DbType.String, model.adminlist);
            DataAccess.DataAccess.db.AddInParameter(db, "@adminedit", DbType.String, model.adminedit);
            DataAccess.DataAccess.db.AddInParameter(db, "@useradd", DbType.String, model.useradd);
            DataAccess.DataAccess.db.AddInParameter(db, "@userlist", DbType.String, model.userlist);
            DataAccess.DataAccess.db.AddInParameter(db, "@useredit", DbType.String, model.useredit);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 删除内容模型
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool model_del(Fm.Entity.model model)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_model_Delete");
            DataAccess.DataAccess.db.AddInParameter(db, "@mid", DbType.Int32, model.mid);
          
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
