Exemplo n.º 1
0
        public List <GetJourneysDTO> GetJourneys()
        {
            List <GetJourneysDTO> res = new List <GetJourneysDTO>();

            SqlConnection cnx = new SqlConnection(cnx_str);
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection  = cnx;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "[read].GetJourneys";

            cnx.Open();

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                GetJourneysDTO _item = new GetJourneysDTO()
                {
                    idJourney           = Int64.Parse(reader["idJourney"].ToString()),
                    dtInicio            = DateTime.Parse(reader["dtInicio"].ToString()),
                    numObjetos          = int.Parse(reader["numObjetos"].ToString()),
                    numCoordenadasTotal = Int64.Parse(reader["numCoordenadasTotal"].ToString())
                };

                res.Add(_item);
            }

            reader.Close();

            cnx.Close();

            return(res);
        }
Exemplo n.º 2
0
        private void lstTrayectos_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstTrayectos.SelectedItems.Count == 1)
            {
                foreach (ListViewItem lstIt in lstTrayectos.Items)
                {
                    lstIt.ForeColor = Color.Black;
                }

                SelectedJourney = (GetJourneysDTO)lstTrayectos.SelectedItems[0].Tag;
                lstTrayectos.SelectedItems[0].ForeColor = Color.Red;

                GetObjetos(SelectedJourney.idJourney);

                lstTrayectos.SelectedIndices.Clear();
            }
        }