public void ogrSil(VAR.ogrenci Sogrenci) { SqlCommand cmd = new SqlCommand("ogrsil", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ogrid", Sogrenci.Ogrid); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
private void button1_Click(object sender, EventArgs e) { try { VAR.ogrenci yogrenci = new Varlıklar.ogrenci(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text); yogrenci.Ogrid = yeniogrenci.Guncelle(yogrenci); ((Form3)this.Owner).ogrlistele(); this.Visible = false; } catch { MessageBox.Show("Hatalı işlem."); } }
public int Guncelle(VAR.ogrenci ogrenci) { SqlCommand cmd = new SqlCommand("ogrduzenle", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ogrno", ogrenci.Ogrno); cmd.Parameters.AddWithValue("@tcno", ogrenci.Tcno); cmd.Parameters.AddWithValue("@ogrAdSoyad", ogrenci.OgrAdSoyad); cmd.Parameters.AddWithValue("@ogrBolum", ogrenci.OgrBolum); cmd.Parameters.AddWithValue("@sinif", ogrenci.Sinif); cmd.Parameters.AddWithValue("@ceptel", ogrenci.Ceptel); cmd.Parameters.AddWithValue("@mail", ogrenci.Mail); con.Open(); int id = Convert.ToInt32(cmd.ExecuteScalar()); con.Close(); return(id); }
private void button1_Click(object sender, EventArgs e) { VAR.ogrenci yogrenci = new Varlıklar.ogrenci(Convert.ToInt32(textBox1.Text), textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox6.Text, textBox7.Text); yogrenci.Ogrid = yeniogrenci.Ekle(yogrenci); ((Form3)this.Owner).ogrlistele(); this.Visible = false; //bool dogru = KullaniciGirdisiDogrula(); //if (!dogru) { return; } //if (ogrenci == null) //{ // ogrenci = new VAR.ogrenci(); //} //ogrenci.Ogrno = Convert.ToInt32( textBox1.Text); //ogrenci.Tcno = textBox2.Text; //ogrenci.OgrAdSoyad = textBox3.Text; //ogrenci.OgrBolum = textBox4.Text; //ogrenci.Sinif = textBox5.Text; //ogrenci.Ceptel = textBox6.Text; //ogrenci.Mail = textBox7.Text; //int sonuc = 0; //try //{ // sonuc = ISK.ogrenci.OgrEkle(ogrenci); //} //catch(Exception ex) //{ // Yardimci.HataKaydet(ex); // MessageBox.Show("Serviste bir hata oluştu!"); //} //if (sonuc > 0) //{ // ((Form3)this.Owner).ogrlistele(); // this.Visible = false; //} //else { MessageBox.Show("İşlem Hatalı!"); } }
private void button6_Click(object sender, EventArgs e) { VAR.ogrenci ogrSil = new VAR.ogrenci(Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[0].Value)); yogrenci.ogrSil(ogrSil); ogrlistele(); }