Example #1
0
        private static string GetStringPriceInplace(float price, float currentCurrencyRate, string currentCurrencyCode, float discount, float amount, bool isCodeBefore, string priceFormat, string zeroPriceMsg, InplaceEditor.Offer.Field field, int offerId = 0)
        {
            if ((price == 0 || amount == 0) && !String.IsNullOrEmpty(zeroPriceMsg))
            {
                return(zeroPriceMsg);
            }

            string strPriceRes;

            if (discount == 0)
            {
                strPriceRes = String.IsNullOrEmpty(priceFormat) ? Math.Round((price * amount) / currentCurrencyRate, 2).ToString() : String.Format("{0:" + priceFormat + "}", Math.Round((price * amount) / currentCurrencyRate, 2));
            }
            else
            {
                float dblTemp = (price * amount) / currentCurrencyRate;
                strPriceRes = String.IsNullOrEmpty(priceFormat) ? Math.Round(dblTemp - ((dblTemp / 100) * discount), 2).ToString() : String.Format("{0:" + priceFormat + "}", Math.Round(dblTemp - ((dblTemp / 100) * discount), 2));
            }

            string strCurrencyFormat = isCodeBefore
                ? "<div class=\"curr\">{1}</div> <div class=\"price-num\" {2}>{0}</div>"
                : "<div class=\"price-num\" {2}>{0}</div> <div class=\"curr\">{1}</div>";

            return(String.Format(strCurrencyFormat, strPriceRes, currentCurrencyCode, InplaceEditor.Offer.AttributePriceDetails(offerId, field)));
        }
Example #2
0
 public static string GetStringPriceInplace(float price, InplaceEditor.Offer.Field field, int offerId)
 {
     return(GetStringPriceInplace(price, CurrencyService.CurrentCurrency.Value, CurrencyService.CurrentCurrency.Symbol, 0, 1, CurrencyService.CurrentCurrency.IsCodeBefore, CurrencyService.CurrentCurrency.PriceFormat, null, field, offerId));
 }