public void sorguyerleştir() { adp = new OleDbDataAdapter(GENELSORGU(sehir, yildiz, fiyat, merkez, wifi, havuz, kahvalti, otelsirala), bag); DataTable tablo = new DataTable(); adp.Fill(tablo); flowLayoutPanel1.Controls.Clear(); for (int i = 0; i < tablo.Rows.Count; i++) { dr = tablo.Rows[i]; my = new MyOtel(); my.Name = dr["Otel_Ad"].ToString(); my.Controls["btnGoster"].Name = dr["Otel_ID"].ToString(); my.Controls["lblOtelAdi"].Text = dr["Otel_Ad"].ToString(); my.Controls["pbresim"].BackgroundImage = Properties.Resources.mylogo; my.Controls["lbladres"].Text = dr["Acik_Adres"].ToString(); my.Controls["lblfiyat"].Text = dr["Fiyat"].ToString() + " ₺"; my.Controls["lbloy"].Text = "Değerlendirme : " + dr["Oy"].ToString(); PictureBox pb = (PictureBox)my.Controls["pbyildiz"]; pb.ImageLocation = "YildizResim\\" + dr["Yildiz_Sayisi"] + ".png"; otel_id = Convert.ToInt16(dr["Otel_ID"]); my.degerdurum(my.lbldeger, my.lbloy, Convert.ToInt16(dr["Oy"])); ResimGetir(dr["Otel_Ad"].ToString(), (PictureBox)my.Controls["pbresim"]); flowLayoutPanel1.Controls.Add(my); } GC.Collect(); GC.WaitForPendingFinalizers(); tablo.Dispose(); tablo = null; adp.Dispose(); adp = null; }
void getir(string ad) { bil = new _00.Bilgiler(); otl = new OtelBilgi(); adp = new OleDbDataAdapter("SELECT * FROM FIRSAT INNER JOIN OTEL ON FIRSAT.Otel_ID = OTEL.Otel_ID WHERE Otel_Ad = '" + ad + "'", FırsatBul.bag); tablo = new DataTable(); adp.Fill(tablo); dr = tablo.Rows[0]; my = new MyOtel(); my.Name = dr["Otel_Ad"].ToString(); my.Controls["lbleski"].Visible = true; my.Controls["lblyuzde"].Visible = true; my.Controls["btnGoster"].Name = dr["OTEL.Otel_ID"].ToString(); my.Controls["lbleski"].Text = dr["Eski_Fiyat"].ToString() + " ₺"; int yuzde = 100 - Convert.ToInt16(Convert.ToDouble(dr["Yeni_Fiyat"]) / ((Convert.ToDouble(dr["Eski_Fiyat"]) / 100))); my.Controls["lblOtelAdi"].Text = ad; my.Controls["lblyuzde"].Text = "- % " + yuzde.ToString(); my.Controls["pbresim"].BackgroundImage = Properties.Resources.mylogo; my.Controls["lbladres"].Text = dr["Acik_Adres"].ToString(); my.Controls["lblfiyat"].Text = dr["Fiyat"].ToString() + " ₺"; my.Controls["lbloy"].Text = "Değerlendirme : " + dr["Oy"].ToString(); PictureBox yldzresim = (PictureBox)my.Controls["pbyildiz"]; yldzresim.ImageLocation = "YildizResim\\" + dr["Yildiz_Sayisi"] + ".png"; PictureBox otelresim = (PictureBox)my.Controls["pbresim"]; otelresim.ImageLocation = "Resimler\\" + ad + "" + 0 + ".jpeg"; otl.flowLayoutPanel1.Controls.Add(my); otl.Show(); }
private void P_Click(object sender, EventArgs e) { ((PopupNotifier)sender).Hide(); flowLayoutPanel1.Controls.Clear(); adp = new OleDbDataAdapter("SELECT * FROM FIRSAT INNER JOIN OTEL ON FIRSAT.Otel_ID = OTEL.Otel_ID WHERE Otel_Ad ='" + ad + "'", FırsatBul.bag); DataTable tablo = new DataTable(); adp.Fill(tablo); dr = tablo.Rows[0]; my = new MyOtel(); my.Name = dr["Otel_Ad"].ToString(); my.Controls["lbleski"].Visible = true; my.Controls["lbleski"].Text = dr["Eski_Fiyat"].ToString() + " ₺"; my.Controls["lblyuzde"].Visible = true; int yuzde = 100 - Convert.ToInt16(Convert.ToDouble(dr["Yeni_Fiyat"]) / ((Convert.ToDouble(dr["Eski_Fiyat"]) / 100))); my.Controls["lblyuzde"].Text = "- % " + yuzde.ToString(); my.Controls["btnGoster"].Name = dr["OTEL.Otel_ID"].ToString(); my.Controls["lblOtelAdi"].Text = dr["Otel_Ad"].ToString(); my.Controls["pbresim"].BackgroundImage = Properties.Resources.mylogo; my.Controls["lbladres"].Text = dr["Acik_Adres"].ToString(); my.Controls["lblfiyat"].Text = dr["Yeni_Fiyat"].ToString() + " ₺"; PictureBox yldzresim = (PictureBox)my.Controls["pbyildiz"]; yldzresim.ImageLocation = "YildizResim\\" + dr["Yildiz_Sayisi"] + ".png"; // PictureBox otelresim = (PictureBox)my.Controls["pbresim"]; my.degerdurum(my.lbldeger, my.lbloy, Convert.ToInt16(dr["Oy"])); ResimGetir(dr["Otel_Ad"].ToString(), (PictureBox)my.Controls["pbresim"]); flowLayoutPanel1.Controls.Add(my); }