Exemple #1
0
        private void UiListaPiloto_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                UiVistaVehiculos.Focus();
                if (BotonSeleccionadoNoTieneEtiqueta(e))
                {
                    return;
                }
                switch (e.Button.Tag.ToString())
                {
                case "UiBotonRefrescarListaEmpresas":
                    UsuarioDeseaObtenerEmpresasDeTransporte?.Invoke(null, new EmpresaDeTransporteArgumento {
                        EmpresaDeTransporte = new EmpresaDeTransporte()
                    });
                    break;

                case "UiBotonRefrescarListaPilotos":
                    var piloto = new Piloto();

                    if (ExisteRegistro(Vehiculo.VEHICLE_CODE))
                    {
                        var firstOrDefault = Vehiculos.ToList().FirstOrDefault(v => v.VEHICLE_CODE == Vehiculo.VEHICLE_CODE);
                        if (firstOrDefault != null)
                        {
                            piloto.PILOT_CODE = firstOrDefault.PILOT_CODE;
                        }
                    }

                    UsuarioDeseaObtenerPilotosNoAsociadosAVehiculos?.Invoke(null, new PilotoArgumento {
                        Piloto = piloto
                    });
                    break;

                case "UiBotonRefrescarPolizas":
                    UsuarioDeseaObtenerPolizas?.Invoke(null, new VehiculoArgumento());
                    break;
                }
            }
            catch (Exception ex)
            {
                InteraccionConUsuarioServicio.Alerta(ex.Message);
            }
        }
Exemple #2
0
        private void UiGridVistaVehiculos_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                if (!TieneSeleccionadoUnaFilaEnLaVista(UiGridVistaVehiculos))
                {
                    return;
                }

                Vehiculo = ((Vehiculo)ObtenerFilaSelecciondaDeLaVista(UiGridVistaVehiculos)).ShallowCopy();
                var piloto = new Piloto {
                    PILOT_CODE = Vehiculo.PILOT_CODE
                };
                UsuarioDeseaObtenerPilotosNoAsociadosAVehiculos?.Invoke(null, new PilotoArgumento {
                    Piloto = piloto
                });
            }
            catch (Exception ex)
            {
                InteraccionConUsuarioServicio.Alerta(ex.Message);
            }
        }