Esempio n. 1
0
        public ObservableCollection <Absenta> GetAbsenta(int elevId)
        {
            SqlConnection con = DAHelper.Connection;

            try
            {
                SqlCommand cmd = new SqlCommand("GetAbsElev", con);
                ObservableCollection <Absenta> result = new ObservableCollection <Absenta>();
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.Add(new SqlParameter("@elevID", elevId));

                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Absenta p = new Absenta();
                    p.idAbsenta = reader.GetInt32(0);
                    p.Data      = reader.GetDateTime(1);
                    p.Motivata  = reader.GetBoolean(2);
                    p.Materie   = new Materie(reader.GetInt32(3), reader.GetString(4).TrimEnd());
                    result.Add(p);
                }
                reader.Close();
                return(result);
            }
            finally
            {
                con.Close();
            }
        }
Esempio n. 2
0
        public void AddAbsenta(int elevID, Absenta absenta)
        {
            SqlConnection con = DAHelper.Connection;
            SqlCommand    cmd = new SqlCommand("AddAbsenta", con);

            cmd.CommandType = CommandType.StoredProcedure;

            SqlParameter elev    = new SqlParameter("@elevID", elevID);
            SqlParameter materie = new SqlParameter("@materieID", absenta.Materie.IdMaterie);
            SqlParameter motiv   = new SqlParameter("@motivata", absenta.Motivata);
            SqlParameter data    = new SqlParameter("@data", absenta.Data);

            cmd.Parameters.Add(elev);
            cmd.Parameters.Add(materie);
            cmd.Parameters.Add(motiv);
            cmd.Parameters.Add(data);

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
Esempio n. 3
0
 public void ModAbsenta(int idElev, Absenta absenta)
 {
     absenteDA.ModAbsenta(idElev, absenta);
 }
Esempio n. 4
0
 public void AddAbsenta(int idElev, Absenta absenta)
 {
     absenteDA.AddAbsenta(idElev, absenta);
 }