public int[] ApartmanIdleri(int SiteId) { baglanti = new dbConnection(); int sayac = 0; string sorgu = "select * from tblApartman"; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { if (Convert.ToInt32(okuyucu["SITEID"]) == SiteId) { sayac++; } } int[] idler = new int[sayac]; sayac = 0; sorgu = "select * from tblApartman"; komut = new SqlCommand(sorgu, baglanti.Baglanti()); okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { if (Convert.ToInt32(okuyucu["SITEID"]) == SiteId) { idler[sayac] = Convert.ToInt32(okuyucu["ID"]); sayac++; } } baglanti.Baglanti().Close(); return(idler); }
private void silToolStripMenuItem_Click(object sender, EventArgs e) { dbConnection baglanti = new dbConnection(); if (Tabloadi == "Daire") { string sorgu = "delete from tblDaire where ID='" + Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")) + "'"; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); baglanti.Baglanti().Close(); MessageBox.Show("Silindi"); } else if (Tabloadi == "Site") { Daire daire = new Daire(); apartman apart = new apartman(); int siteid = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); string sorgu; SqlCommand komut; int[] apartmanlar = apart.ApartmanIdleri(siteid); for (int i = 0; i < apartmanlar.Length; i++) { sorgu = "delete from tblDaire where APARTMANID='" + apartmanlar[i] + "'";//dairedende apartman ıdyi silme komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); } sorgu = "delete from tblApartman where SITEID='" + siteid + "'";//o site id deki apartmanları silme komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); sorgu = "delete from tblSite where ID='" + siteid + "'"; komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); MessageBox.Show("Silindi"); baglanti.Baglanti().Close(); } else if (Tabloadi == "Apartman") { int apartmanid = Convert.ToInt32(gridView1.GetFocusedRowCellValue("ID")); string sorgu; SqlCommand komut; sorgu = "delete from tblDaire where APARTMANID='" + apartmanid + "'"; komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); sorgu = "delete from tblApartman where ID='" + apartmanid + "'"; komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); MessageBox.Show("Silindi.."); baglanti.Baglanti().Close(); } }
public DataTable DaireTablosu(int Secenek = 0) { dbConnection Baglanti = new dbConnection(); string sorgu; if (Secenek == 1) { sorgu = "select * from tblDaire where TIPI='" + "Kiralık" + "'"; } else if (Secenek == 2) { sorgu = "select * from tblDaire where TIPI='" + "Satılık" + "'"; } else if (Secenek == 3) { sorgu = "select * from tblDaire where TIPI='" + "Kiralık" + "' and MUSTERINO >'" + 0 + "'"; } else if (Secenek == 4) { sorgu = "select * from tblDaire where TIPI='" + "Satılık" + "' and MUSTERINO >'" + 0 + "'"; } else { sorgu = "select * from tblDaire"; } SqlDataAdapter da = new SqlDataAdapter(sorgu, Baglanti.Baglanti()); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public bool MusteriIdGuncelle(int DaireId, int MusteriId) { baglanti = new dbConnection(); string sorgu = "UPDATE tblDaire SET MUSTERINO='" + MusteriId + "' WHERE ID='" + DaireId + "'"; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); komut.ExecuteNonQuery(); return(true); }
public DataTable KasaIslemTablosu() { Baglanti = new dbConnection(); string sorgu = "select * from tblKasaislem"; SqlDataAdapter da = new SqlDataAdapter(sorgu, Baglanti.Baglanti()); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public DateTime SonIslemTarihi() { dbConnection baglanti = new dbConnection(); DateTime tarih = DateTime.Now; string sorgu = "select ISLEMTARIHI from tblKasa "; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { tarih = Convert.ToDateTime(okuyucu["ISLEMTARIHI"]); } return(tarih); }
public int GuncelPara() { dbConnection Baglanti = new dbConnection(); int para = 0; string Sorgu = "select PARA from tblKasa"; SqlCommand komut = new SqlCommand(Sorgu, Baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { para = Convert.ToInt32(okuyucu["PARA"]); } return(para); }
public bool ParaIslem(decimal Para, DateTime Tarih, bool Durum)//durum true ise ekler false isa çıkarır { Kasa kasa = new Kasa(); Baglanti = new dbConnection(); int guncel = Durum == true?kasa.GuncelPara() + Convert.ToInt32(Para) : kasa.GuncelPara() - Convert.ToInt32(Para); string Sorgu = "update tblKasa set PARA='" + guncel + "',ISLEMTARIHI=@ISLEMTARIHI where ID='" + 2 + "'"; SqlCommand komut = new SqlCommand(Sorgu, Baglanti.Baglanti()); komut.Parameters.AddWithValue("@ISLEMTARIHI", Tarih); komut.ExecuteNonQuery(); return(true); }
public int KiralananDaire() { int kiralanan = 0; dbConnection baglanti = new dbConnection(); string sorgu = "select * from tblDaire "; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { if (okuyucu["TIPI"].ToString().Trim() == "Kiralık" && okuyucu["MUSTERINO"].ToString().Trim() != "0") { kiralanan++; } } return(kiralanan); }
public DataTable SiteTablosu(string Adi = "") { dbConnection baglanti = new dbConnection(); string sorgu; if (Adi != "") { sorgu = "select * from tblSite where ADI='" + Adi + "'"; } else { sorgu = "select * from tblSite"; } SqlDataAdapter da = new SqlDataAdapter(sorgu, baglanti.Baglanti()); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public DataTable ApartmanTablosu(string Adi = "") { apartman apart = new apartman(); dbConnection Baglanti = new dbConnection(); SqlConnection baglanti = Baglanti.Baglanti(); string sorgu; if (Adi != "") { sorgu = "select * from tblApartman where ADI='" + Adi.ToString() + "'"; } else { sorgu = "select * from tblApartman"; } SqlDataAdapter da = new SqlDataAdapter(sorgu, baglanti); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public List <Daire> DaireListesi(int DaireID = 0) { Daire daire; List <Daire> DaireListesi = new List <Daire>(); baglanti = new dbConnection(); string sorgu = "select * from tblDaire"; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { if (DaireID == 0) { daire = new Daire(); daire.id = Convert.ToInt32(okuyucu["ID"]); daire.apartmanid = Convert.ToInt32(okuyucu["APARTMANID"]); daire.alan = Convert.ToInt32(okuyucu["ALAN"]); daire.katNumarasi = Convert.ToInt32(okuyucu["KATNUMARASI"]); daire.tipi = okuyucu["TIPI"].ToString(); daire.musteriNo = Convert.ToInt32(okuyucu["MUSTERINO"]); daire.daireNo = Convert.ToInt32(okuyucu["DAIRENO"]); DaireListesi.Add(daire); } else if (Convert.ToInt32(okuyucu["ID"]) == DaireID) { daire = new Daire(); daire.id = Convert.ToInt32(okuyucu["ID"]); daire.apartmanid = Convert.ToInt32(okuyucu["APARTMANID"]); daire.alan = Convert.ToInt32(okuyucu["ALAN"]); daire.katNumarasi = Convert.ToInt32(okuyucu["KATNUMARASI"]); daire.tipi = okuyucu["TIPI"].ToString(); daire.musteriNo = Convert.ToInt32(okuyucu["MUSTERINO"]); daire.daireNo = Convert.ToInt32(okuyucu["DAIRENO"]); DaireListesi.Add(daire); } } return(DaireListesi); }
public List <musteri> Musterilistesi() { musteri must = new musteri(); List <musteri> Musteri = new List <musteri>(); baglanti = new dbConnection(); string sorgu = "select * from tblMusteri"; SqlCommand komut = new SqlCommand(sorgu, baglanti.Baglanti()); SqlDataReader okuyucu = komut.ExecuteReader(); while (okuyucu.Read()) { must.adisoyadi = okuyucu["ADISOYADI"].ToString(); must.telefon = okuyucu["TELEFON"].ToString(); must.id = Convert.ToInt32(okuyucu["ID"]); must.adres = okuyucu["ADRES"].ToString(); must.tarih = Convert.ToDateTime(okuyucu["TARIH"]); must.daireid = Convert.ToInt32(okuyucu["DAIREID"]); Musteri.Add(must); } return(Musteri); }