private void f01_GirisEkrani_Load(object sender, EventArgs e) { KayitDefteri.KullaniciOlustur(KayitDefteri.KlasorDemo, KayitDefteri.DemoSifre); DemoGiris_Btn.Visible = true; panel1.Visible = false;//Yeni hesap nesneleri DilSec.tr(); FormTextleriDegistir(sender, e); }
private void button4_Click(object sender, EventArgs e) { // Kullanıcı Kaydet Butonu byte HataYeri = 0; string GirilenKullaniciAdi = textBox1.Text; string GirilenSifre = textBox2.Text; string GirilenSifreTekrari = textBox3.Text; bool EksikVarMi = false; try { //[ girilen bilgilerin doğru ve eksiksiz bir şekilde girilmesi sağlandı. if (GirilenSifreTekrari == "") { textBox3.Focus(); EksikVarMi = true; } if (GirilenSifre == "") { textBox2.Focus(); EksikVarMi = true; } if (GirilenKullaniciAdi == "") { textBox1.Focus(); EksikVarMi = true; } if (EksikVarMi == true) { MessageBox.Show(DilSec.LutfenGirisKontrolEdin); return; } if (GirilenSifre != GirilenSifreTekrari) { MessageBox.Show(DilSec.SifreTekrariUyusmuyor); textBox2.Focus(); textBox2.SelectAll(); return; } // girilen bilgilerin doğru ve eksiksiz bir şekilde girilmesi sağlandı. ] // Kullanıcı adının daha önce başkası tarafından alınıp alınmadığını kontrol edelim. HataYeri = 1; RegistryKey Kullanici = KayitDefteri.KullaniciKontrol(GirilenKullaniciAdi); HataYeri = 2; RegistryKey Giris = Kullanici.OpenSubKey(KayitDefteri.KlasorGiris, true); HataYeri = 3; //Kod buraya kadar çalışarak geldiyse KullaniciAdi/Giris zaten mevcuttur dolayısıyla //burada kullanıcıya bir uyarı vermeliyiz. MessageBox.Show(DilSec.KullaniciAdiKullaniliyor); return; //HataYeri = 3; } catch (Exception Hata) { switch (HataYeri) { case 2: //Böyle bir kullanıcı yok burada oluşturulabilir if (KayitDefteri.KullaniciOlustur(GirilenKullaniciAdi, GirilenSifre) == true) { MessageBox.Show(DilSec.UyelikOlusturuldu); panel1.Visible = !panel1.Visible; } else { OrtakSinif.ProgramHatasi("f01_Giris Button4_click () Kullanıcı oluşturulamadı Exception kısmı", HataYeri, Hata); } break; default: OrtakSinif.ProgramHatasi("f01_Giris; button4_click; " + "Herhangi bir hata", HataYeri, Hata); break; } } }