protected void btnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         dc = new Negocio.ProductoNegocio();
         Entidad.Productos producto = null;
         producto                = (Entidad.Productos)Session["ObjetoProducto"];
         producto.Descripcion    = txtDescripcion.Text.Trim().ToUpper();
         producto.Existencia     = int.Parse(txtExistencia.Text.Trim());
         producto.PrecioUnitario = decimal.Parse(txtPrecioUnitario.Text.Trim());
         producto.Estado         = 1;
         producto.FechaProceso   = DateTime.Now;
         producto.UsuarioProceso = 0;
         if (dc.EditaProductoNegocio(producto) > 0)
         {
             txtDescripcion.Text    = ""; txtDescripcion.ReadOnly = true; rfvDescripcion.Enabled = false;
             txtExistencia.Text     = "";  txtExistencia.ReadOnly = true; rfvExistencia.Enabled = false;
             txtPrecioUnitario.Text = ""; txtPrecioUnitario.ReadOnly = true; rfvPrecioUnitario.Enabled = false;
             btnGuardar.Visible     = false; btnGuardar.Enabled = false; btnCancelar.Text = "Volver";
             cvMensaje.IsValid      = false;
             cvMensaje.ErrorMessage = "EL PRODUCTO " + producto.Descripcion + " FUE EDITADO CORRECTAMENTE";
         }
         else
         {
             throw new Exception("OCURRIO UN EEROR AL EDITAR EL ELEMENTO " + producto.Descripcion);
         }
     }
     catch (Exception excepcion)
     {
         cvMensaje.IsValid      = false;
         cvMensaje.ErrorMessage = "ERROR: " + excepcion.Message;
     }
 }
Example #2
0
 public void CargaProductos()
 {
     dc = new Negocio.ProductoNegocio();
     try
     {
         gvProductos.DataSource = dc.RetornaListaProductosNegocio();
         gvProductos.DataBind();
     }
     catch (Exception excepcion)
     {
         cvMensaje.IsValid      = false;
         cvMensaje.ErrorMessage = "ERROR: " + excepcion.Message;
     }
 }
        private void CargaProductos()
        {
            try
            {
                Negocio.ProductoNegocio  dc             = new Negocio.ProductoNegocio();
                List <Entidad.Productos> ListaProductos = dc.RetornaListaProductosNegocio();

                rvProductos.LocalReport.ReportEmbeddedResource = "Presentacion.rptProductos.rdlc";
                rvProductos.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("dsProductos", ListaProductos));
                rvProductos.LocalReport.Refresh();
            }
            catch (Exception excepcion)
            {
                cvMensaje.IsValid      = false;
                cvMensaje.ErrorMessage = "ERROR: " + excepcion.Message;
            }
        }
Example #4
0
        protected void gvProductos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            dc = new Negocio.ProductoNegocio();
            string identificador = e.CommandArgument.ToString();

            try
            {
                Entidad.Productos producto = new Entidad.Productos();
                producto.Id = int.Parse(identificador);
                producto    = dc.RetornaProductoNegocio(producto);

                if (e.CommandName == "ELIMINAR")
                {
                    producto.Estado = 0;
                    if (dc.EditaProductoNegocio(producto) > 0)
                    {
                        CargaProductos();
                        cvMensaje.IsValid      = false;
                        cvMensaje.ErrorMessage = "EL ELEMENTO " + producto.Descripcion + " FUE DADO DE BAJA CORRECTAMENTE";
                    }
                    else
                    {
                        throw new Exception("NO SE PUDO DAR DE BAJA EL ELEMENTO " + producto.Descripcion);
                    }
                }
                else
                {
                    /*Codigo para editar*/
                    Session["ObjetoProducto"] = producto;
                    Response.Redirect("wfEditaProductoIndividual");
                }
            }
            catch (Exception excepcion)
            {
                cvMensaje.IsValid      = false;
                cvMensaje.ErrorMessage = "ERROR: " + excepcion.Message;
            }
        }