示例#1
0
        private void DestinosForm_Load(object sender, EventArgs e)
        {
            DatosTransporte datosTransporte = DatosTransporte.AbrirDatosTransporte();

            this.transporteComboBox.DataSource    = datosTransporte.ObtenerListadoDeTransporte();
            this.transporteComboBox.DisplayMember = "Transporte";
            this.transporteComboBox.ValueMember   = "ID";
            this.misDatos = DatosDestino.AbrirDatosDestino();
            this.editarLinkLabel.Enabled      = false;
            this.inhabilitarLinkLabel.Enabled = false;
            this.habilitarCheckBox.Visible    = false;
            this.CargaListaEnGrillaDeDatos();
            this.estadoGrabacion = TipoGrabacion.None;
            this.ActivarListado();
        }
        private void CargarLista()
        {
            DatosDestino mysDatosDestino = DatosDestino.AbrirDatosDestino();
            DataTable    myDataTable     = mysDatosDestino.ObtenerListadoDeDestinosParaSeleccion();

            this.listadoListView.Items.Clear();
            if (myDataTable.Rows.Count.Equals(0))
            {
                return;
            }
            myDataTable.Columns.Cast <DataColumn>().ToList().ForEach(column => this.listadoListView.Columns.Add(column.Caption));
            myDataTable.AsEnumerable().ToList().ForEach(row =>
            {
                ListViewItem item = new ListViewItem(Convert.ToString(row[0]));
                item.Checked      = (this.IdList.Contains(int.Parse(row[0].ToString()))?true:false);
                row.ItemArray.ToList().Skip(1).ToList().ForEach(value =>
                                                                item.SubItems.Add(Convert.ToString(value)));
                listadoListView.Items.Add(item);
            });
            if (this.listadoListView.Items.Count > 0)
            {
                this.listadoListView.Items[0].Selected = true;
            }
        }