コード例 #1
0
        private void ButtonListar_Click(object sender, RoutedEventArgs e)
        {
            ClassLotes Logica = new ClassLotes();

            dataGrid1.ItemsSource  = Logica.ListarLotes();
            buttonEditar.IsEnabled = true;
        }
コード例 #2
0
        private void ButtonGrabar_Click(object sender, RoutedEventArgs e)
        {
            ClassLotes Logica = new ClassLotes();
            string     resp   = Logica.NuevaDescripcion(TextDescripcion.Text, int.Parse(TextCantidad.Text), TextFechaCaducidad.Text, TextFechaProduccion.Text, int.Parse(TextProductos_Id.Text));

            if (resp.ToUpper().Contains("ERROR"))
            {
                MessageBox.Show(resp, "Error al grabar", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show(resp);
                buttonAgregar.Visibility = Visibility.Visible;
                buttonGrabar.Visibility  = Visibility.Hidden;
                buttonListar.IsEnabled   = true;
                buttonCancelar.IsEnabled = false;
            }
        }
コード例 #3
0
 private void ButtonEditar_Click(object sender, RoutedEventArgs e)
 {
     if (TextLotesId.Text != "")
     {
         string     resp   = "";
         ClassLotes Logica = new ClassLotes();
         Lotes      INFO   = new Lotes();
         INFO.Id_Lotes         = Convert.ToInt32(this.TextLotesId.Text);
         INFO.Descripcion      = TextDescripcion.Text;
         INFO.Cantidad         = int.Parse(TextCantidad.Text);
         INFO.Fecha_Caducidad  = DateTime.Parse(TextFechaCaducidad.Text);
         INFO.Fecha_Produccion = DateTime.Parse(TextFechaProduccion.Text);
         INFO.Productos_Id     = Convert.ToInt32(this.TextProductos_Id.Text);
         resp = Logica.ActualizaLotes(INFO);
         MessageBox.Show(resp);
     }
     else
     {
         MessageBox.Show("Marque el registro a modificar", "Error al Editar",
                         MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
     }
 }