コード例 #1
0
        private void AñadirButton_Click(object sender, RoutedEventArgs e)
        {
            if (int.Parse(CantidadJuegosTextBox.Text) < 1)
            {
                CantidadJuegosTextBox.Text = "1";
                MessageBox.Show("La cantidad minima es 1", "Error de cantidad", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (AmigoComboBox.Text.Length != 0 && CantidadJuegosTextBox.Text.Length != 0 && ObsevacionTextBox.Text.Length != 0 && JuegoIdComboBox.Text.Length != 0)
            {
                var remover = JuegosBLL.Buscar(JuegoIdComboBox.SelectedIndex + 1);
                JuegosBLL.Salida(remover, int.Parse(CantidadJuegosTextBox.Text));
                if (remover.Existencias >= 0)
                {
                    JuegosBLL.Guardar(remover);
                    Prestamo.Detalles.Add(new PrestamosDetalle(Prestamo.PrestamoId, JuegoIdComboBox.SelectedIndex + 1, int.Parse(CantidadJuegosTextBox.Text), AmigoComboBox.Text, JuegoIdComboBox.Text));

                    Cargar();
                    CantidadJuegosTextBox.Text = "0";
                    JuegoIdComboBox.Text       = string.Empty;
                    AmigoComboBox.Text         = string.Empty;
                }
                else
                {
                    MessageBox.Show("Se ha agotado las existencias del juego: " + remover.Descripcion, "Sin existencias", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
コード例 #2
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            var ingreso = JuegosBLL.Buscar(JuegoIdComboBox.SelectedIndex + 1);

            JuegosBLL.Salida(ingreso, int.Parse(CantidadTextBox.Text));
            if (EntradasBLL.Eliminar(int.Parse(EntradaIdTextBox.Text)))
            {
                Refrescar();
                MessageBox.Show("Datos Eliminados", "Completo", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("No se pudo Eliminar los datos", "Incompleto", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Refrescar();
        }