using System;
using System.Web.Configuration;

namespace BookShopOnline.WebConfig
{
    public class Config
    {
        public static readonly string SQLServerConnStr = WebConfigurationManager.ConnectionStrings["SQLServerConnStr"].ConnectionString;
        //public static readonly string SQLServerConnStr = "Data Source=WWW-7CEFE380175;Initial Catalog=BookShopOnlineDB;Integrated Security=True";//NUnit测试使用的，运行系统前应该改用上面的

        //public static string OracleConnStr = WebWebConfigurationManager.ConnectionStrings["OracleConnStr"].ConnectionString;
        //public static readonly string AccessConnStr = "";//WebWebConfigurationManager.ConnectionStrings["AccessConnStr"].ConnectionString;

        public static readonly string WebDal = WebConfigurationManager.AppSettings["WebDal"];
        //public static readonly string WebDal = "BookShopOnline.SQLServerDal";//NUnit测试使用的，运行系统前应该改用上面的

        public static readonly int RegisterUserPwdMinLength =Convert.ToInt32( WebConfigurationManager.AppSettings["RegisterUserPwdMinLength"]);
        //public static readonly int RegisterUserPwdMinLength = 6;//NUnit测试使用的，运行系统前应该改用上面的

        public static readonly int AdminUserPwdMinLength = Convert.ToInt32(WebConfigurationManager.AppSettings["AdminUserPwdMinLength"]);
        //public static readonly int AdminUserPwdMinLength = 8;//NUnit测试使用的，运行系统前应该改用上面的

        public static readonly int TopNewestBooks =Convert.ToInt32( WebConfigurationManager.AppSettings["TopNewestBooks"]);

        public static readonly int TopCommendBooks = Convert.ToInt32(WebConfigurationManager.AppSettings["TopCommendBooks"]);

        public static readonly int TopSoldBooks = Convert.ToInt32(WebConfigurationManager.AppSettings["TopSoldBooks"]);

        public static readonly int TopVisitedBooks = Convert.ToInt32(WebConfigurationManager.AppSettings["TopVisitedBooks"]);
        
        public static readonly string DefaultPic = WebConfigurationManager.AppSettings["DefaultPic"];

        public static readonly int BookNameSubLength = Convert.ToInt32(WebConfigurationManager.AppSettings["BookNameSubLength"]);

        public static readonly int BookListPageSize = Convert.ToInt32(WebConfigurationManager.AppSettings["BookListPageSize"]);
        //public static readonly int BookListPageSize = 4;//NUnit测试使用的，运行系统前应该改用上面的


        //邮件服务器配置 SmtpServerAddress SmtpUserName SmtpUserPwd SmtpFromEmail SmtpFromName
        public readonly static string SmtpServerAddress = WebConfigurationManager.AppSettings["SmtpServerAddress"];
        public readonly static string SmtpUserName = WebConfigurationManager.AppSettings["SmtpUserName"];
        public readonly static string SmtpUserPwd = WebConfigurationManager.AppSettings["SmtpUserPwd"];
        public readonly static string SmtpFromEmail = WebConfigurationManager.AppSettings["SmtpFromEmail"];
        public readonly static string SmtpFromName = WebConfigurationManager.AppSettings["SmtpFromName"];
        public readonly static int SmtpPort = Convert.ToInt32(WebConfigurationManager.AppSettings["SmtpPort"]);
        public readonly static bool SmtpEnableSsl = Convert.ToBoolean(WebConfigurationManager.AppSettings["SmtpEnableSsl"]);
    }
}
