Exemple #1
0
        private void btnguardarproducto_Click(object sender, EventArgs e)
        {
            try
            {
                Producto objproducto = new Producto();
                objproducto.nombre = txtnombre.Text;
                objproducto.marca  = txtmarca.Text;
                objproducto.precio = float.Parse(txtprecio.Text);

                if (lN.insertarProducto(objproducto) > 0)
                {
                    MessageBox.Show("Agregado con exito!");
                    txtnombre.Text = "";
                    txtmarca.Text  = "";
                    txtprecio.Text = "";
                }
                else
                {
                    MessageBox.Show("Error al agregar producto");
                }
            }
            catch
            {
                MessageBox.Show("Errorrrrrr");
            }
        }
Exemple #2
0
        private void btnguardarpr_Click_1(object sender, EventArgs e)
        {
            try
            {
                producto objProducto = new producto();
                objProducto.descripcion = txtdescripcion.Text;


                if (lN.insertarProducto(objProducto) > 0)
                {
                    MessageBox.Show("Agregado con éxito!");
                    txtdescripcion.Text    = "";
                    tcproducto.SelectedTab = tpdetalle;
                }

                else
                {
                    MessageBox.Show("Error al agregar producto");
                }
            }
            catch
            {
                MessageBox.Show("Errorrrrrrr");
            }
        }
Exemple #3
0
        private void btGuardar_Click(object sender, EventArgs e)
        {
            logicaNegocioProducto lN = new logicaNegocioProducto();

            try
            {
                producto objProductos = new producto();
                objProductos.descripcion = txtdescripcion.Text;


                if (lN.insertarProducto(objProductos) > 0)
                {
                    MessageBox.Show("Agregado con éxito!");
                    txtdescripcion.Text = "";
                }

                else
                {
                    MessageBox.Show("Error al agregar proveedor");
                }
            }
            catch
            {
                MessageBox.Show("Errorrrrrrr");
            }
        }
Exemple #4
0
        private void btGuardar_Click_1(object sender, EventArgs e)
        {
            logicaNegocioProducto lN = new logicaNegocioProducto();
            producto objProducto     = new producto();

            try
            {
                if (btnguardarpr.Text == "Guardar")
                {
                    objProducto.descripcion = txtdescripcion.Text;


                    if (lN.insertarProducto(objProducto) > 0)
                    {
                        MessageBox.Show("Agregado con exito!");
                        dgvproducto.DataSource = lN.ListarProductos();
                        txtdescripcion.Text    = "";
                        tcproducto.SelectedTab = tpdetalle;
                        dgvproducto.Visible    = true;
                    }
                    else
                    {
                        MessageBox.Show("Error al agregar producto");
                    }
                }
                if (btnguardarpr.Text == "Actualizar")
                {
                    objProducto.id_producto = Convert.ToInt32(txtid.Text);
                    objProducto.descripcion = txtdescripcion.Text;
                }

                if (lN.EditarProducto(objProducto) > 0)
                {
                    MessageBox.Show("Actualizado con exito");
                    dgvproducto.DataSource = lN.ListarProductos();
                    txtdescripcion.Text    = "";
                    tcproducto.SelectedTab = tpdetalle;
                }
                else
                {
                    MessageBox.Show("Error al actualizar producto");
                }

                btnguardarpr.Text = "Guardar";
            }

            catch
            {
                MessageBox.Show("Errorrrrrr!");
            }
        }
Exemple #5
0
        private void buttonGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                if (buttonGuardar.Text == "Guardar")
                {
                    Producto objetoProducto = new Producto();
                    //objetoRecurso.idrecursos = Convert.ToInt32(textBoxId.Text);
                    objetoProducto.Nombre      = textBoxNombre.Text;
                    objetoProducto.Colores     = textBoxColores.Text;
                    objetoProducto.Descripcion = textBoxDescripcion.Text;
                    objetoProducto.Tamaño      = textBoxTamaño.Text;
                    objetoProducto.Precio      = textBoxPrecio.Text;

                    if (logicaNP.insertarProducto(objetoProducto) > 0)
                    {
                        MessageBox.Show("Agregado con éxito");
                        dataGridViewProductos.DataSource = logicaNP.listarProducto();
                        //textBoxId.Text = "";
                        textBoxNombre.Text              = "";
                        textBoxColores.Text             = "";
                        textBoxDescripcion.Text         = "";
                        textBoxTamaño.Text              = "";
                        textBoxPrecio.Text              = "";
                        tabControlProductos.SelectedTab = tabPage2; //Consultar
                    }
                    else
                    {
                        MessageBox.Show("Error al agregar Producto");
                    }
                }
                if (buttonGuardar.Text == "Actualizar")
                {
                    Producto objetoProducto = new Producto();
                    objetoProducto.idProducto  = Convert.ToInt32(textBoxId.Text);
                    objetoProducto.Nombre      = textBoxNombre.Text;
                    objetoProducto.Colores     = textBoxColores.Text;
                    objetoProducto.Descripcion = textBoxDescripcion.Text;
                    objetoProducto.Tamaño      = textBoxTamaño.Text;
                    objetoProducto.Precio      = textBoxPrecio.Text;

                    if (logicaNP.editarProducto(objetoProducto) > 0)
                    {
                        MessageBox.Show("Actualizado con éxito");
                        dataGridViewProductos.DataSource = logicaNP.listarProducto();
                        textBoxNombre.Text              = "";
                        textBoxColores.Text             = "";
                        textBoxDescripcion.Text         = "";
                        textBoxTamaño.Text              = "";
                        textBoxPrecio.Text              = "";
                        tabControlProductos.SelectedTab = tabPage2;
                    }
                    else
                    {
                        MessageBox.Show("Error al actualizar Producto");
                    }
                    buttonGuardar.Text = "Guardar";
                }
            }
            catch
            {
                MessageBox.Show("ERROR");
            }
        }