Exemplo n.º 1
0
    private List <CurrrencyRateInfo> GetCountryCodeRates()
    {
        Hashtable            hst = new Hashtable();
        StoreSettingProvider sep = new StoreSettingProvider();

        if (HttpContext.Current.Cache["AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
        {
            hst = (Hashtable)HttpContext.Current.Cache["AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString()];

            List <CurrrencyRateInfo> currencies = (List <CurrrencyRateInfo>)hst["CURRENCY"];
            return(currencies);
        }
        else
        {
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID  = GetStoreID;
            aspxCommonObj.PortalID = GetPortalID;
            List <CurrrencyRateInfo> currencyRate = AspxCurrencyController.GetCountryCodeRates(aspxCommonObj);
            if (currencyRate.Count > 0)
            {
                hst.Add("CURRENCY", currencyRate);
                HttpContext.Current.Cache.Insert("AspxCurrencyRate" + GetPortalID.ToString() + GetStoreID.ToString(), hst);
            }
            else
            {
            }
            return(currencyRate);
        }
    }
    public void BindCurrencyList(AspxCommonInfo aspxCommonObj)
    {
        string aspxRootPath             = ResolveUrl("~/");
        List <CurrencyInfo> lstCurrency = AspxCurrencyController.BindCurrencyList(aspxCommonObj);

        if (lstCurrency != null && lstCurrency.Count > 0)
        {
            StringBuilder options = new StringBuilder();
            options.Append("<select id=\"ddlCurrency\" class=\"makeMeFancy\">");


            foreach (CurrencyInfo item in lstCurrency)
            {
                if (item.CurrencyCode == SelectedCurrency)
                {
                    options.Append("<option selected=\"selected\" data-icon=\"");
                    options.Append(aspxRootPath);
                    options.Append("images/flags/");
                    options.Append(item.BaseImage);
                    options.Append("\"  data-html-text=\"");
                    options.Append(item.CurrencySymbol);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("\" region=");
                    options.Append(item.Region);
                    options.Append("  value=\"");
                    options.Append(item.CurrencyCode);
                    options.Append("\" >");
                    options.Append(item.CurrencySymbol);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("</option>");
                }
                else
                {
                    options.Append("<option data-icon=\"");
                    options.Append(aspxRootPath);
                    options.Append("images/flags/");
                    options.Append(item.BaseImage);
                    options.Append("\"  data-html-text=\"");
                    options.Append(item.CurrencySymbol);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("\" region=");
                    options.Append(item.Region);

                    options.Append("  value=\"");
                    options.Append(item.CurrencyCode);
                    options.Append("\" >");
                    options.Append(item.CurrencySymbol);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("</option>");
                }
            }
            options.Append("</select>");
            litCurrency.Text = options.ToString();
        }
    }
Exemplo n.º 3
0
    public void BindCurrencyList()
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = GetStoreID;
        aspxCommonObj.PortalID    = GetPortalID;
        aspxCommonObj.UserName    = GetUsername;
        aspxCommonObj.CultureName = GetCurrentCultureName;
        string aspxRootPath             = ResolveUrl("~/");
        List <CurrencyInfo> lstCurrency = AspxCurrencyController.BindCurrencyList(aspxCommonObj);

        if (lstCurrency != null && lstCurrency.Count > 0)
        {
            StringBuilder options = new StringBuilder();
            options.Append("<select id=\"ddlCurrency\" class=\"makeMeFancy\">");
            if (Session["SelectedCurrency"] != null)
            {
                MainCurrency = Session["SelectedCurrency"].ToString();
            }

            foreach (CurrencyInfo item in lstCurrency)
            {
                if (item.CurrencyCode == MainCurrency)
                {
                    options.Append("<option selected=\"selected\" data-icon=\"");
                    options.Append(aspxRootPath);
                    options.Append("images/flags/");
                    options.Append(item.BaseImage);

                    options.Append("\"  data-html-text=\"");
                    options.Append(item.CurrencyName);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("\" region=");
                    options.Append(item.Region);
                    options.Append("  value=\"");
                    options.Append(item.CurrencyCode);
                    options.Append("\" >");
                    options.Append(item.CurrencyName);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("</option>");
                }
                else
                {
                    options.Append("<option data-icon=\"");
                    options.Append(aspxRootPath);
                    options.Append("images/flags/");
                    options.Append(item.BaseImage);
                    options.Append("\"  data-html-text=\"");
                    options.Append(item.CurrencyName);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("\" region=");
                    options.Append(item.Region);

                    options.Append("  value=\"");
                    options.Append(item.CurrencyCode);
                    options.Append("\" >");
                    options.Append(item.CurrencyName);
                    options.Append("-");
                    options.Append(item.CurrencyCode);
                    options.Append("</option>");
                }
            }
            options.Append("</select>");
            //litCurrency.Text = options.ToString();
        }
    }