Ejemplo n.º 1
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Actualizar == false)
            {
                try
                {
                    //le damos el valor correspondiente a los objetos de indentidad
                    entidad.Producto     = txtNombreProducto.Text;
                    entidad.PrecioCompra = Convert.ToDecimal(txtPrecioCompra.Text);
                    entidad.PrecioVenta  = Convert.ToDecimal(txtPrecioVenta.Text);
                    entidad.Stock        = Convert.ToInt32(txtStock.Text);
                    entidad.IdCategoria  = Convert.ToInt32(cmbCategoria.SelectedValue);
                    entidad.IdMarca      = Convert.ToInt32(cmbMarca.SelectedValue);

                    negocio.CrearProducto(entidad);
                    frmConfirmacion = new FrmSuccess("PRODUCTO GUARDADO!");
                    frmConfirmacion.ShowDialog();

                    Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se logro guardar el registro. " + ex.Message);
                }
            }
            if (Actualizar == true)
            {
                try
                {
                    entidad.IdProducto   = Convert.ToInt32(txtIdProducto.Text);
                    entidad.Producto     = txtNombreProducto.Text;
                    entidad.PrecioCompra = Convert.ToDecimal(txtPrecioCompra.Text);
                    entidad.PrecioVenta  = Convert.ToDecimal(txtPrecioVenta.Text);
                    entidad.Stock        = Convert.ToInt32(txtStock.Text);
                    entidad.IdCategoria  = Convert.ToInt32(cmbCategoria.SelectedValue);
                    entidad.IdMarca      = Convert.ToInt32(cmbMarca.SelectedValue);

                    negocio.ActualizarProducto(entidad);
                    frmConfirmacion = new FrmSuccess("PRODUCTO ACTUALIZADO!");
                    frmConfirmacion.ShowDialog();
                    Close();
                    Actualizar = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se logro actualizar el registro. " + ex.Message);
                }
            }
        }
        public static void mensajeConfirmacion(string mensaje)
        {
            FrmSuccess formConfirmacion = new FrmSuccess(mensaje);

            formConfirmacion.ShowDialog();
        }
Ejemplo n.º 3
0
        public static void ConfirmacionForm(string mensaje)
        {
            FrmSuccess frm = new FrmSuccess(mensaje);

            frm.ShowDialog();
        }