public ObservableCollection <Elev> GetEleviClasa(int clasaID) { SqlConnection con = DAHelper.Connection; try { SqlCommand cmd = new SqlCommand("GetEleviClasa", con); ObservableCollection <Elev> result = new ObservableCollection <Elev>(); SqlParameter clasaId = new SqlParameter("@clasaID", clasaID); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(clasaId); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Elev r = new Elev(); r.IdPers = reader.GetInt32(0); r.Nume = reader.GetString(1).TrimEnd(); r.Prenume = reader.GetString(2).TrimEnd(); r.IdElev = reader.GetInt32(3); r.ClasaFrecv = new Clasa(reader.GetInt32(4), reader.GetString(5).TrimEnd(), new Specializare(reader.GetInt32(6), reader.GetString(7).TrimEnd())); result.Add(r); } reader.Close(); return(result); } finally { con.Close(); } }
public void AddElev(Elev elev) { SqlConnection con = DAHelper.Connection; SqlCommand cmd = new SqlCommand("AddElev", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter elevNume = new SqlParameter("@nume", elev.Nume); SqlParameter elevPrenume = new SqlParameter("@prenume", elev.Prenume); SqlParameter clasaElev = new SqlParameter("@clasa", elev.ClasaFrecv.IdClasa); cmd.Parameters.Add(elevNume); cmd.Parameters.Add(elevPrenume); cmd.Parameters.Add(clasaElev); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }
public Elev GetElev(int persID) { SqlConnection con = DAHelper.Connection; try { SqlCommand cmd = new SqlCommand("GetElevData", con); Elev result = new Elev(); NotaDA note = new NotaDA(); AbsentaDA abs = new AbsentaDA(); SqlParameter persId = new SqlParameter("@persID", persID); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(persId); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { result.IdPers = reader.GetInt32(0); result.Nume = reader.GetString(1).TrimEnd(); result.Prenume = reader.GetString(2).TrimEnd(); result.IdElev = reader.GetInt32(3); result.ClasaFrecv = new Clasa(reader.GetInt32(4), reader.GetString(5).TrimEnd(), new Specializare(reader.GetInt32(6), reader.GetString(7).TrimEnd())); result.Note = note.GetNote(result.IdElev); result.Absente = abs.GetAbsenta(result.IdElev); } reader.Close(); return(result); } finally { con.Close(); } }
public void ModElev(Elev elv) { elevDA.ModElev(elv); }
public void AddElev(Elev elv) { elevDA.AddElev(elv); }
public void ModElev(Elev elev) { eleviDA.ModElev(elev); }