Пример #1
0
        private void ButtonListar_Click(object sender, RoutedEventArgs e)
        {
            ClassProductos logica = new ClassProductos();

            dataGrid1.ItemsSource  = logica.ListarProductos();
            buttonEditar.IsEnabled = true;
        }
Пример #2
0
        private void ButtonEditar_Click(object sender, RoutedEventArgs e)
        {
            if (TextProductoId.Text != "")
            {
                string         resp   = "";
                ClassProductos Logica = new ClassProductos();
                Productos      INFO   = new Productos();
                INFO.Productos_Id      = Convert.ToInt32(this.TextProductoId.Text);
                INFO.Nombre_Producto   = TextNombreProducto.Text;
                INFO.Descuento         = float.Parse(TextDescuento.Text);
                INFO.PreciosinDecuento = float.Parse(TextPrecioDesc.Text);
                INFO.Unidad_de_medida  = TextUnidad.Text;
                INFO.Habilitar         = bool.Parse(TextHabilitar.Text);
                INFO.Tipo_Id           = Convert.ToInt32(this.TextTipo.Text);
                resp = Logica.ActualizaProducto(INFO);
                MessageBox.Show(resp);

                /* MessageBox.Show(TextCodigo.Text);
                 * MessageBox.Show(TextDescripcion.Text);
                 * MessageBox.Show(TextVenta.Text);
                 * MessageBox.Show(TextProductos.Text);
                 * MessageBox.Show(TextReportes.Text);*/
            }
            else
            {
                MessageBox.Show("Marque el registro a modificar", "Error al Editar",
                                MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
        }
Пример #3
0
        private void ButtonGrabar_Click(object sender, RoutedEventArgs e)
        {
            ClassProductos Logica = new ClassProductos();
            string         resp   = Logica.Nuevoproducto(TextNombre.Text, Convert.ToInt32(TextUnidades.Text), TextPresentacion.Text, TextDescripcion.Text, Convert.ToInt32(comboBoxCategoria.SelectedValue));

            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;
            }
        }
Пример #4
0
        private void ButtonGrabar_Click(object sender, RoutedEventArgs e)
        {
            ClassProductos Logica = new ClassProductos();
            string         resp   = Logica.NuevoProducto(float.Parse(this.TextDescuento.Text), TextNombreProducto.Text, float.Parse(TextPrecioDesc.Text), TextUnidad.Text, bool.Parse(TextHabilitar.Text), int.Parse(TextTipo.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;
            }
        }
Пример #5
0
 private void ButtonEditar_Click(object sender, RoutedEventArgs e)
 {
     if (TextId.Text != "")
     {
         string         resp   = "";
         ClassProductos logica = new ClassProductos();
         Productos      info   = new Productos();
         info.ProductosID  = Convert.ToInt32(this.TextId.Text);
         info.Nombre       = this.TextNombre.Text;
         info.Unidades     = Convert.ToInt32(this.TextUnidades.Text);
         info.Presentacion = this.TextPresentacion.Text;
         info.Descripcion  = this.TextDescripcion.Text;
         //info.CategoriaProductosID = Convert.ToInt32(this.comboBoxCategoria.SelectedValue);
         resp = logica.Actualizar(info);
         MessageBox.Show(resp);
     }
     else
     {
         MessageBox.Show("Marque el registro a modificar", "Error al editar", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Пример #6
0
        public UserControlFactura()
        {
            InitializeComponent();
            //Cliente
            ClassCliente Logica = new ClassCliente();

            comboBoxCliente.ItemsSource       = Logica.ListarClientes();
            comboBoxCliente.DisplayMemberPath = "Nombre";
            comboBoxCliente.SelectedValuePath = "ClienteID";
            //Empleado
            ClassEmpleado Logica2 = new ClassEmpleado();

            comboBoxEmpleado.ItemsSource       = Logica2.ListarEmpleados();
            comboBoxEmpleado.DisplayMemberPath = "Nombre";
            comboBoxEmpleado.SelectedValuePath = "EmpleadoID";
            //Producto
            ClassProductos Logica3 = new ClassProductos();

            comboBoxProducto.ItemsSource       = Logica3.ListarProductos();
            comboBoxProducto.DisplayMemberPath = "Nombre";
            comboBoxProducto.SelectedValuePath = "ProductosID";
        }