Ejemplo n.º 1
0
        public IEnumerable <Cursa> findAll()
        {
            //  log.Info("Found all races");
            List <Cursa>     curse      = new List <Cursa>();
            SQLiteConnection connection = sqliteConnection.getConnection();
            string           select     = "select * from Cursa";

            /*DataSet data = new DataSet();
             * var dataAdapter = new SQLiteDataAdapter(select, connection);
             * dataAdapter.Fill(data);
             */
            SQLiteCommand    sQLiteCommand = new SQLiteCommand(select, connection);
            SQLiteDataReader reader        = sQLiteCommand.ExecuteReader();

            while (reader.Read())
            {
                int    idCursa           = Convert.ToInt32(reader["idCursa"]);
                string capCilindrica     = Convert.ToString(reader["capCilindrica"]);
                int    numarParticipanti = Convert.ToInt32(reader["numarParticipanti"]);
                Cursa  cursa             = new Cursa(capCilindrica, idCursa, numarParticipanti);
                curse.Add(cursa);
            }
            return(curse);
        }
Ejemplo n.º 2
0
        public IEnumerable <Participant> findAll()
        {
            string             findAllQuerry = "select * from Participanti";
            List <Participant> participanti  = new List <Participant>();

            SQLiteConnection connection = sqliteConnection.getConnection();
            SQLiteCommand    command    = new SQLiteCommand(findAllQuerry, connection);
            SQLiteDataReader reader     = command.ExecuteReader();

            while (reader.Read())
            {
                Participant p;
                if (reader["idEchipa"] != DBNull.Value)
                {
                    p = new Participant(Convert.ToInt32(reader["idCursa"]), Convert.ToInt32(reader["idEchipa"]), Convert.ToString(reader["nume"]));
                }
                else
                {
                    p = new Participant(Convert.ToInt32(reader["idCursa"]), null, Convert.ToString(reader["nume"]));
                }
                participanti.Add(p);
            }
            return(participanti);
        }
Ejemplo n.º 3
0
        public User findUser(string username, string password)
        {
            SQLiteConnection connection = sqliteConnection.getConnection();
            SQLiteCommand    command    = new SQLiteCommand("select * from User u where u.name=@name and u.password=@pass", connection);

            command.Parameters.AddWithValue("@name", username);
            command.Parameters.AddWithValue("@pass", password);


            SQLiteDataReader reader = command.ExecuteReader();
            bool             isOk   = reader.Read();

            if (isOk)
            {
                return(new User(username, password));
            }
            return(null);
        }
Ejemplo n.º 4
0
        public IEnumerable <Echipa> findAll()
        {
            //log.Info("Found all teams!");
            List <Echipa>    echipe     = new List <Echipa>();
            SQLiteConnection connection = sqliteConnection.getConnection();
            string           select     = "select * from Echipa";

            /*DataSet data = new DataSet();
             * var dataAdapter = new SQLiteDataAdapter(select, connection);
             * dataAdapter.Fill(data);
             */
            SQLiteCommand    sQLiteCommand = new SQLiteCommand(select, connection);
            SQLiteDataReader reader        = sQLiteCommand.ExecuteReader();

            while (reader.Read())
            {
                int    idEchipa   = Convert.ToInt32(reader["idEchipa"]);
                string numeEchipa = Convert.ToString(reader["numeEchipa"]);
                Echipa echipa     = new Echipa(idEchipa, numeEchipa);
                echipe.Add(echipa);
            }
            return(echipe);
        }