Пример #1
0
 /// <summary>
 /// Intoarce istoricul comenzilor pentru utilizatorul cu id-ul id_user
 /// </summary>
 public static IstoricComenzi getIstoric(int user)
 {
     IstoricComenzi istoric = new IstoricComenzi(user);
     SqlConnection istoric_user_connection = new SqlConnection(connection_string_);
     istoric_user_connection.Open();
     SqlCommand istoric_user_command = new SqlCommand(
             @"select id_comanda, data, valoare
                   from comenzi
                   where id_user = @user", istoric_user_connection);
     istoric_user_command.Parameters.Add(new SqlParameter("@user", user));
     SqlDataReader istoric_user_reader = istoric_user_command.ExecuteReader();
     while (istoric_user_reader.Read())
     {
         int id_comanda = istoric_user_reader.GetInt32(0);
         Comanda comanda = getComanda(id_comanda);
         comanda.IdUser = user;
         comanda.Pret = istoric_user_reader.GetDouble(2);
         comanda.Data = istoric_user_reader.GetDateTime(1);
         istoric.addComanda(comanda);
     }
     istoric_user_reader.Close();
     istoric_user_connection.Close();
     return istoric;
 }
Пример #2
0
 public void addComanda(Comanda comanda)
 {
     lista_comenzi_.Add(comanda);
 }