Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID     = GetStoreID;
            aspxCommonObj.PortalID    = GetPortalID;
            aspxCommonObj.UserName    = GetUsername;
            aspxCommonObj.CultureName = GetCurrentCultureName;
            if (!IsPostBack)
            {
                StoreSettingConfig ssc = new StoreSettingConfig();
                if (Session["CurrencyCode"] != null && Session["CurrencyCode"] != "")
                {
                    SelectedCurrency = Session["CurrencyCode"].ToString();
                }
                else
                {
                    SelectedCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, GetStoreID, GetPortalID, GetCurrentCultureName);
                }
                IncludeJs("Currencyconversion", "/js/CurrencyFormat/jquery.formatCurrency-1.4.0.js", "/js/CurrencyFormat/jquery.formatCurrency.all.js", "/js/FancyDropDown/fancyDropDown.js", "/Modules/AspxCommerce/AspxCurrencyConverter/js/AspxCurrencyConverter.js");//
                IncludeCss("Currencyconversion", "/Templates/" + TemplateName + "/css/FancyDropDown/fancy.css");
                StoreID      = GetStoreID;
                PortalID     = GetPortalID;
                CultureName  = GetCurrentCultureName;
                MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, StoreID, PortalID, CultureName);

                MyAccoutURL = ssc.GetStoreSettingsByKey(StoreSetting.MyAccountURL, StoreID, PortalID, CultureName);
                SingleAddressCheckOutURL = ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, StoreID, PortalID, CultureName);
                CompareItemListURL       = ssc.GetStoreSettingsByKey(StoreSetting.CompareItemURL, StoreID, PortalID, CultureName);
                MyCartURL       = ssc.GetStoreSettingsByKey(StoreSetting.ShoppingCartURL, StoreID, PortalID, CultureName);
                AdditionalCVR   = ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, StoreID, PortalID, CultureName);
                ItemMgntPageURL = ssc.GetStoreSettingsByKey(StoreSetting.ItemMgntPageURL, StoreID, PortalID, CultureName);
                if (Session["Region"] != null && Session["Region"] != "")
                {
                    Region = Session["Region"].ToString();
                }
                else
                {
                    Region = StoreSetting.GetRegionFromCurrencyCode(SelectedCurrency, StoreID, PortalID);
                }

                AspxCommerceWebService aws = new AspxCommerceWebService();
                aws.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, SelectedCurrency, Region);
                if (Session["CurrencyRate"] != null && Session["CurrencyRate"] != "")
                {
                    currencyRate = Math.Round(double.Parse(Session["CurrencyRate"].ToString()), 4);
                }
            }
            IncludeLanguageJS();
            //BindCurrencyList();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }
    private void StartProccess()
    {
        try
        {
            var ssc = new StoreSettingConfig();
            Currency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, OrderDetail.StoreId, OrderDetail.PortalId, OrderDetail.CultureName);
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID  = OrderDetail.StoreId;
            aspxCommonObj.PortalID = OrderDetail.PortalId;
            if (PaypalSupportedCurrency.paypalSupportedCurrency.Split(',').Where(s => string.Compare(Currency, s, true) == 0).Count() > 0)
            {
                Rate             = 1;
                SelectedCurrency = Currency;
            }
            else
            {
                var aws = new AspxCommerceWebService();
                Rate             = aws.GetCurrencyRateOnChange(aspxCommonObj, Currency, "USD", "en-US");
                Currency         = "USD";
                SelectedCurrency = Currency;

                //Some time if selected currency does not exist in currency table then it returns 1,
                //if we take 1 as rate then it will convert same as previous amount
                // So avoid Transaction by making it 0
                if (Rate == 1)
                {
                    Rate = 0;
                }
            }
            if (Rate != 0)
            {
                // Set Transaction Currency code in session to save transactionLog table
                Session["SelectedCurrency"] = SelectedCurrency;
                LoadSetting();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                if (Session["GoogleCheckOutData"] != null)
                {
                    string[] data = Session["GoogleCheckOutData"].ToString().Split('#');
                    storeID     = int.Parse(data[0].ToString());
                    portalID    = int.Parse(data[1].ToString());
                    userName    = data[2];
                    customerID  = int.Parse(data[3].ToString());
                    sessionCode = data[4].ToString();
                    cultureName = data[5];
                    itemIds     = data[6];
                    couponCode  = data[7];
                    Spath       = ResolveUrl("~/Modules/AspxCommerce/AspxCommerceServices/");

                    StoreSettingConfig ssc = new StoreSettingConfig();
                    MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, storeID, portalID, cultureName);
                    AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
                    aspxCommonObj.StoreID  = storeID;
                    aspxCommonObj.PortalID = portalID;
                    if (GoogleCheckOutSupportedCurrency.googleCheckOutSupportedCurrency.Split(',').Where(s => string.Compare(MainCurrency, s, true) == 0).Count() > 0)
                    {
                        rate             = 1;
                        SelectedCurrency = MainCurrency;
                    }
                    else
                    {
                        AspxCommerceWebService aws = new AspxCommerceWebService();
                        rate             = aws.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, "USD", "en-US");
                        MainCurrency     = "USD";
                        SelectedCurrency = MainCurrency;

                        /* Some time if selected currency does not exist in currency table then it returns 1,
                         *    if we take 1 as rate then it will convert same as previous amount
                         *     So avoid Transaction by making it 0 */
                        if (rate == 1)
                        {
                            rate = 0;
                        }
                    }

                    if (rate != 0)
                    {
                        // Set Transaction Currency code in session to save transactionLog table
                        //Session["SelectedCurrency"] = SelectedCurrency;
                        LoadSetting();
                    }
                    else
                    {
                        lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                        clickhere.Visible = false;
                    }
                    HttpContext.Current.Session.Remove("GoogleCheckOutData");
                }
                else
                {
                    lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                    clickhere.Visible = false;
                }
            }
            catch (Exception ex)
            {
                lblnotity.Text    = "Something goes wrong, hit refresh or go back to checkout";
                clickhere.Visible = false;
                ProcessException(ex);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo();
            aspxCommonObj.StoreID     = GetStoreID;
            aspxCommonObj.PortalID    = GetPortalID;
            aspxCommonObj.UserName    = GetUsername;
            aspxCommonObj.CultureName = GetCurrentCultureName;

            if (!IsPostBack)
            {
                if (Session["OrderID"] != null)
                {
                    orderID = int.Parse(Session["OrderID"].ToString());
                }

                StoreSettingConfig     ssc = new StoreSettingConfig();
                AspxCommerceWebService aws = new AspxCommerceWebService();
                //Store Default Currency
                MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, GetPortalID, GetPortalID, GetCurrentCultureName);

                if (Session["CurrencyCode"] != null && Session["CurrencyCode"] != "")
                {
                    SelectedCurrency = Session["CurrencyCode"].ToString();
                }
                else
                {
                    SelectedCurrency = MainCurrency;
                }
                if (Session["Region"] != null && Session["Region"] != "")
                {
                    Region = Session["Region"].ToString();
                }
                else
                {
                    Region = StoreSetting.GetRegionFromCurrencyCode(SelectedCurrency, GetStoreID, GetPortalID);
                }

                //Rate to convert Store Default Item Price to Selcted curency Price
                currencyRate = Convert.ToDecimal(aws.GetCurrencyRateOnChange(aspxCommonObj, MainCurrency, SelectedCurrency, Region));



                var sfConfig = new SageFrameConfig();
                _isUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                PageExtension      = SageFrameSettingKeys.PageExtension;
                if (_isUseFriendlyUrls)
                {
                    if (GetPortalID > 1)
                    {
                        _sageRedirectPath = ResolveUrl("~/portal/" + GetPortalSEOName + "/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + PageExtension);
                        _addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/portal/" + GetPortalSEOName + "/";
                    }
                    else
                    {
                        _sageRedirectPath = ResolveUrl("~/" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + PageExtension);
                        _addressPath      = HttpContext.Current.Request.ServerVariables["SERVER_NAME"] + "/";
                    }
                }
                else
                {
                    _sageRedirectPath = ResolveUrl("{~/Default" + PageExtension + "?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + sfConfig.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage));
                }

                var imgProgress = (Image)UpdateProgress1.FindControl("imgPrgress");
                if (imgProgress != null)
                {
                    imgProgress.ImageUrl = GetTemplateImageUrl("ajax-loader.gif", true);
                }
                hlnkHomePage.NavigateUrl = _sageRedirectPath;
                SendEmailFrom            = ssc.GetStoreSettingsByKey(StoreSetting.SendEcommerceEmailsFrom, GetStoreID, GetPortalID, GetCurrentCultureName);
                SendOrderNotice          = ssc.GetStoreSettingsByKey(StoreSetting.SendOrderNotification, GetStoreID, GetPortalID, GetCurrentCultureName);

                if (Session["mb_IsCheckoutFromMobile"] != null)
                {
                    MobileSuccess(_sageRedirectPath);
                }
                else
                {
                    SendConfrimMessage(_sageRedirectPath);
                }
            }
            IncludeLanguageJS();
        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }
    }