public bool HastaEkle(HastaBilgileri hasta) { UyeOlKontrol(hasta.Tc_No, hasta.Ad, hasta.Soyad, hasta.Email, hasta.Parola); int result = hastaBilgileriDAL.AddHastaBilgileri(hasta); return(result > 0); }
public HastaBilgileri GetByIDHastaBilgileri(int HastaID) { cmd = new SqlCommand("select TC_No,Ad,Soyad,Cinsiyet,Email,Parola,Telefon from HastaBilgileri where HastaID=@hastaId", cnn); cmd.Parameters.AddWithValue("@hastaId", HastaID); HastaBilgileri hb = null; try { cnn.Open(); SqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); reader.Read(); hb = new HastaBilgileri() { Tc_No = reader["TC_No"].ToString(), Ad = reader["Ad"].ToString(), Soyad = reader["Soyad"].ToString(), Cinsiyet = bool.Parse(reader["Cinsiyet"].ToString()), Email = reader["Email"].ToString(), Parola = reader["Parola"].ToString(), Telefon = reader["Telefon"].ToString() }; reader.Close(); return(hb); } catch (Exception) { return(hb); } }
private void button2_Click(object sender, EventArgs e) { HastaBilgileri hastaBilgiForm = new HastaBilgileri(); hastaBilgiForm.Show(); this.Hide(); }
//Hasta eposta ve şifreye göre hasta ID gelecek >>>>>>>>>>>> YENİ EKLENDİ public HastaBilgileri HastaIDGetir(string email, string sifre) { cmd = new SqlCommand("select HastaID from HastaBilgileri where email=@email and parola=@parola", cnn); cmd.Parameters.AddWithValue("@email", email); cmd.Parameters.AddWithValue("@parola", sifre); HastaBilgileri hb = null; try { cnn.Open(); SqlDataReader reader = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); hb = new HastaBilgileri(); reader.Read(); hb = new HastaBilgileri() { HastaID = (int)(reader["HastaID"]), }; reader.Close(); cnn.Close(); return(hb); } catch (Exception) { return(hb); } }
public int AddHastaBilgileri(HastaBilgileri hasta) { cmd = new SqlCommand("insert into HastaBilgileri(Tc_No,Ad,Soyad,Cinsiyet,Email,Parola,Telefon) values (@TcNo,@ad,@soyad,@cinsiyet,@mail,@parola,@telefon)", cnn); cmd.Parameters.AddWithValue("@TcNo", hasta.Tc_No); cmd.Parameters.AddWithValue("@ad", hasta.Ad); cmd.Parameters.AddWithValue("@soyad", hasta.Soyad); cmd.Parameters.AddWithValue("@cinsiyet", hasta.Cinsiyet); cmd.Parameters.AddWithValue("@mail", hasta.Email); cmd.Parameters.AddWithValue("@parola", hasta.Parola); cmd.Parameters.AddWithValue("@telefon", hasta.Telefon); return(Execute()); }
public int AddHastaBilgileri(HastaBilgileri hasta) { cmd = new SqlCommand(@"Insert Into HastaBilgileri (Tc_No,Ad,Soyad,Cinsiyet,EMail,Sifre,Telefon,RolID) values (@Tc_No,@Ad,@Soyad,@Cinsiyet,@EMail,@Sifre,@Telefon,@RolID)", cnn); cmd.Parameters.AddWithValue("@Tc_No", hasta.Tc_No); cmd.Parameters.AddWithValue("@Ad", hasta.Ad); cmd.Parameters.AddWithValue("@Soyad", hasta.Soyad); //cmd.Parameters.AddWithValue("@Cinsiyet", hasta.Cinsiyet); cmd.Parameters.AddWithValue("@EMail", hasta.Email); cmd.Parameters.AddWithValue("@Sifre", hasta.Parola); cmd.Parameters.AddWithValue("@Telefon", hasta.Telefon); cmd.Parameters.AddWithValue("@RolID", 1); return(Execute()); }
//Giriş yap butonu; private void BtnSignUp_Click(object sender, EventArgs e) { try { hasta = new HastaBilgileri(); uye = new UyeGiris(); uye.Email = txtMail.Text; uye.Parola = txtPswrd.Text; uye.RolID = 1; try { hasta.Tc_No = txtTC.Text; } catch (Exception ex) { MessageBox.Show(ex.Message); } hasta.Ad = txtName.Text; hasta.Soyad = txtSurname.Text; hasta.Email = txtMail.Text; hasta.Parola = txtPswrd.Text; hasta.Telefon = txtPhone.Text; if (rbMale.Checked) { hasta.Cinsiyet = false; } else { hasta.Cinsiyet = true; } uyeGirisBLL.Add(uye); hastaBilgileriBLL.HastaEkle(hasta); DialogResult result = MessageBox.Show("Kayıt başarılı, çıkmak için OK'a basın.", "Kayıt Oluşturuldu", MessageBoxButtons.OK); if (result == DialogResult.OK) { this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnLogin_Click(object sender, EventArgs e) { uyeGiris = new UyeGiris(); uyeGiris.Email = txtUsername.Text; uyeGiris.Parola = txtPassword.Text; uyeGiris.RolID = comboBox1.SelectedIndex + 1; try { hastaBilgileriBLL.GirisKontrol(uyeGiris.Email, uyeGiris.Parola, uyeGiris.RolID); //LoginControl if (uyeGiris.RolID == 1) // Hasta ise { //Burada email ve sifreye göre hasta ID'sini alacağız bu yüzden hastabilgilerinden instance alıyoruz. hastaBilgileri = new HastaBilgileri(); //Globalde int HastaId diye değişken tanımlamıştık BLL'den çıkan sonucu ona atıyoruz. hastaBilgileri = hastaBilgileriBLL.HastaIdGetir(uyeGiris.Email, uyeGiris.Parola); HastaID = hastaBilgileri.HastaID; //Hasta eposta ve parola doğruysa Randevu Alma formuna geçiş yapılıyor, bu işlem için öncelikle instance alıyoruz. RandevuAlma randevu = new RandevuAlma(); //RandevuAlmada public bir metod tanımladık(HastaIDGetir) hastaID'yi alıp formda kullanacağız. randevu.HastaIDGetir(HastaID); randevu.ShowDialog(); } else if (uyeGiris.RolID == 2) //Doktor ise { //Deneme MessageBox.Show("Doktor"); DoktorPaneli frmDoktorPaneli = new DoktorPaneli(); frmDoktorPaneli.ShowDialog(); } else if (uyeGiris.RolID == 3)//Eczane ise { //Deneme MessageBox.Show("Ezcane"); EczanePaneli frmEczanePaneli = new EczanePaneli(); frmEczanePaneli.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }