Esempio n. 1
0
        public Wagon GetWagonbyId(long id)
        {
            string sql = "Select * from Wagon where id=@id";
            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("id", id.ToString())
            };

            DataSet results = ExecuteSql(sql, parameters);
            Wagon   w       = null;

            if (results != null && results.Tables[0].Rows.Count > 0)
            {
                w = DataSetParser.DataSetToWagon(results, 0);
            }
            return(w);
        }
Esempio n. 2
0
        public List <Wagon> GetAllWagons()
        {
            string sql = "Select * from Wagon";
            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
            DataSet results = ExecuteSql(sql, parameters);

            List <Wagon> stations = new List <Wagon>();

            if (results != null)
            {
                for (int x = 0; x < results.Tables[0].Rows.Count; x++)
                {
                    Wagon w = DataSetParser.DataSetToWagon(results, x);
                    stations.Add(w);
                }
            }
            return(stations);
        }