public static int Update(EOGRENCI item) { SqlCommand cmd = null; int etkilenen = 0; try { cmd = new SqlCommand("OGRENCI_UPDATE", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } cmd.Parameters.AddWithValue("OGRENCI_ID", item.ID1); cmd.Parameters.AddWithValue("MAIL", item.MAIL1); cmd.Parameters.AddWithValue("SIFRE", item.SIFRE1); etkilenen = cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show(e.ToString()); etkilenen = -1; } finally { cmd.Connection.Close(); } return(etkilenen); }
public static int Update(EOGRENCI item) { if (item.MAIL1 != null && item.SIFRE1 != null) { return(FOGRENCI.Update(item)); } else { return(-1); } }
public static EOGRENCI Select(string ogrenciNo, string sifre) { EOGRENCI ogrenci = null; SqlCommand cmd = null; try { cmd = new SqlCommand("OGRENCI_SELECT", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } cmd.Parameters.AddWithValue("OGRENCI_NO", ogrenciNo); cmd.Parameters.AddWithValue("OGRENCI_SIFRE", sifre); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { ogrenci = new EOGRENCI(); ogrenci.ID1 = Convert.ToInt32(rdr["ID"]); ogrenci.OKULNO1 = rdr["OKULNO"].ToString(); ogrenci.TCKIMLIKNO1 = rdr["TCKIMLIKNO"].ToString(); ogrenci.AD1 = rdr["AD"].ToString(); ogrenci.SOYAD1 = rdr["SOYAD"].ToString(); ogrenci.DOGUMYERI1 = Convert.ToInt32(rdr["DOGUMYERI"]); ogrenci.DOGUMTARIHI1 = Convert.ToDateTime(rdr["DOGUMTARIHI"]); ogrenci.KAYITTARIHI1 = Convert.ToDateTime(rdr["KAYITTARIHI"]); ogrenci.OGRENCITURU1 = Convert.ToInt32(rdr["TUR"]); ogrenci.BOLUM1 = Convert.ToInt32(rdr["BOLUM"]); ogrenci.SIFRE1 = rdr["SIFRE"].ToString(); ogrenci.MAIL1 = rdr["MAIL"].ToString(); } } rdr.Close(); } catch (Exception e) { MessageBox.Show(e.ToString()); ogrenci = null; } finally { cmd.Connection.Close(); } return(ogrenci); }
public static List <EOGRENCI> SelectList() { List <EOGRENCI> ogrenciler = null; SqlCommand cmd = null; try { cmd = new SqlCommand("OGRENCI_SELECTLIST", BAGLAN.conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; if (cmd.Connection.State != ConnectionState.Open) { cmd.Connection.Open(); } SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { ogrenciler = new List <EOGRENCI>(); while (rdr.Read()) { EOGRENCI ogrenci = new EOGRENCI(); ogrenci.ID1 = Convert.ToInt32(rdr["ID"]); ogrenci.ADSOYAD1 = rdr["AD"].ToString() + " " + rdr["SOYAD"].ToString(); ogrenciler.Add(ogrenci); } } rdr.Close(); } catch (Exception e) { MessageBox.Show(e.ToString()); ogrenciler = null; } finally { cmd.Connection.Close(); } return(ogrenciler); }
private void button1_Click(object sender, EventArgs e) { string numara = textBox1.Text; string sifre = textBox2.Text; ogrenci = new EOGRENCI(); ogrenci = BOGRENCI.Select(numara, sifre); ogretimGorevlisi = new EOGRETIMGOREVLISI(); ogretimGorevlisi = BOGRETIMGOREVLISI.Select(numara, sifre); if (ogrenci != null) { Form2 frm2 = new Form2(this); frm2.ShowDialog(); } else if (ogretimGorevlisi != null) { Form3 frm3 = new Form3(this); frm3.ShowDialog(); } else { MessageBox.Show("Okul Numaranız veya Şifreniz Hatalı!"); } }
private void Form2_Load(object sender, EventArgs e) { Ogrenci = this.mainForm.Ogrenci; label12.Text = Ogrenci.AD1; label13.Text = Ogrenci.SOYAD1; label14.Text = Ogrenci.OKULNO1; label15.Text = Ogrenci.TCKIMLIKNO1; label16.Text = BIL.Select(Ogrenci.DOGUMYERI1).IL1.ToString(); label17.Text = Ogrenci.DOGUMTARIHI1.ToString(); label18.Text = Ogrenci.KAYITTARIHI1.ToString(); label19.Text = BOGRENCITURU.Select(Ogrenci.OGRENCITURU1).TUR1.ToString(); label20.Text = BPROGRAM.Select(Ogrenci.BOLUM1).PROGRAM1.ToString(); textBox1.Text = Ogrenci.MAIL1; textBox2.Text = Ogrenci.SIFRE1; fillScoreAndRecordedCourse(); List <EACILANDERSLERVIEW> acilanDersler = new List <EACILANDERSLERVIEW>(); acilanDersler = BACILANDERSLER.SelectList(); dataGridView3.DataSource = acilanDersler; dataGridView3.Columns[0].Visible = false; //dataGridView3.Columns[10].Visible = false; }