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

namespace Fm.Bussiness
{
    public class sys_link
    {
        /// <summary>
        /// 友情连接信息添加
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        public bool Link_Add(Fm.EntityClass.Link link)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_link_ADD");
            DataAccess.DataAccess.db.AddOutParameter(db, "@link_id",DbType.Int32,link.link_id);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_name", DbType.String, link.link_name);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_url", DbType.String, link.link_url);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_px", DbType.Int32, link.link_px);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_type", DbType.Boolean, link.link_type);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_logo", DbType.String, link.link_logo);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_intro", DbType.String, link.link_intro);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);

        }
        /// <summary>
        /// 友情连接信息修改
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        public bool Link_Update(Fm.EntityClass.Link link)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_link_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@link_id", DbType.Int32, link.link_id);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_name", DbType.String, link.link_name);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_url", DbType.String, link.link_url);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_px", DbType.Int32, link.link_px);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_type", DbType.Boolean, link.link_type);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_logo", DbType.String, link.link_logo);
            DataAccess.DataAccess.db.AddInParameter(db, "@link_intro", DbType.String, link.link_intro);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 友情连接信息删除
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        public bool Link_Del(Fm.EntityClass.Link link)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Query_Fm_link_Delete");
            DataAccess.DataAccess.db.AddInParameter(db, "@link_id", DbType.Int32, link.link_id);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
