/// <summary> /// Suankiurunlistesine muziklistesindeki urunler aktarilir ve Panel uret sinifinin panel olustur metodu cagirilarak muzikpanel olusumu saglanir. /// </summary> private void btnCD_Click(object sender, EventArgs e) { MusteriLog.kaydet("CD Göster"); panel2.Controls.Clear(); SuankiUrunliste.Clear(); int kontrol = 0; int ykontrol = 0; int sayac2 = 0; foreach (var item in (List <Urun>)muzikliste) { SuankiUrunliste.Add(item); sayac2++; if (kontrol % 4 == 0) { sayac2 = 1; ykontrol += 200; } UrunPanel pnl = panelcreator.PanelOlustur(item, sayac2, ykontrol); panel2.Controls.Add(pnl); kontrol++; } }
/// <summary> /// Musterinin profilini gosterir. /// </summary> private void btnProfil_Click(object sender, EventArgs e) { MusteriLog.kaydet("Profil"); MusteriBilgi musteriBilgi = new MusteriBilgi(); musteriBilgi.Show(); }
/// <summary> /// Alisveris Sepetini acar. /// </summary> private void button2_Click(object sender, EventArgs e) { MusteriLog.kaydet("Alişveriş Sepeti"); sepet.urungoster(); if (sepet.urun.Count == 0) { MessageBox.Show("Sepetiniz Boş", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> ///sql sorgusu ile textboxa girilen kullanici adi ve parolayı kontrol eder. /// </summary> private void btnMusteriGrs_Click(object sender, EventArgs e) { string komut = "SELECT * FROM MusteriTable WHERE Musteri_KullaniciAdi = '" + txtBoxKulAdi.Text + "' AND Musteri_Parola = '" + txtBoxParola.Text + "'";; sqlr.Komut = komut; if (sqlr.Oku().Equals(true)) { MusteriLog.kaydet("Giris"); MessageBox.Show("Giris Başarili"); AlisverisSayfa f9 = new AlisverisSayfa(); this.Opacity = 0; f9.Show(); } else { MessageBox.Show("Giris Başarısız"); } }
/// <summary> /// Kitap ekle butonuna tiklandiginda kitabin alisveris sepetine eklendigi kisimdir. /// </summary> private void ekle_Click(object sender, EventArgs e) { MusteriLog.kaydet("Sepete Ekle"); SqlCommand kmt; SqlCommand kmt2; ArrayList veriler = new ArrayList(); Connection cn = Connection.getInstance(); nesnelerinsayisi++; if (nesne.urunsayisi > nesnelerinsayisi) { cn.SqlConnetion.Open(); SatinalinacakNesneler kitap = new SatinalinacakNesneler(); kitap.Urun = nesne; kitap.Sayisi = nesnelerinsayisi; AlisverisSayfa.sepet.urun.Add(kitap); int sayi = nesne.urunsayisi - 1; veriler.Add(nesne.urunID); veriler.Add(sayi); string komut = "UPDATE KitapTable SET Kitap_StokSayisi=@1 WHERE Kitap_ID=@0"; kmt = new SqlCommand(komut, cn.SqlConnetion); kmt.Parameters.AddWithValue("0", veriler[0]); kmt.Parameters.AddWithValue("1", veriler[1]); kmt.ExecuteNonQuery(); String komut2 = "SELECT Kitap_StokSayisi FROM KitapTable WHERE Kitap_ID=@0"; kmt2 = new SqlCommand(komut2, cn.SqlConnetion); kmt2.Parameters.AddWithValue("0", veriler[0]); SqlDataReader reader = kmt2.ExecuteReader(); reader.Read(); nesne.urunsayisi = (int)reader["Kitap_StokSayisi"]; cn.SqlConnetion.Close(); musteri.urunliste.Add(nesne); } else { MessageBox.Show("Ürün Alınamaz Stok Bitti..."); } }
/// <summary> /// Dergi ekle butonuna tiklandiginda derginin alisveris sepetine eklendigi kisimdir. /// </summary> private void ekle_Click(object sender, EventArgs e) { MusteriLog.kaydet("Sepete Ekle"); SqlCommand kmt; SqlCommand kmt2; ArrayList veriler = new ArrayList(); Connection cn = Connection.getInstance(); nesnelerinsayisi++; ///Her ekle butonuna basildiginda urunsayisini kontrol eder. if (dergi.urunsayisi > nesnelerinsayisi) //Eger urun sayisindan fazla urun ekleye basildiysa uyarı verir. { cn.SqlConnetion.Open(); SatinalinacakNesneler nesne = new SatinalinacakNesneler(); nesne.Urun = dergi; nesne.Sayisi = nesnelerinsayisi; AlisverisSayfa.sepet.urun.Add(nesne); int sayi = dergi.urunsayisi - 1; veriler.Add(dergi.urunID); veriler.Add(sayi); ///Dergi sayisini database kisminda urunId kullanarak update eder. string komut = "UPDATE DergiTable SET Dergi_Stok=@1 WHERE Dergi_ID=@0"; kmt = new SqlCommand(komut, cn.SqlConnetion); kmt.Parameters.AddWithValue("0", veriler[0]); kmt.Parameters.AddWithValue("1", veriler[1]); kmt.ExecuteNonQuery(); ///Select sorgusuyla dergi stogunu database kismindan ceker. String komut2 = "SELECT Dergi_Stok FROM DergiTable WHERE Dergi_ID=@0"; kmt2 = new SqlCommand(komut2, cn.SqlConnetion); kmt2.Parameters.AddWithValue("0", veriler[0]); SqlDataReader reader = kmt2.ExecuteReader(); reader.Read(); dergi.urunsayisi = (int)reader["Dergi_Stok"]; cn.SqlConnetion.Close(); } else { MessageBox.Show("Ürün Alınamaz Stok Bitti..."); } }
/// <summary> /// Her kitap icin panel olusur. /// </summary> /// <param name="item">Her item icin ayri ayri muzikpanel calisir.</param> /// <param name="sayac2">X kordinatinin kontroludur</param> /// <param name="ykontrol">Y kordinatinin kontorludur.</param> public MuzikPanel(Muzik item, int sayac2, int ykontrol) { MusteriLog.kaydet("MuzikPanel"); this.muzik = item; this.BackColor = Color.Transparent; this.Size = new Size(290, 200); 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(120, 140); 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); Sarkici = new Label(); Sarkici.AutoSize = true; Sarkici.Text = item.Sarkici; Sarkici.Font = new Font("Microsoft Sans Serif", (float)8.25); this.Controls.Add(Sarkici); Tur = new Label(); Tur.AutoSize = true; Tur.Text = item.kategori; Tur.ForeColor = Color.Black; Tur.Font = new Font("Microsoft Sans Serif", (float)8.50); this.Controls.Add(Tur); Fiyat = new Label(); Fiyat.AutoSize = true; Fiyat.Text = item.ucret + " TL"; Fiyat.Font = new Font("Microsoft Sans Serif", (float)11.25, FontStyle.Bold); this.Controls.Add(Fiyat); detay = new Button(); detay.Text = "Detay"; detay.Size = new Size(80, 30); detay.Font = new Font("Microsoft Sans Serif", (float)10.5, FontStyle.Bold); this.Controls.Add(detay); ekle = new Button(); ekle.Text = "Sepete Ekle"; ekle.Size = new Size(80, 53); ekle.Font = new Font("Microsoft Sans Serif", (float)10.5, FontStyle.Bold); this.Controls.Add(ekle); this.Controls[1].Location = new Point(125, 10);// Name label this.Controls[1].BringToFront(); this.Controls[2].Location = new Point(125, 50);// Singer label this.Controls[2].BringToFront(); this.Controls[3].Location = new Point(125, 30);// Type label this.Controls[3].BringToFront(); this.Controls[4].Location = new Point(125, 110);// Price1 label this.Controls[4].BringToFront(); this.Controls[0].Location = new Point(180, 100); //Fiyat this.Controls[5].Location = new Point(180, 150); this.Controls[6].Location = new Point(50, 140); ekle.Click += new EventHandler(ekle_Click); this.Controls[6].Location = new Point(50, 150); detay.Click += new EventHandler(detay_Click); }
/// <summary> /// Tiklandiginda muzik detaylarini gosterir. /// </summary> private void detay_Click(object sender, EventArgs e) { MusteriLog.kaydet("Muzik detay"); muzik.DetayGoster(); }
/// <summary> /// Her kitap icin panel olusur. /// </summary> /// <param name="item">Her item icin ayri ayri KitapPanel calisir.</param> /// <param name="sayac2">X kordinatinin kontroludur</param> /// <param name="ykontrol">Y kordinatinin kontorludur.</param> public KitapPanel(Kitap item, int sayac2, int ykontrol) { MusteriLog.kaydet("KitapPanel"); nesne = 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); Yazar = new Label(); Yazar.AutoSize = true; Yazar.Text = item.Yazar; Yazar.Font = new Font("Microsoft Sans Serif", (float)8.25); this.Controls.Add(Yazar); Yayimci = new Label(); Yayimci.AutoSize = true; Yayimci.Text = item.Yayımcı; Yayimci.Font = new Font("Microsoft Sans Serif", (float)8.25); Yayimci.ForeColor = Color.Black; this.Controls.Add(Yayimci); Fiyat = new Label(); Fiyat.AutoSize = true; Fiyat.Text = item.ucret + " TL"; Fiyat.Font = new Font("Microsoft Sans Serif", (float)11.25, FontStyle.Bold); this.Controls.Add(Fiyat); 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[0].Location = new Point(0, 0); //Resim this.Controls[1].Location = new Point(125, 30); // Name label this.Controls[1].BringToFront(); this.Controls[2].Location = new Point(125, 60);// Yazar label this.Controls[2].BringToFront(); this.Controls[3].Location = new Point(125, 90); // Tur this.Controls[3].BringToFront(); this.Controls[4].Location = new Point(150, 120); //Fiyat 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); }
/// <summary> /// Tiklandiginda kitap detaylarini gosterir. /// </summary> private void detay_Click(object sender, EventArgs e) { MusteriLog.kaydet("Kitap Detay"); nesne.DetayGoster(); }
/// <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); }
/// <summary> /// Detay butonuna tiklandiginda dergi sinifinin detaygoster metodunu cagirir. /// </summary> private void detay_Click(object sender, EventArgs e) { MusteriLog.kaydet("DergiDetay"); dergi.DetayGoster(); }