コード例 #1
0
        private void registrarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AreolineaReservaLista myAereolinea = new AreolineaReservaLista();

            myAereolinea.CodigoReserva = int.Parse(txtCodigoReserva.Text);
            myAereolinea.Destino       = cmbDestino.Text;
            myAereolinea.FechaDeViaje  = dtpViaje.Value;
            myAereolinea.ValorTiquete  = decimal.Parse(txtValorTiquete.Text);
            MyAereolinea.Add(myAereolinea);
            dgvLista.DataSource = null;
            dgvLista.DataSource = MyAereolinea.ToList();
        }
コード例 #2
0
        private void eliminarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AreolineaReservaLista myAereolinea = new AreolineaReservaLista();

            if (MyAereolinea.Count != 0)
            {
                foreach (AreolineaReservaLista detail in MyAereolinea)
                {
                    if (detail.CodigoReserva == int.Parse(txtCodigoReserva.Text))
                    {
                        MyAereolinea.Remove(detail);
                    }
                }
            }
            else
            {
                MessageBox.Show("No existen registros");
            }
        }