Beispiel #1
0
        private void Execute_ActualizarCommand()
        {
            RegistrarHistorialView registrarHistorialView = new RegistrarHistorialView(true, CurrentHistorial, ConductoresViewModel.Instance.ListaConductores, UnidadVehicularViewModel.Instance.ListaUnidadesVehiculares);

            registrarHistorialView.ShowDialog();

            if (registrarHistorialView.isUpdated)
            {
                try
                {
                    //Primero se lo paso a la capa negocio para que lo registre, si lo registra, lo pongo en la capa Presentacion
                    if (TransporteDR.HistorialBO.Actualizar(CurrentHistorial))
                    {
                        int id = CurrentHistorial.Id;

                        MessageBox.Show($"{CurrentHistorial.Id} Actualizado con exito");

                        LoadData();

                        CurrentHistorial = ListaHistoriales.FirstOrDefault(x => x.Id == id);
                    }
                    else
                    {
                        registrarHistorialView.ToDefaultHistorial(CurrentHistorial);

                        MessageBox.Show("Algo ha ocurrIdo con el proceso de actualizacion, por favor intentar de nuevo o reiniciar el computador.\nSi el problema persiste, contactar con el encargado del Sistema");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    if (!(ex.InnerException is null))
                    {
                        MessageBox.Show(ex.InnerException.Message);
                    }
                }
            }
        }