private void btnHesapAc_Click(object sender, EventArgs e) { int k = 0; foreach (Musteri m in Banka.Musteriler) { if (txtMusteriNoIste.Text == m.MusteriNo.ToString()) { k += 1; Hesap hesap = new Hesap(); Banka.ToplamHesapSayisi += 1; hesap.HesapNo += Banka.ToplamHesapSayisi + 1000; m.hesaplar.Add(hesap); MessageBox.Show("Hesap Açıldı. Bu Müşterinin Toplamda " + m.hesaplar.Count.ToString() + " Hesabı var.\n" + "Yeni Hesabın Numarası: " + hesap.HesapNo); if (Convert.ToInt32(nmrBaslangic.Text) != 0) { hesap.ParaYatir(Convert.ToInt32(nmrBaslangic.Text)); Islem islem = new Islem(); islem.ParaYat(hesap.HesapNo, Convert.ToInt32(nmrBaslangic.Text)); Banka.islemler.Add(islem); } } } if (k == 0) { MessageBox.Show("Müşteri Bulunamadı"); } }
public virtual void Havale(int verenHNo, int alanHNo, int para) { int a = 1; foreach (Musteri m in Banka.Musteriler) { foreach (Hesap h in m.hesaplar) { if (verenHNo == h.HesapNo) { h.ParaCek(para); a = h.sy; if (h.sy == 0) { break; } foreach (Musteri mm in Banka.Musteriler) { foreach (Hesap hh in mm.hesaplar) { if (alanHNo == hh.HesapNo) { if (a == 0) { break; } Islem islem = new Islem(); islem.ParaHavaleVer(hh.HesapNo, h.HesapNo, para); Banka.islemler.Add(islem); Islem islem2 = new Islem(); islem2.ParaHavaleAl(hh.HesapNo, h.HesapNo, para); Banka.islemler.Add(islem2); hh.ParaYatir(para); a = 0; break; } } if (a == 0) { break; } } } if (a == 0) { break; } } if (a == 0) { break; } } }
private void btnYatir_Click(object sender, EventArgs e) { int k = 0; foreach (Musteri m in Banka.Musteriler) { foreach (Hesap h in m.hesaplar) { if (textBoxHesapNo.Text.ToString() == h.HesapNo.ToString()) { Islem islem = new Islem(); islem.ParaYat(h.HesapNo, Convert.ToInt32(nmrTutar.Text)); Banka.islemler.Add(islem); h.ParaYatir(Convert.ToInt32(nmrTutar.Text)); k += 1; } } } if (k == 0) { MessageBox.Show("Hesap Bulunamadı"); } }
private void button1_Click(object sender, EventArgs e) { if (Convert.ToInt32(nmrTutar.Text) > 750) { MessageBox.Show("Günlük Limit 750 TLdir.Bunun üzerinde para çekilemez."); } else { int k = 0; int p = 1; int a = 1; foreach (Musteri m in Banka.Musteriler) { foreach (Hesap h in m.hesaplar) { if (textBoxHesapNo.Text.ToString() == h.HesapNo.ToString()) { k = 1; if (Convert.ToInt32(nmrTutar.Text) <= h.Bakiye) { h.ParaCek(Convert.ToInt32(nmrTutar.Text)); Islem islem = new Islem(); islem.ParaCek(h.HesapNo, Convert.ToInt32(nmrTutar.Text)); Banka.islemler.Add(islem); } else { p = (Convert.ToInt32(nmrTutar.Text) - h.Bakiye); Islem islem2 = new Islem(); islem2.ParaCek(h.HesapNo, h.Bakiye); Banka.islemler.Add(islem2); h.ParaCek(h.Bakiye); foreach (Hesap n in m.hesaplar) { if (p > n.Bakiye && n.Bakiye != 0) { p -= n.Bakiye; n.ParaCek(n.Bakiye); Islem islem = new Islem(); islem.ParaCek(n.HesapNo, p); Banka.islemler.Add(islem); a = 0; } else if (p != 0 && n.Bakiye != 0) { Islem islem = new Islem(); islem.ParaCek(n.HesapNo, p); Banka.islemler.Add(islem); n.ParaCek(p); a = 1; break; } else if (n.Bakiye == 0) { a = 0; } } break; } } } } if (a == 0) { MessageBox.Show("Yeterli Seviyede Bakiyeniz" + " Bulunmadığı İçin Kalan Tutar Çekilemiyor"); } if (k == 0) { MessageBox.Show("Hesap Bulunamadı"); } } }