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

namespace Fm.Bussiness
{
    public class sys_column
    {
        /// <summary>
        /// 子栏目上级编号修改
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        public bool Column_Parent_Update(Fm.EntityClass.Column column)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_column_Parent");
            DataAccess.DataAccess.db.AddInParameter(db,"@cl_id",DbType.Int32,column.cl_id);
            DataAccess.DataAccess.db.AddInParameter(db,"@cl_parent",DbType.String,column.cl_parent);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 栏目排序的修改
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        public bool Column_Px_Update(Fm.EntityClass.Column column)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_column_PxUpdate");
            DataAccess.DataAccess.db.AddInParameter(db,"@cl_id",DbType.Int32,column.cl_id);
            DataAccess.DataAccess.db.AddInParameter(db,"@cl_px",DbType.Int32,column.cl_px);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
       /// <summary>
       /// 网站栏目的添加
       /// </summary>
       /// <param name="column"></param>
       /// <returns></returns>
        public bool Column_add(Fm.EntityClass.Column column)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_column_ADD");
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_id",DbType.Int32,column.cl_id);
           
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_name", DbType.String, column.cl_name);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_tg", DbType.Boolean, column.cl_tg);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_xs", DbType.Boolean, column.cl_xs);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_path", DbType.String, column.cl_path);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_location",DbType.Boolean,column.cl_location);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_options",DbType.Int32,column.cl_options);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_attribute",DbType.Int32,column.cl_attribute);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_index", DbType.String, column.cl_temp_index);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_list", DbType.String, column.cl_temp_list);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_cont", DbType.String, column.cl_temp_cont);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_content", DbType.String, column.cl_content);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_default",DbType.String,column.cl_default);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_list", DbType.String, column.cl_list);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_url", DbType.String, column.cl_url);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_keyword", DbType.String, column.cl_keyword);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_intro", DbType.String, column.cl_intro);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_parent", DbType.String, column.cl_parent);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_px", DbType.Int32, column.cl_px);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 网站栏目的修改
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        public bool Column_update(Fm.EntityClass.Column column)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_column_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_id", DbType.Int32, column.cl_id);
         
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_name", DbType.String, column.cl_name);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_tg", DbType.Boolean, column.cl_tg);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_xs", DbType.Boolean, column.cl_xs);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_path", DbType.String, column.cl_path);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_location", DbType.Boolean, column.cl_location);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_options", DbType.Int32, column.cl_options);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_attribute", DbType.Int32, column.cl_attribute);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_index", DbType.String, column.cl_temp_index);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_list", DbType.String, column.cl_temp_list);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_temp_cont", DbType.String, column.cl_temp_cont);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_content", DbType.String, column.cl_content);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_default", DbType.String, column.cl_default);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_list", DbType.String, column.cl_list);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_url", DbType.String, column.cl_url);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_keyword", DbType.String, column.cl_keyword);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_intro", DbType.String, column.cl_intro);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_parent", DbType.String, column.cl_parent);
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_px", DbType.Int32, column.cl_px);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 文章栏目删除
        /// </summary>
        /// <param name="cl_id">栏目ID</param>
        /// <returns></returns>
        public bool Column_del(Fm.EntityClass.Column column)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_column_Delete");
            DataAccess.DataAccess.db.AddInParameter(db, "@cl_id", DbType.Int32, column.cl_id);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
