Esempio n. 1
0
    private void LoadRewardPoints(AspxCommonInfo aspxCommonObj)
    {
        List <GeneralSettingInfo> lstGeneralSet = RewardPointsController.GetGeneralSetting(aspxCommonObj);

        StringBuilder scriptrewardPoint = new StringBuilder();

        if (lstGeneralSet.Count > 0)
        {
            RewardSettings = new JavaScriptSerializer().Serialize(lstGeneralSet.FirstOrDefault()).ToString();
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        servicePath = ResolveUrl(this.TemplateSourceDirectory);

        rewardpoint = CheckOutSessions.Get <double>("RewardPoints", 0);

        GetPortalCommonInfo(out StoreID, out PortalID, out CustomerID, out UserName, out CultureName, out SessionCode);
        aspxCommonObj = new AspxCommonInfo(StoreID, PortalID, UserName, CultureName, CustomerID, SessionCode);

        List <GeneralSettingInfo> lstGeneralSet = RewardPointsController.GetGeneralSetting(aspxCommonObj);

        StringBuilder scriptrewardPoint = new StringBuilder();

        if (lstGeneralSet.Count > 0)
        {
            GeneralSettings = new JavaScriptSerializer().Serialize(lstGeneralSet.FirstOrDefault()).ToString();
        }
    }
    private string LoadRewardPoints()
    {
        StoreSettingConfig ssc   = new StoreSettingConfig();
        bool isEnableRewardPoint = true;

        //ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, storeID, portalID, cultureName);


        if (isEnableRewardPoint)
        {
            List <GeneralSettingInfo> lstGeneralSet = RewardPointsController.GetGeneralSetting(aspxCommonObj);

            StringBuilder scriptrewardPoint = new StringBuilder();

            if (lstGeneralSet.Count > 0)
            {
                foreach (GeneralSettingInfo generalSettingInfo in lstGeneralSet)
                {
                    if (generalSettingInfo.IsActive)
                    {
                        decimal maxRewardPoints = generalSettingInfo.TotalRewardPoints;
                        //$(".divRange").append('<p><b style="color: #006699;margin-left:10px">' + "Range:" + '<span id="amount"></span></b></p>');
                        scriptrewardPoint.Append("  isRewardPointEnbled = true; $('#hdnRate').val(eval(" +
                                                 generalSettingInfo.RewardExchangeRate / generalSettingInfo.RewardPoints +
                                                 "));");
                        if (generalSettingInfo.AmountSpent != 0 && generalSettingInfo.AmountSpent != null)
                        {
                            scriptrewardPoint.Append(" $('#hdnRewardRate').val(eval(" +
                                                     generalSettingInfo.RewardPointsEarned / generalSettingInfo.AmountSpent +
                                                     "));");
                        }
                        else
                        {
                            scriptrewardPoint.Append(" $('#hdnRewardRate').val(eval(" + 0 + "));");
                        }
                        scriptrewardPoint.Append("   $('#hdnTotalRewardAmount').val(eval(" +
                                                 generalSettingInfo.TotalRewardAmount * rate + "));");
                        scriptrewardPoint.Append("  $('#hdnTotalRewardPoints').val(eval(" +
                                                 generalSettingInfo.TotalRewardPoints + "));");
                        scriptrewardPoint.Append("  $('#hdnMinRedeemBalance').val(eval(" +
                                                 generalSettingInfo.MinRedeemBalance + "));");
                        scriptrewardPoint.Append("  $('#hdnCapped').val(eval(" + generalSettingInfo.BalanceCapped +
                                                 "));");
                        scriptrewardPoint.Append("  $('#spanCapped').html(eval(" + generalSettingInfo.BalanceCapped +
                                                 "));");
                        scriptrewardPoint.Append("  $('#spanTotalRewardPoints').html('" +
                                                 generalSettingInfo.TotalRewardPoints + "');");
                        scriptrewardPoint.Append("  $('#spanTotalRewardAmount').html('" +
                                                 generalSettingInfo.TotalRewardAmount * rate + "');");
                        scriptrewardPoint.Append("   $('#spanRPExchangePoints').html('" +
                                                 generalSettingInfo.RewardPoints + "');");
                        scriptrewardPoint.Append("  $('#spanRPExchangeAmount').html('" +
                                                 generalSettingInfo.RewardExchangeRate * rate + "');");
                        scriptrewardPoint.Append("  $('#spanTotalRP').html('" + generalSettingInfo.TotalRewardPoints +
                                                 "');");
                        scriptrewardPoint.Append("  $('#spanTotalRA').html('" + generalSettingInfo.TotalRewardAmount * rate +
                                                 "');");
                        //AspxCart.SetSessionValue('earningRewardPoints', true);
                        scriptrewardPoint.Append("   $('.divRange').show();");
                        scriptrewardPoint.Append("  $('#dvUsePoints').show();");
                        scriptrewardPoint.Append("   $('#dvRewardPointsMain').show();");
                        scriptrewardPoint.Append("   $('#trDiscountReward').show();");
                        //AspxCart.RewardRuleIsActive();
                        bool IsPurchaseActive = RewardPointsController.IsPurchaseActive(aspxCommonObj);
                        scriptrewardPoint.Append("isPurchaseActive=" + IsPurchaseActive.ToString().ToLower() + ";");
                        if (IsPurchaseActive)
                        {
                            scriptrewardPoint.Append(" $('#dvRPCurrent').show();");
                        }
                        //to set slider value  $("#slider-range").slider("option", "values", [10, 200]);

                        scriptrewardPoint.Append(
                            "$('#slider-range').slider({range: true,min: 0,max:" + maxRewardPoints + ",values: [0, " +
                            maxRewardPoints +
                            "],slide: function(event, ui) {$('#amount').html('<span>' + ui.values[0] + '</span>' + ' - ' + '<span>' + ui.values[1] + '</span>');},change: function(event, ui) { $('#amount').html('<span>' + ui.values[0] + '</span>' + '-' + '<span>' + ui.values[1] + '</span>');}});");
                        scriptrewardPoint.Append(
                            "$('#amount').html('<span>' + $('#slider-range').slider('values', 0) + '</span>' +' - ' + '<span>' + $('#slider-range').slider('values', 1) + '</span>');");

                        scriptrewardPoint.Append(" $('.cssClassFormatCurrency').formatCurrency({ colorize: true, region: '' + region + '' });");

                        // string script = GetStringScript(.ToString());
                        return(scriptrewardPoint.ToString());
                    }
                }
            }
        }
        return("");
    }
Esempio n. 4
0
    private string LoadRewardPoints()
    {
        StoreSettingConfig ssc   = new StoreSettingConfig();
        bool isEnableRewardPoint = true;


        if (isEnableRewardPoint)
        {
            List <GeneralSettingInfo> lstGeneralSet = RewardPointsController.GetGeneralSetting(aspxCommonObj);

            StringBuilder scriptrewardPoint = new StringBuilder();

            if (lstGeneralSet.Count > 0)
            {
                foreach (GeneralSettingInfo generalSettingInfo in lstGeneralSet)
                {
                    if (generalSettingInfo.IsActive)
                    {
                        decimal maxRewardPoints = generalSettingInfo.TotalRewardPoints;
                        scriptrewardPoint.Append("  isRewardPointEnbled = true; $('#hdnRate').val(eval(" +
                                                 generalSettingInfo.RewardExchangeRate / generalSettingInfo.RewardPoints +
                                                 "));");
                        if (generalSettingInfo.AmountSpent != 0 && generalSettingInfo.AmountSpent != null)
                        {
                            scriptrewardPoint.Append(" $('#hdnRewardRate').val(eval(" +
                                                     generalSettingInfo.RewardPointsEarned / generalSettingInfo.AmountSpent +
                                                     "));");
                        }
                        else
                        {
                            scriptrewardPoint.Append(" $('#hdnRewardRate').val(eval(" + 0 + "));");
                        }
                        scriptrewardPoint.Append("   $('#hdnTotalRewardAmount').val(eval(" +
                                                 generalSettingInfo.TotalRewardAmount + "));");
                        scriptrewardPoint.Append("  $('#hdnTotalRewardPoints').val(eval(" +
                                                 generalSettingInfo.TotalRewardPoints + "));");
                        scriptrewardPoint.Append("  $('#hdnMinRedeemBalance').val(eval(" +
                                                 generalSettingInfo.MinRedeemBalance + "));");
                        scriptrewardPoint.Append("  $('#hdnCapped').val(eval(" + generalSettingInfo.BalanceCapped +
                                                 "));");
                        scriptrewardPoint.Append("  $('#spanCapped').html(eval(" + generalSettingInfo.BalanceCapped +
                                                 "));");
                        scriptrewardPoint.Append("  $('#spanTotalRewardPoints').html('" +
                                                 generalSettingInfo.TotalRewardPoints + "');");
                        scriptrewardPoint.Append("  $('#spanTotalRewardAmount').html('" +
                                                 generalSettingInfo.TotalRewardAmount + "');");
                        scriptrewardPoint.Append("   $('#spanRPExchangePoints').html('" +
                                                 generalSettingInfo.RewardPoints + "');");
                        scriptrewardPoint.Append("  $('#spanRPExchangeAmount').html('" +
                                                 generalSettingInfo.RewardExchangeRate + "');");
                        scriptrewardPoint.Append("  $('#spanTotalRP').html('" + generalSettingInfo.TotalRewardPoints +
                                                 "');");
                        scriptrewardPoint.Append("  $('#spanTotalRA').html('" + generalSettingInfo.TotalRewardAmount +
                                                 "');");
                        scriptrewardPoint.Append("   $('.divRange').show();");
                        scriptrewardPoint.Append("  $('#dvUsePoints').show();");
                        scriptrewardPoint.Append("   $('#dvRewardPointsMain').show();");
                        scriptrewardPoint.Append("   $('#trDiscountReward').show();");
                        bool IsPurchaseActive = RewardPointsController.IsPurchaseActive(aspxCommonObj);
                        scriptrewardPoint.Append("isPurchaseActive=" + IsPurchaseActive.ToString().ToLower() + ";");
                        if (IsPurchaseActive)
                        {
                            scriptrewardPoint.Append(" $('#dvRPCurrent').show();");
                        }

                        scriptrewardPoint.Append(
                            "$('#slider-range').slider({range: true,min: 0,max:" + maxRewardPoints + ",values: [0, " +
                            maxRewardPoints +
                            "],slide: function(event, ui) {$('#amount').html('<span>' + ui.values[0] + '</span>' + ' - ' + '<span>' + ui.values[1] + '</span>');},change: function(event, ui) { $('#amount').html('<span>' + ui.values[0] + '</span>' + '-' + '<span>' + ui.values[1] + '</span>');}});");
                        scriptrewardPoint.Append(
                            "$('#amount').html('<span>' + $('#slider-range').slider('values', 0) + '</span>' +' - ' + '<span>' + $('#slider-range').slider('values', 1) + '</span>');");


                        return(scriptrewardPoint.ToString());
                    }
                }
            }
        }
        return("");
    }
Esempio n. 5
0
    private void LoadRewardPoints()
    {
        StoreSettingConfig ssc   = new StoreSettingConfig();
        bool isEnableRewardPoint = true;//ssc.GetStoreSettingsByKey(StoreSetting.DefaultProductImageURL, storeID, portalID, cultureName);

        if (isEnableRewardPoint)
        {
            List <GeneralSettingInfo> lstGeneralSet      = RewardPointsController.GetGeneralSetting(aspxCommonObj);
            StringBuilder             rewardPointBuilder = new StringBuilder();
            StringBuilder             scriptrewardPoint  = new StringBuilder();

            if (lstGeneralSet.Count > 0)
            {
                foreach (GeneralSettingInfo generalSettingInfo in lstGeneralSet)
                {
                    if (generalSettingInfo.IsActive)
                    {
                        if (generalSettingInfo.AmountSpent != 0 && generalSettingInfo.AmountSpent != null)
                        {
                            scriptrewardPoint.Append(" $(\"#hdnRewardRate\").val(eval(" +
                                                     generalSettingInfo.RewardPointsEarned / generalSettingInfo.AmountSpent +
                                                     "));");
                        }
                        else
                        {
                            scriptrewardPoint.Append(" $(\"#hdnRewardRate\").val(eval(" + 0 + "));");
                        }

                        scriptrewardPoint.Append("$(\"#hdnRate\").val(eval(" +
                                                 generalSettingInfo.RewardExchangeRate / generalSettingInfo.RewardPoints +
                                                 "));");

                        bool IsPurchaseActive = RewardPointsController.IsPurchaseActive(aspxCommonObj);
                        scriptrewardPoint.Append("CheckOut.UserCart.IsPurchaseActive=" +
                                                 IsPurchaseActive.ToString().ToLower() + ";");

                        RewardPointsController.RewardPointsSelectedValue("btnRewardPointsValue");



                        decimal rewardPointsSliderSelectedValue =
                            RewardPointsController.RewardPointsSelectedValue("btnRewardPointsValue");

                        if (rewardPointsSliderSelectedValue > 0)
                        {
                            scriptrewardPoint.Append("CheckOut.UserCart.RewardPointsDiscount = eval(" +
                                                     rewardPointsSliderSelectedValue +
                                                     "* parseFloat($(\"#hdnRate\").val()).toFixed(2));");
                            scriptrewardPoint.Append("CheckOut.UserCart.UsedRewardPoints =" +
                                                     rewardPointsSliderSelectedValue + ";");
                            scriptrewardPoint.Append(
                                " $(\"#txtRewardAmount\").val(CheckOut.UserCart.RewardPointsDiscount);");
                        }
                        else
                        {
                            scriptrewardPoint.Append(
                                "CheckOut.UserCart.RewardPointsDiscount = 0;CheckOut.UserCart.UsedRewardPoints = 0;");
                        }
                        scriptrewardPoint.Append(" $(\"#trDiscountReward\").show();");
                        ScriptsToRun += scriptrewardPoint.ToString();
                    }
                }
            }
        }
    }