/*
 * 程序名称: JumboTCMS(将博内容管理系统通用版)
 * 
 * 程序版本: 6.x
 * 
 * 程序作者: 将博开发团队 (商业合作请联系：791104444@qq.com)
 * 
 * 版权申明: http://www.jumbotcms.net/about/copyright.html
 * 
 * 技术答疑: http://forum.jumbotcms.net/
 * 
 */

using System;
using System.Data;
namespace JumboTCMS.DAL
{
    public class ModuleCommand
    {
        public static IModule IMD;
        static ModuleCommand()
        {

        }
        /// <summary>
        /// 得到内容页地址
        /// </summary>
        /// <param name="_page"></param>
        /// <param name="_ishtml"></param>
        /// <param name="_channelid"></param>
        /// <param name="_contentid"></param>
        /// <returns></returns>
        public static string GetContentLink(string _module, int _page, bool _ishtml, string _channelid, string _contentid, bool _truefile)
        {
            IMD = (IModule)Activator.CreateInstance(Type.GetType(String.Format("JumboTCMS.DAL.Module_{0}DAL", _module), true, true));
            return IMD.GetContentLink(_page, _ishtml, _channelid, _contentid, _truefile);
        }
        /// <summary>
        /// 生成内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        /// <param name="_CurrentPage"></param>
        public static void CreateContent(string _module, string _ChannelId, string _ContentId, int _CurrentPage)
        {
            IMD = (IModule)Activator.CreateInstance(Type.GetType(String.Format("JumboTCMS.DAL.Module_{0}DAL", _module), true, true));
            IMD.CreateContent(_ChannelId, _ContentId, _CurrentPage);
        }
        /// <summary>
        /// 得到内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        /// <param name="_CurrentPage"></param>
        public static string GetContent(string _module, string _ChannelId, string _ContentId, int _CurrentPage)
        {
            IMD = (IModule)Activator.CreateInstance(Type.GetType(String.Format("JumboTCMS.DAL.Module_{0}DAL", _module), true, true));
            return IMD.GetContent(_ChannelId, _ContentId, _CurrentPage);
        }
        /// <summary>
        /// 删除内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        public static void DeleteContent(string _module, string _ChannelId, string _ContentId)
        {
            IMD = (IModule)Activator.CreateInstance(Type.GetType(String.Format("JumboTCMS.DAL.Module_{0}DAL", _module), true, true));
            IMD.DeleteContent(_ChannelId, _ContentId);
        }
    }
}
