Exemple #1
0
        private void btnBuscar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string tipo  = cbxTipoBusqueda.Text;
                string valor = txtBusqueda.Text.ToUpper();

                dgDatos.ItemsSource = null;
                DataTable        dt           = new DataTable();
                CategoriaNEG     categoriaNEG = new CategoriaNEG();
                List <CATEGORIA> lista        = categoriaNEG.FiltrarCategoria(valor);
                dt.Columns.Add("ID");
                dt.Columns.Add("NOMBRE");
                dt.Columns.Add("FECHA_CREACION");
                dt.Columns.Add("FECHA_ACTUALIZACION");
                if (lista.Count > 0)
                {
                    foreach (var x in lista)
                    {
                        dt.Rows.Add(x.ID, x.NOMBRE, x.FECHA_CREACION, x.FECHA_ULTIMO_UPDATE);
                    }
                }
                else
                {
                    MessageBox.Show("No existen datos registrados para los filtros indicados");
                }
                dgDatos.ItemsSource = dt.DefaultView;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemple #2
0
        public void CargarTabla()
        {
            dgDatos.ItemsSource = null;
            DataTable    dt           = new DataTable();
            CategoriaNEG categoriaNEG = new CategoriaNEG();

            try
            {
                List <CATEGORIA> lista = categoriaNEG.ListarCategorias();
                dt.Columns.Add("ID");
                dt.Columns.Add("NOMBRE");
                dt.Columns.Add("FECHA_CREACION");
                dt.Columns.Add("FECHA_ACTUALIZACION");
                if (lista.Count > 0)
                {
                    foreach (var x in lista)
                    {
                        dt.Rows.Add(x.ID, x.NOMBRE, x.FECHA_CREACION, x.FECHA_ULTIMO_UPDATE);
                    }
                }
                dgDatos.ItemsSource = dt.DefaultView;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemple #3
0
        public void CargarCombos()
        {
            SucursalNEG      sucursalNEG      = new SucursalNEG();
            ProveedoresNEG   proveedoresNEG   = new ProveedoresNEG();
            CategoriaNEG     categoriaNEG     = new CategoriaNEG();
            Tipos_EstadosNEG tipos_EstadosNEG = new Tipos_EstadosNEG();
            MarcaNEG         marcaNEG         = new MarcaNEG();

            cbxTipoProducto.IsEnabled = false;

            try
            {
                List <SUCURSAL> listaSucursal = sucursalNEG.ListarSucuralesActivas();
                if (listaSucursal.Count > 0)
                {
                    cbxSucursal.ItemsSource       = listaSucursal;
                    cbxSucursal.DisplayMemberPath = "NOMBRE";
                    cbxSucursal.SelectedValuePath = "ID";
                }

                List <ProveedoresVIEW> listaProveedor = proveedoresNEG.ListarTodosProveedores();
                if (listaProveedor.Count > 0)
                {
                    cbxProveedor.ItemsSource       = listaProveedor;
                    cbxProveedor.DisplayMemberPath = "NOMBRE_EMPRESA";
                    cbxProveedor.SelectedValuePath = "ID";
                }

                List <CATEGORIA> listaCategoria = categoriaNEG.ListarCategorias();
                if (listaCategoria.Count > 0)
                {
                    cbxCategoria.ItemsSource       = listaCategoria;
                    cbxCategoria.DisplayMemberPath = "NOMBRE";
                    cbxCategoria.SelectedValuePath = "ID";
                }

                List <ESTADO_PRODUCTO> listaEProductos = tipos_EstadosNEG.ListarEProductos();
                if (listaEProductos.Count > 0)
                {
                    cbxEstado.ItemsSource       = listaEProductos;
                    cbxEstado.DisplayMemberPath = "NOMBRE";
                    cbxEstado.SelectedValuePath = "ID";
                }

                List <MARCA> listaMarca = marcaNEG.ListarMarcas();
                if (listaMarca.Count > 0)
                {
                    cbxMarca.ItemsSource       = listaMarca;
                    cbxMarca.DisplayMemberPath = "NOMBRE";
                    cbxMarca.SelectedValuePath = "ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemple #4
0
        private void dgDatos_MouseDoubleClick(object sender, EventArgs e)
        {
            DataRowView  dr           = dgDatos.SelectedItem as DataRowView;
            DataRow      dr1          = dr.Row;
            int          id           = Convert.ToInt32(dr1.ItemArray[0]);
            CategoriaNEG categoriaNEG = new CategoriaNEG();
            var          datos        = categoriaNEG.CargarCategoria(id);

            txtNombre.Text = datos.NOMBRE;
            lblId.Content  = datos.ID;
        }
        private void CargarCombos()
        {
            SucursalNEG  sucursalNEG  = new SucursalNEG();
            CategoriaNEG categoriaNEG = new CategoriaNEG();
            MarcaNEG     marcaNEG     = new MarcaNEG();
            ProductosNEG productosNEG = new ProductosNEG();

            cbxTipoProducto.IsEnabled = false;

            try
            {
                txtNombreSucursal.Text = sucursalNEG.CargarSucursal(sucursal).NOMBRE;

                List <CATEGORIA> listaCategoria = categoriaNEG.ListarCategorias();
                if (listaCategoria.Count > 0)
                {
                    cbxCategoria.ItemsSource       = listaCategoria;
                    cbxCategoria.DisplayMemberPath = "NOMBRE";
                    cbxCategoria.SelectedValuePath = "ID";
                }

                List <MARCA> listaMarca = marcaNEG.ListarMarcas();
                if (listaMarca.Count > 0)
                {
                    cbxMarca.ItemsSource       = listaMarca;
                    cbxMarca.DisplayMemberPath = "NOMBRE";
                    cbxMarca.SelectedValuePath = "ID";
                }

                List <ProductosVIEW> listaProductos = productosNEG.ListarTodosProductosSucursal(sucursal);
                if (listaProductos.Count > 0)
                {
                    cbxProducto.ItemsSource       = listaProductos;
                    cbxProducto.DisplayMemberPath = "NOMBRE";
                    cbxProducto.SelectedValuePath = "ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }
Exemple #6
0
 private void btnCrear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         CategoriaNEG categoriaNEG = new CategoriaNEG();
         string       nombre       = txtNombre.Text.ToUpper();
         string       respuesta    = categoriaNEG.CrearCategoria(nombre);
         if (respuesta == "creado")
         {
             LimpiarFormulario();
             MessageBox.Show("Los datos fueron ingresados satisfactoriamente");
         }
         else
         {
             MessageBox.Show(respuesta);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
     }
 }
Exemple #7
0
 private void btnModificar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         CategoriaNEG categoriaNEG = new CategoriaNEG();
         string       nombre       = txtNombre.Text.ToUpper();
         int          id           = int.Parse(lblId.Content.ToString());
         string       respuesta    = categoriaNEG.ActualizarCategoria(nombre, id);
         if (respuesta == "actualizado")
         {
             LimpiarFormulario();
             MessageBox.Show("Los datos fueron actualizados satisfactoriamente");
         }
         else
         {
             MessageBox.Show(respuesta);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
     }
 }
Exemple #8
0
        public void CargarTabla()
        {
            dgDatos.ItemsSource = null;
            DataTable       dt = new DataTable();
            TipoProductoNEG tipoProductoNEG = new TipoProductoNEG();

            CategoriaNEG categoriaNEG = new CategoriaNEG();

            try
            {
                List <TIPO_PRODUCTO> lista = tipoProductoNEG.ListarTProductos();
                dt.Columns.Add("ID");
                dt.Columns.Add("NOMBRE");
                dt.Columns.Add("COD CATEGORIA");
                if (lista.Count > 0)
                {
                    foreach (var x in lista)
                    {
                        dt.Rows.Add(x.ID, x.NOMBRE, x.CATEGORIA_ID);
                    }
                }
                dgDatos.ItemsSource = dt.DefaultView;

                List <CATEGORIA> listaCategoria = categoriaNEG.ListarCategorias();
                if (listaCategoria.Count > 0)
                {
                    cbxCategoria.ItemsSource       = listaCategoria;
                    cbxCategoria.DisplayMemberPath = "NOMBRE";
                    cbxCategoria.SelectedValuePath = "ID";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:\n" + ex.TargetSite + "\n" + ex.Message.ToString());
            }
        }