private void button1_Click_1(object sender, EventArgs e) { string email = tbEmail.Text; string sifre = tbSifre.Text; if (email.Trim() != "" || sifre.Trim() != "") { yonetici y = new yonetici(); SaglikCalisani s = new SaglikCalisani(); var yonetici = y.Login(email, sifre); var saglikCalisani = s.Login(email, sifre); if (yonetici != null) { Bilgi_İslem_Ana_Sayfa form = new Bilgi_İslem_Ana_Sayfa(yonetici); form.ShowDialog(); this.Hide(); } if (saglikCalisani != null) { Personel_Ana_Sayfa form = new Personel_Ana_Sayfa(saglikCalisani); form.ShowDialog(); this.Hide(); } else { label4.ForeColor = Color.White; label4.Text = "Giriş Başarısız! Bilgileriniz hatalıdır!!!"; } } else { label4.ForeColor = Color.White; label4.Text = "Giriş Başarısız! Lütfen email ve sifrenizi giriniz."; } }
private void button_profil_Click(object sender, EventArgs e) { lblBaslik.Text = "Profil Bilgileri"; try { BackGroundIslemleri(((Button)sender).Name); } catch (Exception ex) { MessageBox.Show(ex.Message); } try { yonetici yo = new yonetici(); dgvData.DataSource = yo.Goster(Person.Email); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override Person Login(string email, string sifre) { SqlConnection connection = null; try { string conString = "Server = DESKTOP-L4DKVAR; Database = smscov; Trusted_Connection = True;"; connection = new SqlConnection(conString); connection.Open(); if (connection.State == System.Data.ConnectionState.Open) { string query = $"select * from yonetici where email = '{email}' AND sifre = '{sifre}'"; SqlCommand command = new SqlCommand(query, connection); SqlDataAdapter adapter = new SqlDataAdapter(command); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count > 0) { yonetici y = new yonetici(); y.yoneticiID = int.Parse(dt.Rows[0]["yoneticiID"].ToString()); y.Ad = dt.Rows[0]["ad"].ToString(); y.Soyad = dt.Rows[0]["soyad"].ToString(); y.Email = dt.Rows[0]["email"].ToString(); y.Sifre = dt.Rows[0]["sifre"].ToString(); y.Cinsiyet = dt.Rows[0]["cinsiyet"].ToString(); y.TC = dt.Rows[0]["tc"].ToString(); return(y); } } return(null); } catch (Exception ex) { throw new Exception("Giriş başarısız!"); } }