private async void button2_Click(object sender, EventArgs e) { try { //textbox4 ile kullanıcılar klasörüne ulaşıyoruz FirebaseResponse response = await client.GetTaskAsync("Kullanicilar/" + textBox4.Text); kullanicilar degerler = response.ResultAs <kullanicilar>(); string sifre = degerler.sifre; //şifre karşılaştırması için şifreyi önce veritabanından çekiyoruz string girilensifre = textBox3.Text; //textbox3 teki textini girilensifre değişkenine kaydediyoruz if (textBox4.Text == "" || textBox4.Text == "TC NO") { MessageBox.Show("Lütfen TC Kimlik Numaranızı Giriniz", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (textBox4.TextLength < 11) { MessageBox.Show("TC Kimlik Numaranızı Eksiksiz Giriniz", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (textBox3.Text == "" || textBox3.Text == "Şifre") { MessageBox.Show("lütfen şifrenizi giriniz", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (girilensifre != sifre) { MessageBox.Show("Şifreniz yanlış", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { /*Olası bir durumda kullanıcı TCNO'sunu yanlış girmesi durumunda programın çökmesini önlemek için * try catch bloğunu kullanıyoruz*/ try { FirebaseResponse response1 = await client.GetTaskAsync("Kullanicilar/" + textBox4.Text); kullanicilar degerler1 = response.ResultAs <kullanicilar>(); kullanici = degerler1.adi + " " + degerler1.soyadi; //Hasta randevu alacağı form'da ismi gözükmesi için kullanici public stringini düzenliyoruz tcno = textBox4.Text; //textbox4'deki değeri tcno'ya atıyoruz RandevuProgramForm randevu = new RandevuProgramForm(); randevu.Show(); this.Hide(); } catch (Exception) { MessageBox.Show("Hata ile karşılaşıldı.Kullanıcı adınız veri tabanında bulunamadı.", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception) { MessageBox.Show("Hata ile karşılaşıldı.Kullanıcı adınız veri tabanında bulunamadı.", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private async void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox3.Text == "" || comboBox1.Text == "" || comboBox2.Text == "") { DialogResult hata = new DialogResult(); hata = MessageBox.Show("Kullanıcı Bilgilerini Eksiksiz Giriniz !", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (textBox4.Text != textBox5.Text) { DialogResult hata = new DialogResult(); hata = MessageBox.Show("Girdiğiniz şifreler uyuşmuyor", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //kullanicilar sınıfını ve içindeki elementleri tanımlıyoruz var kullanici = new kullanicilar { adi = textBox1.Text, soyadi = textBox2.Text, tcno = textBox3.Text, cinsiyet = comboBox2.SelectedItem.ToString(), sifre = textBox4.Text, sigorta = comboBox1.SelectedItem.ToString(), tarih = dateTimePicker1.Text }; //textbox3'teki text ile sisteme kayıt açıyoruz SetResponse response = await client.SetTaskAsync("Kullanicilar/" + textBox3.Text, kullanici); hastaverileri result = response.ResultAs <hastaverileri>(); DialogResult mesaj = new DialogResult(); mesaj = MessageBox.Show("Başarıyla kayıt oldunuz!", "SİSTEM", MessageBoxButtons.OK, MessageBoxIcon.Information); if (mesaj == DialogResult.OK) { Form1 prsl = new Form1(); this.Hide(); prsl.Show(); } } }