private void cmbAlis_SelectedIndexChanged(object sender, EventArgs e) { decimal girilenBirim = Convert.ToDecimal(cmbAlis.SelectedValue); decimal donusenBirim = Convert.ToDecimal(cmbSatis.SelectedValue); Doviz girilenDoviz = cmbAlis.SelectedItem as Doviz; Doviz donusenDoviz = cmbSatis.SelectedItem as Doviz; if (girilenDoviz.Adet == 1) { try { nSatis.Value = (girilenBirim / donusenBirim) * nAlis.Value; } catch { } } else if (girilenDoviz.Adet > 1) { try { nSatis.Value = ((girilenBirim / girilenDoviz.Adet) / donusenBirim) * nAlis.Value; } catch { } } else if (donusenDoviz.Adet > 1) { try { nSatis.Value = ((girilenBirim * donusenDoviz.Adet) / donusenBirim) * nAlis.Value; } catch { } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Doviz secilenDoviz = (Doviz)listBox1.SelectedItem; labelAlis.Text = secilenDoviz.ForexBuying.ToString(); labelSatis.Text = secilenDoviz.ForexSelling.ToString(); labelDovizKodu.Text = secilenDoviz.CurrencyCode; }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Doviz secilenDoviz = (Doviz)listBox1.SelectedItem; label5.Text = secilenDoviz.ForexBuying.ToString(); label6.Text = secilenDoviz.ForexSelling.ToString(); label4.Text = secilenDoviz.CurrencyName; }
private void btnYukle_Click(object sender, EventArgs e) { lstDoviz.Items.Clear(); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("https://www.tcmb.gov.tr/kurlar/today.xml"); XmlElement rooteleman = xmldoc.DocumentElement; XmlNodeList liste = rooteleman.GetElementsByTagName("Currency"); List <Doviz> dliste = new List <Doviz>(); foreach (var item in liste) { Doviz d = new Doviz(); XmlElement currency = (XmlElement)item; string isim = currency.GetElementsByTagName("Isim").Item(0).InnerText; d.DovizAd = isim; string alisFiyat = currency.GetElementsByTagName("ForexBuying").Item(0).InnerText; string satisFiyat = currency.GetElementsByTagName("ForexSelling").Item(0).InnerText; string birim = currency.GetElementsByTagName("Unit").Item(0).InnerText; if (!string.IsNullOrEmpty(alisFiyat)) { d.AlisFiyat = Convert.ToDecimal(alisFiyat); } if (!string.IsNullOrEmpty(satisFiyat)) { d.SatisFiyat = Convert.ToDecimal(satisFiyat); } if (!string.IsNullOrEmpty(birim)) { d.Birim = Convert.ToInt32(birim); } lstDoviz.Items.Add(d); dliste.Add(d); } dataGridDoviz1.DataSource = dliste; int i = 0; foreach (var item in dliste) { try { dataGridDoviz2.Rows.Add(); dataGridDoviz2.Rows[i].Cells[0].Value = item.DovizAd; dataGridDoviz2.Rows[i].Cells[1].Value = item.SatisFiyat; i++; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { Doviz secilenDoviz = new Doviz(); secilenDoviz = (Doviz)lstDoviz.SelectedItem; lblAlis.Text = secilenDoviz.AlisFiyat.ToString(); lblSatis.Text = secilenDoviz.SatisFiyat.ToString(); lblBirim.Text = secilenDoviz.Birim.ToString(); }
private void timer1_Tick(object sender, EventArgs e) { Doviz seciliDoviz = Kurlar[sayac % Kurlar.Count]; lblAlis.Text = $"{seciliDoviz.AlisKuru:c4}"; lblSatis.Text = $"{seciliDoviz.SatisKuru:c4}"; lblKurAdi.Text = $"{seciliDoviz.KurAdi} {seciliDoviz.KurKodu}"; sayac++; }
private void btnKurlariCek_Click(object sender, EventArgs e) { Kurlar = new Doviz().Kurlar; Kurlar2 = new List <Doviz>(); Kurlar2.AddRange(Kurlar); timer1.Interval = 1000; if (Kurlar.Count > 0) { cmbAlis.DisplayMember = "KurKodu"; cmbAlis.ValueMember = "AlisKuru"; cmbAlis.DataSource = Kurlar; cmbSatis.DisplayMember = "KurKodu"; cmbSatis.ValueMember = "SatisKuru"; cmbSatis.DataSource = Kurlar2; } timer1.Start(); }
private void button1_Click(object sender, EventArgs e) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load("http://www.tcmb.gov.tr/kurlar/today.xml"); XmlElement rooteleman = xmldoc.DocumentElement; XmlNodeList liste = rooteleman.GetElementsByTagName("Currency"); List <Doviz> dlist = new List <Doviz>(); foreach (XmlElement item in liste) { Doviz d = new Doviz(); XmlElement currency = item; string isim = currency.GetElementsByTagName("Isim").Item(0).InnerText; d.CurrencyName = isim; string kod = currency.Attributes["CurrencyCode"].Value; d.CurrencyCode = kod; string alisFiyat = currency.GetElementsByTagName("ForexBuying").Item(0).InnerText; string satisFiyat = currency.GetElementsByTagName("ForexSelling").Item(0).InnerText; if (!(kod is null)) { d.CurrencyCode = kod; } if (!string.IsNullOrEmpty(alisFiyat)) { d.ForexBuying = Convert.ToDecimal(alisFiyat) / 10000; } if (!string.IsNullOrEmpty(satisFiyat)) { d.ForexSelling = Convert.ToDecimal(satisFiyat) / 10000; } listBox1.Items.Add(d); dlist.Add(d); } dataGridView1.DataSource = dlist; }