private void btnKaydet_Click(object sender, EventArgs e) { if (_FormAdi == FormAdi.Uye) { string dizin = Application.StartupPath + "\\Uyeler\\"; string yol = dizin + _UyeVeKitapID.ToString() + ".jpg"; if (!Directory.Exists(dizin)) { Directory.CreateDirectory(dizin); } pictureBox1.Image.Save(yol); Islemler.GuncelleUyeResim(_UyeVeKitapID, yol); } else { string dizin = Application.StartupPath + "\\Kitaplar\\"; string yol = dizin + _UyeVeKitapID.ToString() + ".jpg"; if (!Directory.Exists(dizin)) { Directory.CreateDirectory(dizin); } pictureBox1.Image.Save(yol); Islemler.GuncelleKitapResim(_UyeVeKitapID, yol); } }
private void resmiSilToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow == null) { return; } int uyeID = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value); Islemler.GuncelleUyeResim(uyeID, ""); GetUyeler(); }
private void btnEkle_Click(object sender, EventArgs e) { string adi = txtAdi.Text.Trim(); if (adi == "") { MessageBox.Show("Üyenin Adını Girin!"); return; } if (cmbUyeTipi.SelectedIndex == -1) { MessageBox.Show("Üye Tipini Seçin"); return; } string uyeTipi = cmbUyeTipi.Text; if (Islemler.VarMiUye(adi)) { MessageBox.Show("Üye Zaten Kayıtlıdır!"); return; } string resimYolu = pictureBox1.ImageLocation == null ? "" : pictureBox1.ImageLocation; if (Islemler.EkleUye(adi, txtTel.Text, uyeTipi, txtAdres.Text.Trim(), resimYolu)) { int id = Islemler.GetUyeID(adi); string dizin = Application.StartupPath + "\\Uyeler\\"; string yol = dizin + id.ToString() + ".jpg"; if (!Directory.Exists(dizin)) { Directory.CreateDirectory(dizin); } pictureBox1.Image.Save(yol); Islemler.GuncelleUyeResim(id, yol); MessageBox.Show("Üye Başarıyla Tanımlandı."); GetUyeler(); txtAdi.SelectAll(); txtAdi.Focus(); } else { MessageBox.Show("Üye Eklenirken Hata Oluştu!"); } }