Beispiel #1
0
    /// <summary>
    /// Indicates if exchange rate from global main currency is needed.
    /// </summary>
    protected bool IsFromGlobalRateNeeded()
    {
        string siteName = SiteInfoProvider.GetSiteName(ConfiguredSiteID);

        if ((ConfiguredSiteID == 0) || (ECommerceSettings.UseGlobalCurrencies(siteName)))
        {
            return(false);
        }

        string globalMainCode = CurrencyInfoProvider.GetMainCurrencyCode(0);
        string siteMainCode   = CurrencyInfoProvider.GetMainCurrencyCode(ConfiguredSiteID);

        // Check whether main currencies are defined
        if (string.IsNullOrEmpty(siteMainCode) || string.IsNullOrEmpty(globalMainCode))
        {
            return(false);
        }

        // Check whether global and site main currency are the same
        if (globalMainCode.ToLowerCSafe() == siteMainCode.ToLowerCSafe())
        {
            return(false);
        }

        return(ECommerceSettings.AllowGlobalDiscountCoupons(siteName) ||
               ECommerceSettings.AllowGlobalProductOptions(siteName) ||
               ECommerceSettings.AllowGlobalProducts(siteName) ||
               ECommerceSettings.AllowGlobalShippingOptions(siteName) ||
               ECommerceSettings.UseGlobalCredit(siteName) ||
               ECommerceSettings.UseGlobalTaxClasses(siteName));
    }
    /// <summary>
    /// Determines if the discount coupons are available for the current site.
    /// </summary>
    private bool AreDiscountCouponsAvailableOnSite()
    {
        string siteName = this.ShoppingCartInfoObj.SiteName;

        // Check site and global discount coupons
        string where = "DiscountCouponSiteID = " + SiteInfoProvider.GetSiteID(siteName);
        if (ECommerceSettings.AllowGlobalDiscountCoupons(siteName))
        {
            where += " OR DiscountCouponSiteID IS NULL";
        }

        // Coupons are available if found any
        DataSet ds = DiscountCouponInfoProvider.GetDiscountCoupons(where, null, -1, "count(DiscountCouponID)");

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            return(ValidationHelper.GetInteger(ds.Tables[0].Rows[0][0], 0) > 0);
        }

        return(false);
    }
    /// <summary>
    /// Indicates if exchange rate from global main currency is needed.
    /// </summary>
    protected bool IsFromGlobalRateNeeded()
    {
        var siteId = ConfiguredSiteID;

        if ((siteId == 0) || (ECommerceSettings.UseGlobalCurrencies(siteId)))
        {
            return(false);
        }

        string globalMainCode = CurrencyInfoProvider.GetMainCurrencyCode(0);
        string siteMainCode   = CurrencyInfoProvider.GetMainCurrencyCode(siteId);

        // Check whether main currencies are defined
        if (string.IsNullOrEmpty(siteMainCode) || string.IsNullOrEmpty(globalMainCode))
        {
            return(false);
        }

        // Check whether global and site main currency are the same
        if (globalMainCode.EqualsCSafe(siteMainCode, true))
        {
            return(false);
        }

        // Check if site has currency with same code as global main -> no need for global rate
        if (CurrencyInfoProvider.GetCurrenciesByCode(siteId).ContainsKey(globalMainCode))
        {
            return(false);
        }

        return(ECommerceSettings.AllowGlobalDiscountCoupons(siteId) ||
               ECommerceSettings.AllowGlobalProductOptions(siteId) ||
               ECommerceSettings.AllowGlobalProducts(siteId) ||
               ECommerceSettings.UseGlobalCredit(siteId) ||
               ECommerceSettings.UseGlobalTaxClasses(siteId));
    }