Ejemplo n.º 1
0
        public tbl_Domains SaveDomain(string address, string name, string phone, string consumerKey, string consumerSecret, string css, string defaultDesc, string keywords,
                                      int langID, string title, string desc, string domainName, string email, string googleAnalytics, string googleAnalyticsCode, bool googleAnalyticsVisible,
                                      string robots, string headline, int homePageID, int?launchYear, bool primaryDomain, string share, string twitterSecret, string twitterToken, string twitterUser, bool updateTwitter,
                                      bool isMailChimpEnabled, string mailChimpAPIKey, string mailChimpListID, bool isCommuniGatorEnabled, string communiGatorUser, string communiGatorPassword,
                                      List <tbl_SettingsValue> settingsValues, bool IsPaypalPayment, bool IsSagePayPayment, bool IsSecureTradingPayment, EventViewType eventView, bool enableEventSale,
                                      bool enableProductSale, string theme, bool devMode, int domainID, bool isCoockieConsentEnabled, bool isStripePayment, List <tbl_Social> socialValues, bool customRouteHandler)
        {
            if (String.IsNullOrEmpty(domainName))
            {
                return(null);
            }

            var domain = DomainsRepository.SaveDomain(address, name, phone, consumerKey, consumerSecret,
                                                      css, defaultDesc, keywords, langID, title, desc, domainName, email, googleAnalytics, googleAnalyticsCode,
                                                      googleAnalyticsVisible, robots, headline, homePageID, launchYear, primaryDomain, share, twitterSecret,
                                                      twitterToken, twitterUser, updateTwitter, isMailChimpEnabled, mailChimpAPIKey, mailChimpListID,
                                                      isCommuniGatorEnabled, communiGatorUser, communiGatorPassword, eventView, enableEventSale,
                                                      enableProductSale, theme, devMode, isCoockieConsentEnabled, customRouteHandler, domainID);

            if (domain != null)
            {
                if (domainID == 0)
                {
                    foreach (var value in Enum.GetValues(typeof(SiteMapType)))
                    {
                        SiteMapType type = (SiteMapType)Enum.Parse(typeof(SiteMapType), value.ToString());

                        var sitemap = SitemapRepository.SaveSiteMap(string.Empty, 1, 0, domain.DomainID, String.Empty, false, false, type.ToString(), null,
                                                                    (decimal)0.5, String.Empty, FriendlyUrl.CreateFriendlyUrl(type.ToString()), true, false, ContentType.Content, type.ToString(), 0, 0, (int)type, true);

                        if (sitemap != null)
                        {
                            ContentRepository.SaveContent(String.Empty, String.Empty, type.ToString(), 0, string.Empty, type.ToString(), type.ToString(),
                                                          string.Empty, 0, string.Empty, string.Empty, string.Empty, type.ToString(), string.Empty, false, sitemap.SiteMapID, 0);
                        }
                    }

                    socialValues = this.GetDefaultSocialValues(domain.DomainID);
                }

                PaymentDomainRepository.UpdateStatus(IsPaypalPayment, PaymentType.PayPal, domain.DomainID);
                PaymentDomainRepository.UpdateStatus(IsSagePayPayment, PaymentType.SagePay, domain.DomainID);
                PaymentDomainRepository.UpdateStatus(IsSecureTradingPayment, PaymentType.SecureTrading, domain.DomainID);
                PaymentDomainRepository.UpdateStatus(isStripePayment, PaymentType.Stripe, domain.DomainID);
                SettingsValuesRepository.Save(settingsValues, domain.DomainID);
                SocialRepository.SaveMultipleSocial(socialValues);
                return(domain);
            }

            return(null);
        }
Ejemplo n.º 2
0
 private T GetSettingsValue <T>(SettingsKey key, int domainID)
 {
     if (domainID == 0)
     {
         var settings = SettingsRepository.GetValueByKey(key);
         return((settings == null) ?
                (T)Activator.CreateInstance(typeof(T), typeof(T) == typeof(string) ? new Char[1] : null) :
                Parse <T>(settings.SE_Value, key));
     }
     else
     {
         var settings = SettingsValuesRepository.GetValueByKey(key, domainID);
         return((settings == null) ?
                (T)Activator.CreateInstance(typeof(T), typeof(T) == typeof(string) ? new Char[1] : null) :
                Parse <T>(settings.SV_Value, key));
     }
 }