private void button2_Click(object sender, EventArgs e) { if (textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "") { MessageBox.Show("Alanların dolu olduğundan emin olunuz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (comboBox2.SelectedIndex == 0) { MessageBox.Show("Geçersiz Baskı Yılı.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { DialogResult d; d = MessageBox.Show(textBox1.Text + "No'lu personeli düzenlemek istiyor musunuz?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { baglanti = new SqlConnection(con.adres); baglanti.Open(); string sorgu = "update Personel set perAdi=@ad,perSoyad=@soyad,perKullaniciadi=@kullanici,sifre=@sifre,eposta=@eposta,gorevi=@gorevi where perNo=@no"; SqlCommand komut = new SqlCommand(sorgu, baglanti); komut.Parameters.AddWithValue("@no", textBox1.Text); komut.Parameters.AddWithValue("@ad", textBox2.Text); komut.Parameters.AddWithValue("@soyad", textBox3.Text); komut.Parameters.AddWithValue("@kullanici", textBox4.Text); komut.Parameters.AddWithValue("@sifre", textBox5.Text); komut.Parameters.AddWithValue("@eposta", textBox6.Text); komut.Parameters.AddWithValue("@gorevi", comboBox2.Text); komut.ExecuteNonQuery(); MessageBox.Show(textBox1.Text + "No'lu personel düzenleme başarılı..", "Sistem Mesajı", MessageBoxButtons.OK, MessageBoxIcon.Information); komut.Dispose(); personelsil silTablo = new personelsil(); silTablo.DataGridDoldur(dataGridView1, "SELECT perNo, perAdi, perSoyad, perKullaniciadi, eposta, gorevi FROM Personel", "Personel"); random(); textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; comboBox2.SelectedIndex = 0; baglanti.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } }
private void PersonelKayıt_Load(object sender, EventArgs e) { personelsil silTablo = new personelsil(); silTablo.DataGridDoldur(dataGridView1, "SELECT perNo, perAdi, perSoyad, perKullaniciadi, eposta, gorevi FROM Personel", "Personel"); random(); textBox1.Enabled = false; comboBox2.SelectedIndex = 0; }
private void button3_Click(object sender, EventArgs e) { foreach (DataGridViewRow drow in dataGridView1.SelectedRows) //Seçili Satırları Silme { int no = Convert.ToInt32(drow.Cells[0].Value); personelsil sil = new personelsil(); sil.delete(no); } personelsil silTablo = new personelsil(); silTablo.DataGridDoldur(dataGridView1, "SELECT perNo, perAdi, perSoyad, perKullaniciadi, eposta, gorevi FROM Personel", "Personel"); }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "") { MessageBox.Show("Alanların dolu olduğundan emin olunuz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (comboBox2.SelectedIndex == 0) { MessageBox.Show("Görevi seçiniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { DialogResult d; d = MessageBox.Show("Kaydetmek istiyor musunuz?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (d == DialogResult.Yes) { personelekle ekle = new personelekle(); ekle.PersonelKayıt(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, comboBox2.Text); MessageBox.Show("Kayıt Başarılı", "Sistem Mesajı", MessageBoxButtons.OK, MessageBoxIcon.Information); personelsil silTablo = new personelsil(); silTablo.DataGridDoldur(dataGridView1, "SELECT perNo, perAdi, perSoyad, perKullaniciadi, eposta, gorevi FROM Personel", "Personel"); random(); textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; comboBox2.SelectedIndex = 0; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } }