/// <summary> /// Sql'deki verileri dergiye yukler /// </summary> /// <returns>List<urun> tipinde dergiliste dondurur</returns> public List <Urun> DergiYukle() { List <Urun> dergiliste = new List <Urun>(); cn.SqlConnetion.Open(); SqlCommand command = new SqlCommand("SELECT * FROM DergiTable", cn.SqlConnetion); SqlDataReader reader = command.ExecuteReader(); Dergi dergi; while (reader.Read()) { dergi = new Dergi(); dergi.urunID = (int)reader["Dergi_ID"]; dergi.isim = (string)reader["Dergi_Ad"]; dergi.sayi = (string)reader["Dergi_Sayi"]; dergi.ucret = (double)reader["Dergi_Ucreti"]; dergi.urunsayisi = (int)reader["Dergi_Stok"]; dergi.kategori = (string)reader["Dergi_Turu"]; try { dergi.resim = Image.FromFile(Application.StartupPath + @"\Resources\DergiResimleri\" + (string)reader["Dergi_Fotograf"]); } catch (Exception) { } dergiliste.Add(dergi); } cn.SqlConnetion.Close(); return(dergiliste); }
public DergiTanim(Dergi dergi) { this.dergi = dergi; InitializeComponent(); lblname.Text = dergi.isim; lbldergiissue.Text = dergi.sayi; lbldergikatagori.Text = dergi.kategori; lbldergifiyat.Text = dergi.ucret.ToString(); pictureboxdergiresim.Image = dergi.resim; }
/// <summary> /// Her dergi icin panel olusur. /// </summary> /// <param name="item">Her item icin ayri ayri DergiPanel calisir.</param> /// <param name="sayac2">X kordinatinin kontroludur</param> /// <param name="ykontrol">Y kordinatinin kontorludur.</param> public DergiPanel(Dergi item, int sayac2, int ykontrol) { MusteriLog.kaydet("DergiPanel"); dergi = item; this.BackColor = Color.Transparent; this.Size = new Size(290, 190); this.BorderStyle = BorderStyle.FixedSingle; if (sayac2 % 4 == 0) { this.Location = new Point(0, ykontrol); } else { this.Location = new Point((sayac2 - 1) * 300, ykontrol - 200); } resimekle = new PictureBox(); resimekle.Size = new Size(105, 135); resimekle.BackgroundImage = item.resim; resimekle.BackgroundImageLayout = ImageLayout.Zoom; this.Controls.Add(resimekle); isim = new Label(); isim.AutoSize = true; isim.Text = item.isim; isim.TextAlign = ContentAlignment.MiddleLeft; isim.Font = new Font("Microsoft Sans Serif", (float)9.75, FontStyle.Italic); this.Controls.Add(isim); Issue = new Label(); Issue.AutoSize = true; Issue.Text = item.sayi; Issue.Font = new Font("Microsoft Sans Serif", (float)8.25); this.Controls.Add(Issue); tur = new Label(); tur.AutoSize = true; tur.Text = item.kategori; tur.Font = new Font("Microsoft Sans Serif", (float)10.25); //tur.ForeColor = Color.DarkGray; this.Controls.Add(tur); Ucret = new Label(); Ucret.AutoSize = true; Ucret.Text = item.ucret + " TL"; Ucret.Font = new Font("Microsoft Sans Serif", (float)11.25, FontStyle.Bold); this.Controls.Add(Ucret); detay = new Button(); detay.Text = "Detay"; detay.Font = new Font("Microsoft Sans Serif", (float)10.5, FontStyle.Bold); detay.Size = new Size(80, 30); this.Controls.Add(detay); ekle = new Button(); ekle.Text = "Sepete Ekle"; ekle.Font = new Font("Microsoft Sans Serif", (float)10.5, FontStyle.Bold); ekle.Size = new Size(80, 50); this.Controls.Add(ekle); this.Controls[1].Location = new Point(125, 10); this.Controls[1].BringToFront(); this.Controls[2].Location = new Point(125, 60); this.Controls[2].BringToFront(); this.Controls[3].Location = new Point(125, 40); this.Controls[3].BringToFront(); this.Controls[4].Location = new Point(125, 80); this.Controls[4].BringToFront(); this.Controls[5].Location = new Point(180, 150); this.Controls[6].Location = new Point(50, 140); detay.Click += new EventHandler(detay_Click); ekle.Click += new EventHandler(ekle_Click); }