Exemplo n.º 1
0
 private void cargarFiltroBusqueda()
 {
     DropDownList1.DataSource     = CategoriaLN.ObtenerTodos();
     DropDownList1.DataValueField = "categoria_id";
     DropDownList1.DataTextField  = "nombreCategoria";
     DropDownList1.DataBind();
 }
Exemplo n.º 2
0
 private void cargarCategorias()
 {
     cboCategorias.DataSource     = CategoriaLN.ObtenerTodos();
     cboCategorias.DataValueField = "categoria_id";
     cboCategorias.DataTextField  = "nombreCategoria";
     cboCategorias.DataBind();
 }
        private void tsbGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                if (LosDatosIngresadosSonCorrectos())
                {
                    CategoriaEN oRegistroEN = InformacionDelRegistro();
                    CategoriaLN oRegistroLN = new CategoriaLN();

                    if (oRegistroLN.ValidarRegistroDuplicado(oRegistroEN, Program.oDatosDeConexion, "AGREGAR"))
                    {
                        MessageBox.Show(oRegistroLN.Error, "Guardar información", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    if (oRegistroLN.Agregar(oRegistroEN, Program.oDatosDeConexion))
                    {
                        txtIdentificador.Text     = oRegistroEN.idCategoria.ToString();
                        ValorLlavePrimariaEntidad = oRegistroEN.idCategoria;

                        EvaluarErrorParaMensajeAPantalla(oRegistroLN.Error, "Guardar");

                        oRegistroEN = null;
                        oRegistroLN = null;

                        this.Cursor = Cursors.Default;

                        if (CerrarVentana == true)
                        {
                            this.Close();
                        }
                        else
                        {
                            OperacionARealizar = "Modificar";
                            ObtenerValoresDeConfiguracion();
                            LlamarMetodoSegunOperacion();
                            EstablecerTituloDeVentana();
                            DeshabilitarControlesSegunOperacionesARealizar();
                        }
                    }
                    else
                    {
                        throw new ArgumentException(oRegistroLN.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Guardar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 4
0
        private void cargarCategorias()
        {
            List <Categoria> arrayEstados = new List <Categoria>();

            arrayEstados = CategoriaLN.ObtenerTodos();

            cboCategorias.DataSource     = arrayEstados;
            cboCategorias.DataTextField  = "nombreCategoria";
            cboCategorias.DataValueField = "categoria_id";
            cboCategorias.DataBind();
        }
Exemplo n.º 5
0
        protected void cmdGuardar_Click(object sender, EventArgs e)
        {
            if (banderaIdentificador == false)
            {
                Categoria categoria = CategoriaLN.SeleccionarCategoria(cboCategorias.SelectedValue);

                guardarProducto("", txtNombreProducto.Text, categoria, txaDescripcion.Text, Convert.ToDouble(txtPrecio.Text), (cboActivo.SelectedValue.Equals("Activo"))? true:false);
            }
            else
            {
                Categoria categoria = CategoriaLN.SeleccionarCategoria(cboCategorias.SelectedValue);

                guardarProducto((!idProducto.Equals("")? idProducto:""), txtNombreProducto.Text, categoria, txaDescripcion.Text, Convert.ToDouble(txtPrecio.Text), (cboActivo.SelectedValue.Equals("Activo")) ? true : false);
            }
        }
        private void LlenarCamposDesdeBaseDatosSegunID()
        {
            this.Cursor = Cursors.WaitCursor;

            CategoriaEN oRegistrosEN = new CategoriaEN();
            CategoriaLN oRegistrosLN = new CategoriaLN();

            oRegistrosEN.idCategoria = ValorLlavePrimariaEntidad;

            if (oRegistrosLN.ListadoPorIdentificador(oRegistrosEN, Program.oDatosDeConexion))
            {
                if (oRegistrosLN.TraerDatos().Rows.Count > 0)
                {
                    DataRow Fila = oRegistrosLN.TraerDatos().Rows[0];
                    txtCategoria.Text   = Fila["Nombre"].ToString();
                    txtDescripcion.Text = Fila["Descripcion"].ToString();

                    oRegistrosEN = null;
                    oRegistrosLN = null;
                }
                else
                {
                    string Mensaje;
                    Mensaje = string.Format("El registro solicitado de {0} no ha sido encontrado."
                                            + "\n\r-----Causas---- "
                                            + "\n\r1. Este registro pudo haber sido eliminado por otro usuario."
                                            + "\n\r2. El listado no está actualizado.", NombreEntidad);

                    MessageBox.Show(Mensaje, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    oRegistrosEN = null;
                    oRegistrosLN = null;

                    this.Close();
                }
            }
            else
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(oRegistrosLN.Error, "Listado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                oRegistrosEN = null;
                oRegistrosLN = null;
            }

            this.Cursor = Cursors.Default;
        }
Exemplo n.º 7
0
        private void LLenarListado()
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                CategoriaEN oRegistrosEN = new CategoriaEN();
                CategoriaLN oRegistrosLN = new CategoriaLN();

                oRegistrosEN.Where = WhereDinamico();

                if (oRegistrosLN.Listado(oRegistrosEN, Program.oDatosDeConexion))
                {
                    dgvLista.Columns.Clear();
                    System.Diagnostics.Debug.Print(oRegistrosLN.TraerDatos().Rows.Count.ToString());

                    if (ActivarFiltros == true)
                    {
                        dgvLista.DataSource = AgregarColumnaSeleccionar(oRegistrosLN.TraerDatos());
                    }
                    else
                    {
                        dgvLista.DataSource = oRegistrosLN.TraerDatos();
                    }

                    FormatearDGV();
                    this.dgvLista.ClearSelection();

                    tsbNoRegistros.Text = "No. Registros: " + oRegistrosLN.TotalRegistros().ToString();
                }
                else
                {
                    throw new ArgumentException(oRegistrosLN.Error);
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Llenar listado de registro en la lista", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 8
0
        private void FrmCRProductosFiltro_Load(object sender, EventArgs e)
        {
            CategoriaLN cat = new CategoriaLN();

            comboBox1.DataSource = cat.getcategorias();

            try
            {
                List <CapaDatos.filtrarVistaProductoResult> lp = OP.ObtenerProductosbycategoria("GOLOSINAS");
                //MessageBox.Show(""+lp.Count);
                foreach (CapaDatos.filtrarVistaProductoResult p in lp)
                {
                    ds.VistaProducto.AddVistaProductoRow(p.IdProducto, p.Categoria, p.NombreProveedor, p.Nombreproducto, p.UnidadMedida, decimal.Parse("" + p.PrecioProveedor), short.Parse("" + p.StockActual), short.Parse("" + p.StockMinimo));
                }

                rpt.SetDataSource(ds);

                crystalReportViewer1.ReportSource = rpt;
            }
            catch (Exception men)
            {
                MessageBox.Show(men.ToString());
            }
        }
        private void tsbEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                if (LosDatosIngresadosSonCorrectos())
                {
                    if (txtIdentificador.Text.Length == 0 || txtIdentificador.Text == "0")
                    {
                        MessageBox.Show("No se puede continuar. Ha ocurrido un error y el registro no ha sido cargado correctamente.", OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }


                    if (MessageBox.Show("¿Está seguro que desea eliminar el registro?", "Eliminar la Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3) == System.Windows.Forms.DialogResult.No)
                    {
                        return;
                    }

                    CategoriaEN oRegistroEN = InformacionDelRegistro();
                    CategoriaLN oRegistroLN = new CategoriaLN();

                    if (oRegistroLN.ValidarSiElRegistroEstaVinculado(oRegistroEN, Program.oDatosDeConexion, "ELIMINAR"))
                    {
                        this.Cursor = Cursors.Default;
                        MessageBox.Show(oRegistroLN.Error, this.OperacionARealizar, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (oRegistroLN.Eliminar(oRegistroEN, Program.oDatosDeConexion))
                    {
                        txtIdentificador.Text     = oRegistroEN.idCategoria.ToString();
                        ValorLlavePrimariaEntidad = oRegistroEN.idCategoria;

                        EvaluarErrorParaMensajeAPantalla(oRegistroLN.Error, "Eliminar");

                        oRegistroEN = null;
                        oRegistroLN = null;

                        this.Cursor = Cursors.Default;

                        if (CerrarVentana == true)
                        {
                            this.Close();
                        }
                    }
                    else
                    {
                        throw new ArgumentException(oRegistroLN.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Eliminar la información del registro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }