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(); }
public void yorumgetir(Bilgiler b, int otel) { b.tabControl1.TabPages[2].Controls["fl1"].Controls.Clear(); using (adp = new OleDbDataAdapter("SELECT * FROM OTEL INNER JOIN YORUM ON OTEL.Otel_ID = YORUM.Otel_ID WHERE OTEL.Otel_ID =" + otel, FırsatBul.bag)) { tablo = new DataTable(); adp.Fill(tablo); for (int i = 0; i < tablo.Rows.Count; i++) { DataRow item = tablo.Rows[i]; yrm = new Yorumlar(); b.tabControl1.TabPages[2].Controls["fl1"].Controls.Add(yrm); SplitContainer spl = (SplitContainer)yrm.Controls["sp"]; spl.Panel1.Controls["lblkullanici"].Text = item["Ad_Soyad"].ToString(); spl.Panel2.Controls["label1"].Text = item["Yorum"].ToString(); spl.Panel1.Controls["lbloy"].Text = item["YORUM.Oy"].ToString(); spl.Panel1.Controls["lbltarih"].Text = item["Tarih"].ToString().Replace("00:00:00", ""); } } tablo.Dispose(); tablo = null; GC.Collect(); adp.Dispose(); adp = null; GC.WaitForPendingFinalizers(); }
private void btngoster_Click(object sender, EventArgs e) { if (sayac == 0) { try { if (bil == null) { bil = new Bilgiler(); } if (bil != null) { btngoster.Text = " Gizle"; this.Height = 530; sayac = 1; panel1.Controls.Add(bil); otel_id = Convert.ToInt16(btngoster.Name); PictureBox pc = (PictureBox)bil.tabControl1.TabPages[0].Controls["pictureBox1"]; bil.tabControl1.TabPages[0].Name = lbloteladi.Text; ResimGetir(pc, bil.tabControl1.TabPages[0].Name, 0); yorumgetir(bil, otel_id); bilgicek(otel_id); FiyatGetir(otel_id); benzergetir(otel_id, FırsatBul.sehiradi.ToString()); sayac2++; } } catch { } } else { this.Height = 180; btngoster.Text = " Göster"; // bil.Dispose(); // bil = null; sayac = 0; } }