예제 #1
0
 private void _vista_UsuarioDeseaCrearPiloto(object sender, PilotoArgumento e)
 {
     try
     {
         var op = PilotoServicio.CrearPiloto(e);
         if (op.Resultado == ResultadoOperacionTipo.Error)
         {
             throw new Exception(op.Mensaje);
         }
         _vista.Piloto.PILOT_CODE      = int.Parse(op.DbData);
         _vista.Piloto.LAST_UPDATE     = DateTime.Now;
         e.Piloto.PILOT_CODE           = _vista.Piloto.PILOT_CODE;
         e.UsuarioPorPiloto.PILOT_CODE = _vista.Piloto.PILOT_CODE;
         if (VieneUsuarioParaAsociarAlPiloto(e.UsuarioPorPiloto))
         {
             _vista_UsuarioDeseaAsociarPilotoAUsuarioDelSistema(sender, e);
         }
         _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
             Piloto = new Piloto()
         });
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }
 private void _vista_UsuarioDeseaGrabarPiloto(object sender, PaseDeSalidaArgumento e)
 {
     try
     {
         var op = InsertarRegistro(e.Piloto.PILOT_CODE) ? PilotoServicio.CrearPiloto(new PilotoArgumento {
             Piloto = e.Piloto
         }) : PilotoServicio.ActualizarPiloto(new PilotoArgumento {
             Piloto = e.Piloto
         });
         if (op.Resultado == ResultadoOperacionTipo.Exito)
         {
             _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
                 Piloto = new Piloto()
             });
             var codigoPiloto = InsertarRegistro(e.Piloto.PILOT_CODE) ? int.Parse(op.DbData): e.Piloto.PILOT_CODE;
             _vista.TerminoDeGrabarPiloto(codigoPiloto);
         }
         else
         {
             InteraccionConUsuarioServicio.MensajeErrorDialogo($"Error al crear o actualizar el vehículo: {op.Resultado}");
         }
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo($"Error al obtener los vehículos: {ex.Message}");
     }
 }
예제 #3
0
        private void _vista_UsuarioDeseaActualizarPiloto(object sender, PilotoArgumento e)
        {
            try
            {
                var op = PilotoServicio.ActualizarPiloto(e);
                if (op.Resultado == ResultadoOperacionTipo.Error)
                {
                    throw new Exception(op.Mensaje);
                }

                if (VieneUsuarioParaAsociarAlPiloto(e.UsuarioPorPiloto))
                {
                    op = PilotoServicio.DesasociarPilotoDeUsuarioDelSistema(e);
                    if (op.Resultado == ResultadoOperacionTipo.Error)
                    {
                        throw new Exception(op.Mensaje);
                    }
                    _vista_UsuarioDeseaAsociarPilotoAUsuarioDelSistema(sender, e);
                }

                _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
                    Piloto = new Piloto()
                });
            }
            catch (Exception exception)
            {
                InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
            }
        }
 private void _vista_VistaCargandosePorPrimeraVez(object sender, EventArgs e)
 {
     try
     {
         _vista.Parametros = new List <Parametro>();
         _vista.Clientes   = ClienteServicio.ObtenerClientes();
         _vista.Vehiculos  = VehiculoServicio.ObtenerVehiculos(new VehiculoArgumento {
             Vehiculo = new Vehiculo()
         });
         _vista.Bodegas = BodegaServicio.ObtenerBodegaAsignadaAUsuario(InteraccionConUsuarioServicio.ObtenerUsuario());
         _vista.UsuariosParaAutorizar = UsuarioServicio.ObtenerUsuariosActivosPorCentroDeDistribucion(InteraccionConUsuarioServicio.ObtenerCentroDistribucion());
         _vista.UsuariosParaEntrega   = UsuarioServicio.ObtenerUsuariosActivosPorCentroDeDistribucion(InteraccionConUsuarioServicio.ObtenerCentroDistribucion());
         ObtenerParametros();
         _vista.SoloVehiculos = VehiculoServicio.ObtenerVehiculos(new VehiculoArgumento {
             Vehiculo = new Vehiculo()
         });
         _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
             Piloto = new Piloto()
         });
         _vista.DespachosDetalles = new List <DemandaDespachoDetalle>();
         _vista.PaseDeSalidas     = new List <PaseDeSalida>();
         ObtenerTiposDeSalida();
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(ex.Message);
     }
 }
