public int ApartmanId(int SiteId, string ApartmanAdi) { int aprtid = 0, geciciid; string geciciisim; baglanti = new dbConnection(); string sorgu = "SELECT * FROM tblApartman"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { geciciid = Convert.ToInt32(item["SITEID"]); geciciisim = item["ADI"].ToString().Trim(); if (geciciid == SiteId && geciciisim == ApartmanAdi) { aprtid = Convert.ToInt32(item["ID"]); } } } return(aprtid); }
public int KatSayisi(int ApartmanId) { string sorgu = "SELECT * FROM tblApartman"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (Convert.ToInt32(item["ID"]) == ApartmanId) { return(Convert.ToInt32(item["KATSAYISI"])); } } } return(0); }
public int DaireId(int ApartmanId, int Kat, int DaireNo) { int gid, gkat, gdaireno; string sorgu = "SELECT * FROM tblDaire"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { gid = Convert.ToInt32(item["APARTMANID"]); gkat = Convert.ToInt32(item["KATNUMARASI"]); gdaireno = Convert.ToInt32(item["DAIRENO"]); if (gid == ApartmanId && gkat == Kat && gdaireno == DaireNo) { return(Convert.ToInt32(item["ID"])); } } } return(0); }
public int SiteId(string isim) { baglanti = new dbConnection(); string sorgu = "SELECT * FROM tblSite"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (item["ADI"].ToString().Trim() == isim.Trim()) { return(Convert.ToInt32(item["ID"])); } } } return(0); }
public int MusteriId(string Telefon) { baglanti = new dbConnection(); string sorgu = "SELECT * FROM tblMusteri"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (Convert.ToString(item["TELEFON"]) == Telefon) { return(Convert.ToInt32(item["ID"])); } } } return(0); }
public List <site> SiteleriGetir() { baglanti = new dbConnection(); site Site = new site(); List <site> SiteListesi = new List <site>(); string sorgu = "SELECT * FROM tblSite"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { Site = new site(); Site.id = Convert.ToInt32(item["ID"]); Site.siteAdi = item["ADI"].ToString(); SiteListesi.Add(Site); } } return(SiteListesi); }
public bool SistemdeVarmi(string KullaniciAdi, string Sifre) { baglanti = new dbConnection(); string GKadi, GSifre; string sorgu = "SELECT * FROM tblKullanici"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { GKadi = item["KULLANICIADI"].ToString().Trim(); GSifre = item["SIFRE"].ToString().Trim(); if (GKadi == KullaniciAdi && GSifre == Sifre) { return(true); } } } return(false); }
public List <apartman> ApartmanlariGetir(int siteid = 0) { baglanti = new dbConnection(); apartman apart = new apartman(); List <apartman> ApartmanListesi = new List <apartman>(); string sorgu = "SELECT * FROM tblApartman"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (siteid == Convert.ToInt32(item["SITEID"]) && siteid != 0) { apart = new apartman(); apart.id = Convert.ToInt32(item["ID"]); apart.siteid = Convert.ToInt32(item["SITEID"]); apart.katdakidaire = Convert.ToInt32(item["KATDAIRE"]); apart.aciklama = item["ACIKLAMA"].ToString(); apart.ozellikler = item["OZELLIKLER"].ToString(); apart.adi = item["ADI"].ToString().Trim(); apart.katsayisi = Convert.ToInt32(item["KATSAYISI"]); ApartmanListesi.Add(apart); } else if (siteid == 0) { apart = new apartman(); apart.id = Convert.ToInt32(item["ID"]); apart.siteid = Convert.ToInt32(item["SITEID"]); apart.katdakidaire = Convert.ToInt32(item["KATDAIRE"]); apart.aciklama = item["ACIKLAMA"].ToString(); apart.ozellikler = item["OZELLIKLER"].ToString(); apart.adi = item["ADI"].ToString().Trim(); apart.katsayisi = Convert.ToInt32(item["KATSAYISI"]); ApartmanListesi.Add(apart); } } } return(ApartmanListesi); }
private void btnSorgula_Click(object sender, EventArgs e) { string numara = txtTelefon.Text; baglanti = new dbConnection(); string[] isimsoyisim; string sorgu = "SELECT * FROM tblMusteri"; DataTable dt = baglanti.executeSelectQuery(sorgu, null); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { if (numara == item["TELEFON"].ToString()) { isimsoyisim = item["ADISOYADI"].ToString().Split(' '); txtAd.Text = isimsoyisim[0].ToString(); txtSoyad.Text = isimsoyisim[1].ToString(); txtAdres.Text = item["ADRES"].ToString(); } } } }