public static int Update(ENOTLAR item) { SqlCommand cmd = null; int etkilenen = 0; try { cmd = new SqlCommand("NOTLAR_OGRETIMGOREVLISI_UPDATE", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } cmd.Parameters.AddWithValue("OGRENCI_ID", item.OGRENCINO1); cmd.Parameters.AddWithValue("DERS_ID", item.ACILANDERS1); cmd.Parameters.AddWithValue("VIZE_NOTU", item.VIZENOTU1); cmd.Parameters.AddWithValue("FINAL_NOTU", item.FINALNOTU1); cmd.Parameters.AddWithValue("PROJE_NOTU", item.PROJENOTU1); cmd.Parameters.AddWithValue("HARF_NOTU", item.HARFNOTU1); etkilenen = cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString()); etkilenen = -1; } finally { cmd.Connection.Close(); } return(etkilenen); }
public static int Update(ENOTLAR item) { if (item.OGRENCINO1 != null && item.ACILANDERS1 != null) { return(FNOTLAR.Update(item)); } else { return(-1); } }
public static List <ENOTLAR> Select(int ogrenciId) { List <ENOTLAR> notlar = null; SqlCommand cmd = null; try { cmd = new SqlCommand("NOTLAR_SELECT", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } cmd.Parameters.AddWithValue("OGRENCI_NO", ogrenciId); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { notlar = new List <ENOTLAR>(); while (rdr.Read()) { ENOTLAR not = new ENOTLAR(); not.ID1 = Convert.ToInt32(rdr["ID"]); not.ACILANDERS1 = Convert.ToInt32(rdr["ACILANDERS"]); not.OGRENCINO1 = Convert.ToInt32(rdr["OGRENCI"]); not.VIZENOTU1 = Convert.ToInt32(rdr["VIZENOTU"]); not.FINALNOTU1 = Convert.ToInt32(rdr["FINALNOTU"]); not.PROJENOTU1 = Convert.ToInt32(rdr["PROJENOTU"]); not.HARFNOTU1 = rdr["HARFNOTU"].ToString(); notlar.Add(not); } } rdr.Close(); } catch (Exception e) { MessageBox.Show(e.ToString()); notlar = null; } finally { cmd.Connection.Close(); } return(notlar); }
private void updateNote() { ENOTLAR not = new ENOTLAR(); not.OGRENCINO1 = Convert.ToInt32(comboBox16.SelectedValue); not.ACILANDERS1 = Convert.ToInt32(comboBox15.SelectedValue); not.VIZENOTU1 = Convert.ToInt32(textBox7.Text); not.FINALNOTU1 = Convert.ToInt32(textBox8.Text); not.PROJENOTU1 = Convert.ToInt32(textBox9.Text); not.HARFNOTU1 = textBox10.Text.ToString(); int guncellenen = BNOTLAR.Update(not); if (guncellenen == 1) { MessageBox.Show("Not Güncellendi"); fillNote(); } }
private void fillNote() { ENOTLAR notlar = new ENOTLAR(); notlar = BNOTLAR.Select(Convert.ToInt32(comboBox16.SelectedValue), Convert.ToInt32(comboBox15.SelectedValue)); if (notlar != null) { textBox7.Text = notlar.VIZENOTU1.ToString(); textBox8.Text = notlar.FINALNOTU1.ToString(); textBox9.Text = notlar.PROJENOTU1.ToString(); textBox10.Text = notlar.HARFNOTU1.ToString(); } else { textBox7.Clear(); textBox8.Clear(); textBox9.Clear(); textBox10.Clear(); } }