public Eczacilar GetEczaciByID(int EczaciID) { Eczacilar eczaci = null; try { cmd = new SqlCommand("SELECT * FROM Eczacilar where EczaciID=@EczaciID", cnn); cmd.Parameters.AddWithValue("@EczaciID", EczaciID); cnn.Open(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); eczaci = new Eczacilar() { EczaciID = Convert.ToInt32(dr["EczaciID"]), EczaciAdi = dr["EczaciAdi"].ToString(), EczaciSoyadi = dr["EczaciSoyadi"].ToString(), KullaniciAdi = dr["KullaniciAdi"].ToString(), Sifre = dr["Sifre"].ToString(), Cinsiyet = Convert.ToChar(dr["Cinsiyeti"]), RolID = Convert.ToInt32(dr["RolID"]) }; return(eczaci); } catch (Exception) { return(eczaci); } finally { cnn.Close(); } }
public mhrsEczaci(Eczacilar eczaci) { InitializeComponent(); _eczaci = eczaci; }
private void btnGiris_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtKullaniciAdi.Text)) { MessageBox.Show("Lütfen kullanıcı adınızı giriniz!"); txtKullaniciAdi.Focus(); return; } else if (string.IsNullOrWhiteSpace(txtSifre.Text)) { MessageBox.Show("Lütfen şifrenizi giriniz!"); txtSifre.Focus(); return; } switch (cmbRol.SelectedIndex) { case 0: _hastalar = new Hastalar(); List <Hastalar> hastalar = _hastalarBLL.List(); foreach (var item in hastalar) { if (item.KullaniciAdi == txtKullaniciAdi.Text) { if (item.Sifre == txtSifre.Text) { _hastalar = item; mhrsHasta mhrsHasta = new mhrsHasta(_hastalar); mhrsHasta.Show(); this.Hide(); return; } else { MessageBox.Show("Şifre hatalı!"); txtSifre.Focus(); return; } } } if (_hastalar.HastaID == 0) { MessageBox.Show("E-Posta Hatalı !"); txtKullaniciAdi.Focus(); } break; case 1: _doktorlar = new Doktorlar(); List <Doktorlar> doktorlar = _doktorlarBLL.List(); foreach (var item in doktorlar) { if (item.KullaniciAdi == txtKullaniciAdi.Text) { if (item.Sifre == txtSifre.Text) { _doktorlar = item; mhrsDoktor mhrsDoktor = new mhrsDoktor(_doktorlar); mhrsDoktor.Show(); this.Hide(); return; } else { MessageBox.Show("Şifre hatalı!"); txtSifre.Focus(); return; } } } if (_doktorlar.DoktorID == 0) { MessageBox.Show("Böyle bir kullanıcı bulunamadı!"); txtKullaniciAdi.Focus(); } break; case 2: _eczacilar = new Eczacilar(); List <Eczacilar> eczacilar = _eczacilarBLL.List(); foreach (var item in eczacilar) { if (item.KullaniciAdi == txtKullaniciAdi.Text) { if (item.Sifre == txtSifre.Text) { _eczacilar = item; mhrsEczaci mhrsEczaci = new mhrsEczaci(_eczacilar); mhrsEczaci.Show(); this.Hide(); return; } else { MessageBox.Show("Şifre hatalı!"); txtSifre.Focus(); return; } } } if (_eczacilar.EczaciID == 0) { MessageBox.Show("Böyle bir kullanıcı bulunamadı!"); txtKullaniciAdi.Focus(); } break; default: break; } }