Ejemplo n.º 1
0
        private void Btn_registro_Click(object sender, RoutedEventArgs e)
        {
            if (txt_Nombre.Text != "")
            {
                Pasaje.Cli_DNI       = Convert.ToInt32(txt_dni.Text);
                Pasaje.Pas_Asiento   = Convert.ToInt32(txt_NumAsiento.Text);
                Pasaje.Pas_Precio    = Convert.ToDecimal(txt_Precio.Text);
                Pasaje.Ser_Codigo    = Convert.ToInt32(txt_Servicio.Text);
                Pasaje.Pas_FechaHora = DateTime.Now;

                ControladorPasaje controladorPasaje = new ControladorPasaje();
                controladorPasaje.Insert_Pasaje(Pasaje);
                MessageBox.Show("Se agrego correctamente el Pasaje");
                if (VentaDePasaje != null)
                {
                    VentaDePasaje.limpiarTodo();
                }
                Close();
                FixedDocs fixedDocs = new FixedDocs();
                fixedDocs.Pasaje = Pasaje;
                fixedDocs.ShowDialog();
            }
            else
            {
                MessageBox.Show("No Cargo el Dni del Cliente Correctamente");
            }
        }
Ejemplo n.º 2
0
        private void Btn_registro_Click(object sender, RoutedEventArgs e)
        {
            if (txt_Nombre.Text != "")
            {
                ClasesBase.Clases.Pasaje pasaje = new ClasesBase.Clases.Pasaje
                {
                    Cli_DNI       = Convert.ToInt32(txt_dni.Text),
                    Pas_Asiento   = Convert.ToInt32(cmb_NumAsiento.SelectedValue.ToString()),
                    Pas_Precio    = Convert.ToDecimal(txt_Precio.Text),
                    Ser_Codigo    = Convert.ToInt32(cmb_Servicio.SelectedValue.ToString()),
                    Pas_FechaHora = DateTime.Now
                };

                ControladorPasaje controladorPasaje = new ControladorPasaje();
                controladorPasaje.Insert_Pasaje(pasaje);
                MessageBox.Show("Se agrego correctamente el Pasaje");
                ventanaPadre.collectionPasaje.insert_Pasaje(pasaje);
                ventanaPadre.CargarDataGrid();
                Close();

                foreach (var p in ventanaPadre.collectionPasaje.ListaPasajes)
                {
                    if (p.Ser_Codigo == Convert.ToInt32(cmb_Servicio.SelectedValue))
                    {
                        pasaje = p;
                    }
                }

                FixedDocs fixedDocs = new FixedDocs();
                fixedDocs.Pasaje = pasaje;
                fixedDocs.ShowDialog();
            }
            else
            {
                MessageBox.Show("No Cargo el Dni del Cliente Correctamente");
            }
        }