Ejemplo n.º 1
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtM_Fecha.Text) == false)
            {
                Mensaje("La fecha no es válida");
                return;
            }
            if (txt_Nombre.Text == "")
            {
                Mensaje("Debe ingresar una descripción para continuar");
                return;
            }
            if (txtCodigo.Text == "")
            {
                fun.GuardarNuevoGenerico(this, "Articulo");
            }
            else
            {
                // if (txt_Ruta.Text != "")
                //   txt_Ruta.Text = txt_Ruta.Text.Replace("\\", "\\\\");
                fun.ModificarGenerico(this, "Articulo", "CodArticulo", txtCodigo.Text);
            }

            Mensaje("Datos grabados correctamente");
            if (txt_Ruta.Text != "")
            {
                Imagen.Image.Save(txt_Ruta.Text);
            }

            if (txt_CodigoBarra.Text != "")
            {
                var result = MessageBox.Show("Desea Imprimir", "Información",
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    cCodigoBarra objCodBarra = new cCodigoBarra();
                    objCodBarra.Insertar(ImagenCodigo, 1, 2);
                    FrmVerReporteBarra frm = new FrmVerReporteBarra();
                    frm.Show();
                }
            }

            Botonera(1);
            fun.LimpiarGenerico(this);
            Imagen.Image       = null;
            ImagenCodigo.Image = null;
            txtCodigo.Text     = "";
            Grupo.Enabled      = false;
        }
Ejemplo n.º 2
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (txtDescripcion.Text == "")
            {
                Mensaje("Ingresar descripcion");
                return;
            }
            string       Nombre        = txtDescripcion.Text;
            Double?      Costo         = null;
            Double?      Precio        = null;
            int?         CodColor      = null;
            string       Ruta          = txtRuta.Text;
            int?         CodTipoPrenda = null;
            string       CodigoBarra   = null;
            cArticulo    art           = new Clases.cArticulo();
            cCodigoBarra objCodBarra   = new cCodigoBarra();

            if (txtPrecioVenta.Text != "")
            {
                Precio = Convert.ToDouble(txtPrecioVenta.Text);
            }
            if (cmbColor.SelectedIndex > 0)
            {
                CodColor = Convert.ToInt32(cmbColor.SelectedValue);
            }
            if (CmbTipoPrenda.SelectedIndex > 0)
            {
                CodTipoPrenda = Convert.ToInt32(CmbTipoPrenda.SelectedValue);
            }

            CodigoBarra = txtCodigoBarra.Text;
            art.Insertar(Nombre, Costo, Precio, CodColor, Ruta, CodTipoPrenda, CodigoBarra);
            if (txtCodigoBarra.Text != "")
            {
                objCodBarra.Insertar(ImagenCodigo, 1, 2);
            }
            Mensaje("Datos grabados correctamente");
            Limpiar();
        }