예제 #1
0
        public ObservableCollection <Clasa> GetClase()
        {
            SqlConnection con = DAHelper.Connection;

            try
            {
                SqlCommand cmd = new SqlCommand("GetClase", con);
                ObservableCollection <Clasa> result = new ObservableCollection <Clasa>();
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Clasa p = new Clasa();
                    p.IdClasa   = reader.GetInt32(0);
                    p.Descriere = reader.GetString(1).TrimEnd();
                    p.Special   = new Specializare();
                    p.Special.IdSpecializare = reader.GetInt32(2);
                    p.Special.Descriere      = reader.GetString(3).TrimEnd();
                    result.Add(p);
                }
                reader.Close();
                return(result);
            }
            finally
            {
                con.Close();
            }
        }
예제 #2
0
        public void AddClasa(Clasa clasa)
        {
            SqlConnection con = DAHelper.Connection;
            SqlCommand    cmd = new SqlCommand("AddClasa", con);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter clasaDesc = new SqlParameter("@descClasa", clasa.Descriere);
            SqlParameter clasaSpec = new SqlParameter("@specialID", clasa.Special.IdSpecializare);

            cmd.Parameters.Add(clasaDesc);
            cmd.Parameters.Add(clasaSpec);

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
예제 #3
0
 public void ModClasa(Clasa clasa)
 {
     clasaDA.ModClasa(clasa);
 }
예제 #4
0
 public void AddClasa(Clasa clasa)
 {
     clasaDA.AddClasa(clasa);
 }