예제 #5
0
 private void _vista_UsuarioDeseaObtenerPilotosNoAsociadosAVehiculos(object sender, Argumentos.PilotoArgumento e)
 {
     try
     {
         _vista.Pilotos = PilotoServicio.ObtenerPilotosNoAsociadosAVehiculos(e);
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }
예제 #6
0
 private void _vista_UsuarioDeseaObtenerPilotoPorVehiculo(object sender, PilotoArgumento e)
 {
     try
     {
         _vista.Piloto = PilotoServicio.ObtenerPilotoPorVehiculo(e);
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.Mensaje(ex.Message + ex.StackTrace);
     }
 }
 private void _vista_UsuarioDeseaObtenerPilotos(object sender, PaseDeSalidaArgumento e)
 {
     try
     {
         _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
             Piloto = new Piloto()
         });
     }
     catch (Exception ex)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo($"Error al obtener los vehículos: {ex.Message}");
     }
 }
 private void _vista_UsuarioDeseaObtenerPilotos(object sender, EventArgs e)
 {
     try
     {
         _vista.Pilotos = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
             Piloto = new Piloto()
         });
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }
 private void _vista_VistaCargandosePorPrimeraVez(object sender, EventArgs e)
 {
     try
     {
         _vista.Pilotos       = PilotoServicio.ObtenerPilotos();
         _vista.Rutas         = RutaServicio.ObtnerRutas();
         _vista.Vehiculos     = VehiculoServicio.ObtenerVehiculos();
         _vista.PlantillaDocs = ManifiestoServicio.GenerarColumnasParaTemplate();
     }
     catch (Exception ex)
     {
         _vista.EstablecerError(ex.Message, sender);
     }
 }
예제 #10
0
 private void _vista_UsuarioDeseaDesasociarPilotoDeUsuarioDelSistema(object sender, PilotoArgumento e)
 {
     try
     {
         var op = PilotoServicio.DesasociarPilotoDeUsuarioDelSistema(e);
         if (op.Resultado == ResultadoOperacionTipo.Error)
         {
             throw new Exception(op.Mensaje);
         }
         _vista_VistaCargandosePorPrimeraVez(sender, e);
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }
예제 #11
0
 private void _vista_VistaCargandosePorPrimeraVez(object sender, EventArgs e)
 {
     try
     {
         _vista.Piloto = new Piloto();
         //_vista.UsuariosPorRol = new List<Usuario>();
         _vista.UsuariosExternos = new List <Usuario>();
         _vista.Pilotos          = PilotoServicio.ObtenerPilotos(new PilotoArgumento {
             Piloto = new Piloto()
         });
         _vista.RolesDeUsuario = UsuarioServicio.ObtenerRolesDeUsuario();
         ObtenerParametros();
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }
예제 #12
0
 private void _vista_VistaCargandosePorPrimeraVez(object sender, EventArgs e)
 {
     try
     {
         _vista.Vehiculo  = new Vehiculo();
         _vista.Vehiculos = VehiculoServicio.ObtenerVehiculos(new VehiculoArgumento {
             Vehiculo = new Vehiculo()
         });
         _vista.Pilotos = PilotoServicio.ObtenerPilotosNoAsociadosAVehiculos(new PilotoArgumento {
             Piloto = new Piloto()
         });
         _vista.EmpresasDeTransporte =
             EmpresaDeTransporteServicio.ObtenerEmpresasDeTransporte(new EmpresaDeTransporteArgumento
         {
             EmpresaDeTransporte = new EmpresaDeTransporte()
         });
         _vista.PolizasDeSeguro = PolizaServicio.ObtenerTodasLasPolizasDeSeguro();
         ObtenerParametros();
     }
     catch (Exception exception)
     {
         InteraccionConUsuarioServicio.MensajeErrorDialogo(exception.Message);
     }
 }