public static int Insert(EKAYITLIDERS item) { SqlCommand cmd = null; int etkilenen = 0; try { cmd = new SqlCommand("NOTLAR_INSERT", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } cmd.Parameters.AddWithValue("OGRENCI_ID", item.OGRENCIID1); cmd.Parameters.AddWithValue("DERS_ID", item.DERSID1); etkilenen = cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString()); etkilenen = -1; } finally { cmd.Connection.Close(); } return(etkilenen); }
public static int Insert(EKAYITLIDERS item) { if (item.OGRENCIID1 > 0 && item.DERSID1 > 0) { return(FKAYITLIDERS.Insert(item)); } else { return(-1); } }
private void button3_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridView3.SelectedRows) { EKAYITLIDERS ders = new EKAYITLIDERS(); ders.OGRENCIID1 = Ogrenci.ID1; ders.DERSID1 = Convert.ToInt32(row.Cells[0].Value); int bolumID = Convert.ToInt32(row.Cells[10].Value); if (Ogrenci.BOLUM1 == Convert.ToInt32(row.Cells[10].Value)) { int sonuc = BKAYITLIDERS.Insert(ders); fillScoreAndRecordedCourse(); } else { MessageBox.Show("Dersi ALabilen Programlara Dahil Değilsiniz!"); } } }