/* */ public string FormatPrice(object typeAd, object fPrice, object sPrice) { if (typeAd != null) { if (typeAd.ToString() == "4") { //return string if it's not null; otherwise return flt if it's not null if (sPrice != DBNull.Value) { float sfPrice = 0; bool bVal = float.TryParse(sPrice.ToString(), out sfPrice); if (bVal) { return(Global.FormatPrice(fPrice)); } else { return(sPrice.ToString()); } } else { if (fPrice != DBNull.Value) { return(Global.FormatPrice(fPrice)); } } return("unknown"); } else { return(Global.FormatPrice(fPrice)); } } else { return("unknown"); } }