Exemplo n.º 1
0
 public Abastecimento()
 {
     _veiculo = new Veiculo();
     _posto = new Posto();
     _combustivel = new Combustivel();
 }
Exemplo n.º 2
0
 public Abastecimento()
 {
     _veiculo     = new Veiculo();
     _posto       = new Posto();
     _combustivel = new Combustivel();
 }
Exemplo n.º 3
0
        public List<Posto> listar()
        {
            List<Posto> lista = new List<Posto>();
            Posto posto;
            MySqlDataReader reader;

            try
            {
                command.Connection.Open();
                vsql.Append("SELECT ID,NOME,BAIRRO,CIDADE,UF FROM TB_POSTO ");
                vsql.Append("SELECT NOME ");

                command.CommandText = vsql.ToString();
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    posto = new Posto();
                    posto.ID = Convert.ToInt32(reader["ID"].ToString());
                    posto.nome = reader["NOME"].ToString();
                    posto.bairro = reader["BAIRRO"].ToString();
                    posto.cidade = reader["CIDADE"].ToString();
                    posto.uf = reader["UF"].ToString();
                    lista.Add(posto);
                }
            }
            finally
            {
                command.Connection.Close();
            }

            return lista;
        }
Exemplo n.º 4
0
 public List<Abastecimento> listar(Posto pPosto)
 {
     criarLista();
     var xmlLista = _xmlDoc.Descendants("abastecimento").
         Where(x => x.Element("id_posto").Value == pPosto.ID.ToString());
     carregaListaAbastecimento(xmlLista);
     return _lista;
 }
Exemplo n.º 5
0
        private void carregaLista(IEnumerable<XElement> pXmlLista)
        {
            criarLista();
            Posto posto;
            foreach (XElement xmlPosto in pXmlLista)
            {
                posto = new Posto();
                posto.ID = Int32.Parse(xmlPosto.Attribute("id").Value);
                posto.nome = xmlPosto.Element("nome").Value;
                posto.bairro = xmlPosto.Element("bairro").Value;
                posto.cidade = xmlPosto.Element("cidade").Value;
                posto.uf = xmlPosto.Element("uf").Value;
                _lista.Add(posto);
            }

        }