コード例 #1
0
        private void CalcularButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Validar())
            {
                return;
            }


            Prestamo prestamo = new Prestamo();
            bool     paso     = false;

            if (Convert.ToInt32(PrestamoIdTextBox) == 0)
            {
                paso = PrestamoBLL.Calcular(prestamo);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede modificar Prestamo que no existe", "Fallo");
                    return;
                }
                paso = PrestamoBLL.Modificar(prestamo);
            }

            if (paso)
            {
                Limpiar();
                MessageBox.Show("Guardado!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No fue posible guardar!!", "Exito", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }