Exemplo n.º 1
0
        public static void CrateNccWebSite(NccDbContext dbContext, WebSiteInfo webSiteInfo)
        {
            var webSiteRepository     = new NccWebSiteRepository(dbContext);
            var webSiteInfoRepository = new NccWebSiteInfoRepository(dbContext);
            var webSiteService        = new NccWebSiteService(webSiteRepository, webSiteInfoRepository);
            var webSite = new NccWebSite()
            {
                Name = webSiteInfo.SiteName,
                AllowRegistration = true,
                DateFormat        = "dd/MM/yyyy",
                TimeFormat        = "hh:mm:ss",
                EmailAddress      = webSiteInfo.Email,
                Language          = webSiteInfo.Language,
                NewUserRole       = "Subscriber",
                TimeZone          = "UTC_6",
            };

            webSite.WebSiteInfos = new List <NccWebSiteInfo>();
            webSite.WebSiteInfos.Add(new NccWebSiteInfo()
            {
                Language  = webSiteInfo.Language,
                Name      = webSiteInfo.SiteName,
                SiteTitle = webSiteInfo.SiteName,
                Tagline   = webSiteInfo.Tagline
            });

            webSiteService.Save(webSite);
        }
Exemplo n.º 2
0
        //public static void CreateWebSite(NccDbContext dbContext, WebSiteInfo setupInfo)
        //{
        //    var webSiteRepository = new NccWebSiteRepository(dbContext);
        //    var webSiteInfoRepository = new NccWebSiteInfoRepository(dbContext);

        //    var webSiteService = new NccWebSiteService(webSiteRepository, webSiteInfoRepository);
        //    var webSite = new NccWebSite()
        //    {
        //        AllowRegistration = true,
        //        //Copyrights = "Copyright (c) " + DateTime.Now.Year + " " + setupInfo.SiteName,
        //        DateFormat = "dd/mm/yyyy",
        //        EmailAddress = setupInfo.Email,
        //        Name = setupInfo.SiteName,
        //        NewUserRole = "Reader",
        //        //SiteTitle = setupInfo.SiteName,
        //        //Tagline = setupInfo.Tagline,
        //        TimeFormat = "hh:mm:ss",
        //        TimeZone = "UTC_6"
        //    };
        //    webSiteService.Save(webSite);
        //}

        public static void CrateNccWebSite(NccDbContext dbContext, WebSiteInfo webSiteInfo)
        {
            var webSiteRepository     = new NccWebSiteRepository(dbContext);
            var webSiteInfoRepository = new NccWebSiteInfoRepository(dbContext);
            var webSiteService        = new NccWebSiteService(webSiteRepository, webSiteInfoRepository);
            var webSite = new NccWebSite()
            {
                Name = webSiteInfo.SiteName,
                AllowRegistration = true,
                DateFormat        = "dd/MM/yyyy",
                TimeFormat        = "hh:mm:ss",
                EmailAddress      = webSiteInfo.Email,
                Language          = webSiteInfo.Language,
                NewUserRole       = "Subscriber",
                TimeZone          = "UTC_6",
                EnableCache       = webSiteInfo.EnableCache
            };

            if (string.IsNullOrEmpty(webSiteInfo.TablePrefix) == false)
            {
                if (webSiteInfo.TablePrefix.EndsWith("_"))
                {
                    webSite.TablePrefix = webSiteInfo.TablePrefix.Trim();
                }
                else
                {
                    webSite.TablePrefix = webSiteInfo.TablePrefix.Trim() + "_";
                }
            }
            else
            {
                webSite.TablePrefix = "";
            }

            webSite.WebSiteInfos = new List <NccWebSiteInfo>();
            foreach (var item in SupportedCultures.Cultures)
            {
                webSite.WebSiteInfos.Add(new NccWebSiteInfo()
                {
                    Language  = item.TwoLetterISOLanguageName,
                    Name      = webSiteInfo.SiteName,
                    SiteTitle = webSiteInfo.SiteName,
                    Tagline   = webSiteInfo.Tagline
                });
            }

            webSiteService.Save(webSite);
        }
Exemplo n.º 3
0
        public static void CreateWebSite(NccDbContext dbContext, WebSiteInfo setupInfo)
        {
            var webSiteRepository     = new NccWebSiteRepository(dbContext);
            var webSiteInfoRepository = new NccWebSiteInfoRepository(dbContext);

            var webSiteService = new NccWebSiteService(webSiteRepository, webSiteInfoRepository);
            var webSite        = new NccWebSite()
            {
                AllowRegistration = true,
                //Copyrights = "Copyright (c) " + DateTime.Now.Year + " " + setupInfo.SiteName,
                DateFormat   = "dd/mm/yyyy",
                EmailAddress = setupInfo.Email,
                Name         = setupInfo.SiteName,
                NewUserRole  = "Reader",
                //SiteTitle = setupInfo.SiteName,
                //Tagline = setupInfo.Tagline,
                TimeFormat = "hh:mm:ss",
                TimeZone   = "UTC_6"
            };

            webSiteService.Save(webSite);
        }
Exemplo n.º 4
0
 public NccWebSiteService(NccWebSiteRepository entityRepository, NccWebSiteInfoRepository nccWebSiteInfoRepository)
 {
     _entityRepository      = entityRepository;
     _webSiteInfoRepository = nccWebSiteInfoRepository;
 }