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

namespace Fm.Bussiness
{
    public class singlepage
    {
        /// <summary>
        /// µ¥Ò³Ìí¼Ó
        /// </summary>
        /// <param name="sp"></param>
        /// <returns></returns>
        public bool ADD(Fm.EntityClass.singlepage sp)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_singlepage_ADD");
            DataAccess.DataAccess.db.AddOutParameter(db, "@sid", DbType.Int32, sp.sid);
            DataAccess.DataAccess.db.AddInParameter(db, "@stitle", DbType.String, sp.stitle);
            DataAccess.DataAccess.db.AddInParameter(db, "@skeywords", DbType.String, sp.skeywords);
            DataAccess.DataAccess.db.AddInParameter(db, "@sintro", DbType.String, sp.sintro);
            DataAccess.DataAccess.db.AddInParameter(db, "@scontent", DbType.String, sp.scontent);
            DataAccess.DataAccess.db.AddInParameter(db, "@stemplates", DbType.String, sp.stemplates);
            DataAccess.DataAccess.db.AddInParameter(db, "@spath", DbType.String, sp.spath);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
        /// <summary>
        /// µ¥Ò³ÐÞ¸Ä
        /// </summary>
        /// <param name="sp"></param>
        /// <returns></returns>
        public bool Update(Fm.EntityClass.singlepage sp)
        {
            DbCommand db = DataAccess.DataAccess.db.GetStoredProcCommand("Fm_singlepage_Update");
            DataAccess.DataAccess.db.AddInParameter(db, "@sid", DbType.Int32, sp.sid);
            DataAccess.DataAccess.db.AddInParameter(db, "@stitle", DbType.String, sp.stitle);
            DataAccess.DataAccess.db.AddInParameter(db, "@skeywords", DbType.String, sp.skeywords);
            DataAccess.DataAccess.db.AddInParameter(db, "@sintro", DbType.String, sp.sintro);
            DataAccess.DataAccess.db.AddInParameter(db, "@scontent", DbType.String, sp.scontent);
            DataAccess.DataAccess.db.AddInParameter(db, "@stemplates", DbType.String, sp.stemplates);
            DataAccess.DataAccess.db.AddInParameter(db, "@spath", DbType.String, sp.spath);
            return DataAccess.DataAccess.GetData.Query<DbCommand>(db);
        }
    }
}
