public cLogin KAdSifreKontrol(string KAdi, string Sifre) { cLogin log = new cLogin(); SqlConnection conn = new SqlConnection(gnl.connStr); //Personeller - Yetki - Gorevler - SqlCommand comm = new SqlCommand("select PersonelID,PersonelAdi,PersonelSoyadi,YetkiTipiID,YetkiliAd,Gorevler.GorevID,GorevAd from Personeller inner join Yetki on Personeller.YetkiTipiID = Yetki.YetkiliID inner join Gorevler on Gorevler.GorevID = Personeller.GorevID where personeller.Silindi = 0 and KullaniciAdi=@KullaniciAdi and KullaniciSifresi=@KullaniciSifresi", conn); comm.Parameters.Add("@KullaniciAdi", SqlDbType.VarChar).Value = KAdi; comm.Parameters.Add("@KullaniciSifresi", SqlDbType.VarChar).Value = Sifre; if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlDataReader dr; try { dr = comm.ExecuteReader(); if (dr.Read()) { log._adsoyad = dr["PersonelAdi"] + " " + dr["PersonelSoyadi"]; log._personelID = Convert.ToInt32(dr["PersonelID"]); log._yetkiTipiId = Convert.ToInt32(dr["YetkiTipiID"]); log._yetkiliAd = dr["YetkiliAd"].ToString(); log._gorevID = Convert.ToInt32(dr["GorevID"]); log._gorevAd = dr["GorevAd"].ToString(); } } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return(log); }
public cLogin KAdSifreKontrol(string KAdi, string Sifre) { cLogin log = new cLogin(); SqlConnection conn = new SqlConnection(gnl.connStr); //Personeller - Yetki - Gorevler - SqlCommand comm = new SqlCommand("select PersonelID,PersonelAdi,PersonelSoyadi,YetkiTipiID,YetkiliAd,Gorevler.GorevID,GorevAd from Personeller inner join Yetki on Personeller.YetkiTipiID = Yetki.YetkiliID inner join Gorevler on Gorevler.GorevID = Personeller.GorevID where personeller.Silindi = 0 and KullaniciAdi=@KullaniciAdi and KullaniciSifresi=@KullaniciSifresi", conn); comm.Parameters.Add("@KullaniciAdi", SqlDbType.VarChar).Value = KAdi; comm.Parameters.Add("@KullaniciSifresi", SqlDbType.VarChar).Value = Sifre; if (conn.State == ConnectionState.Closed) conn.Open(); SqlDataReader dr; try { dr = comm.ExecuteReader(); if (dr.Read()) { log._adsoyad = dr["PersonelAdi"] + " " + dr["PersonelSoyadi"]; log._personelID = Convert.ToInt32(dr["PersonelID"]); log._yetkiTipiId = Convert.ToInt32(dr["YetkiTipiID"]); log._yetkiliAd = dr["YetkiliAd"].ToString(); log._gorevID = Convert.ToInt32(dr["GorevID"]); log._gorevAd = dr["GorevAd"].ToString(); } } catch (SqlException ex) { string hata = ex.Message; } finally { conn.Close(); } return log; }