private void cbMoedas_SelectedIndexChanged_1(object sender, EventArgs e) { string codigoMoeda = ""; // Pega posição do caracter ( -) que separa o código da descrição da moeda int posTraco = cbMoedas.Text.IndexOf(" –"); // Caso a posição for maior que -1, atribui o valor a variável codigoMoeda if (posTraco > -1) { codigoMoeda = cbMoedas.Text.Substring(0, posTraco); } try { // Chama o webservice para retornar o valor FachadaWSSGSClient ws = new FachadaWSSGSClient(); // Através do código da moeda, atribui a variável valorCotacao o resultado da busca var valorCotacao = ws.getUltimosValoresSerieVO(Convert.ToInt32(codigoMoeda), 1).valores[0].svalor; // Mostrar no txtValor o resultado txtValorPago.Text = valorCotacao; } catch (Exception) { // Caso aconteça alguma excessão, mostra valor zerado txtValorPago.Text = " 0.00"; } }
//Evento que carrega o formulario private void Form1_Load(object sender, EventArgs e) { FachadaWSSGSClient ws = new FachadaWSSGSClient(); var valorCotacao = ws.getUltimosValoresSerieVO(1, 1).valores[0].svalor; double dividirDolar = Convert.ToDouble(valorCotacao) / 10000; textBoxCotacaoDolar.Text = dividirDolar.ToString("N2"); }
public CotacaoBcb() { if (InternetAvailability.IsInternetAvailable()) { _service = new FachadaWSSGSClient(new BasicHttpBinding(BasicHttpSecurityMode.Transport), new EndpointAddress(UrlService)); _codigoService = new CodigosService(); } else { throw new InternetNotAvailableException(); } }
public static void dadosOnline() { FachadaWSSGSClient ws = new FachadaWSSGSClient(); //Assim que o programa abre, pega os valores online valorDolar = ws.getUltimosValoresSerieVO(10813, 1).valores[0].svalor; valorEuro = ws.getUltimosValoresSerieVO(21620, 1).valores[0].svalor; valorLibra = ws.getUltimosValoresSerieVO(21624, 1).valores[0].svalor; string caption = "Alerta!"; string message = "Thread iniciada com sucesso!" + "\n" + "\n" + " Valor Dólar - " + "R$ " + string.Format("{0:0.00} ", valorDolar) + "\n" + " Valor Euro - " + "R$ " + string.Format("{0:0.00} ", valorEuro) + "\n" + " Valor Libra - " + "R$ " + string.Format("{0:0.00} ", valorLibra); MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); }
private Dictionary <DateTime, decimal> GetVariationIndexFromBCSavings() { var wssgs = new FachadaWSSGSClient(); var codes = new long[1]; codes[0] = 195; var res = wssgs.getValoresSeriesVO(codes, "01/01/2014", DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year); var values = new Dictionary <DateTime, decimal>(); if (res.Length > 0) { foreach (var item in res[0].valores) { var d = new DateTime(item.ano, item.mes, item.dia); var value = Convert.ToDecimal(item.svalor, CultureInfo.InvariantCulture); values.Add(d, value); } } return(values); }
static void Main(string[] args) { var wssgs = new FachadaWSSGSClient(); var codes = new long[1]; codes[0] = 195; var res = wssgs.getValoresSeriesVO(codes, "01/01/2014", "14/04/2014"); var values = new Dictionary <DateTime, decimal>(); if (res.Length > 0) { foreach (var item in res[0].valores) { var date = new DateTime(item.ano, item.mes, item.dia); var value = Convert.ToDecimal(item.svalor, CultureInfo.InvariantCulture); values.Add(date, value); } } Console.WriteLine(); }
public double GetTaxaCambioDolar() { var wsSeries = new FachadaWSSGSClient().getUltimoValorVO(10813); return(Double.Parse(wsSeries.ultimoValor.svalor, new CultureInfo("en-US"))); }
public WSBacenCambio() { this.ServiceClient = new WSBacen.FachadaWSSGSClient(); }