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

namespace Fm.Bussiness
{
    public class ad
    {
        /// <summary>
        /// 广告修改
        /// </summary>
        /// <param name="ad"></param>
        /// <returns></returns>
        public bool Update(Fm.EntityClass.ad ad)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_ad_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@adid", DbType.Int32, ad.adid);
            DataAccess.DataAccess.db.AddInParameter(db, "@adletter", DbType.String, ad.adletter);
            DataAccess.DataAccess.db.AddInParameter(db, "@adpic", DbType.String, ad.adpic);
            DataAccess.DataAccess.db.AddInParameter(db, "@adjs", DbType.String, ad.adjs);
            DataAccess.DataAccess.db.AddInParameter(db, "@adurl", DbType.String, ad.adurl);
            DataAccess.DataAccess.db.AddInParameter(db, "@acid", DbType.Int32, ad.acid);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 广告添加
        /// </summary>
        /// <param name="ad"></param>
        /// <returns></returns>
        public bool ADD(Fm.EntityClass.ad ad)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_ad_ADD");
            DataAccess.DataAccess.db.AddOutParameter(db, "@adid", DbType.Int32, ad.adid);
            DataAccess.DataAccess.db.AddInParameter(db, "@adletter", DbType.String, ad.adletter);
            DataAccess.DataAccess.db.AddInParameter(db, "@adpic", DbType.String, ad.adpic);
            DataAccess.DataAccess.db.AddInParameter(db, "@adjs", DbType.String, ad.adjs);
            DataAccess.DataAccess.db.AddInParameter(db, "@adurl", DbType.String, ad.adurl);
            DataAccess.DataAccess.db.AddInParameter(db, "@acid", DbType.Int32, ad.acid);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 广告分类修改
        /// </summary>
        /// <param name="ac"></param>
        /// <returns></returns>
        public bool Update(Fm.EntityClass.adclass ac)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_adclass_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@acid", DbType.Int32, ac.acid);
            DataAccess.DataAccess.db.AddInParameter(db, "@acname", DbType.String, ac.acname);
            DataAccess.DataAccess.db.AddInParameter(db, "@acintro", DbType.String, ac.acintro);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// 广告分类添加
        /// </summary>
        /// <param name="ac"></param>
        /// <returns></returns>
        public bool ADD(Fm.EntityClass.adclass ac)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_adclass_ADD");
            DataAccess.DataAccess.db.AddOutParameter(db,"@acid",DbType.Int32,ac.acid);
            DataAccess.DataAccess.db.AddInParameter(db, "@acname",DbType.String,ac.acname);
            DataAccess.DataAccess.db.AddInParameter(db, "@acintro",DbType.String,ac.acintro);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
