コード例 #1
0
ファイル: Ventas.cs プロジェクト: PISIPexistencias/PISIP
        bool ActualizaStock(int codClienteFactura, int stockActualiza)
        {
            bool respuesta = true;

            Clases.Conexion conecta2 = new Clases.Conexion();
            try
            {
                int resultado1 = 0;
                if (conecta2.AbrirConexion() == true)
                {
                    resultado1 = Clases.Producto.ModificarStockProducto(conecta2.conexion, codClienteFactura, stockActualiza);

                    if (resultado1 > 0)
                    {
                        //MessageBox.Show("Registro Ingresado exitosamente","Informacion",MessageBoxButtons.OK,MessageBoxIcon.Information);
                        respuesta = true;
                        conecta2.CerrarConexion();
                    }
                }
                return(respuesta);
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
                conecta2.CerrarConexion();
                respuesta = false;
                return(respuesta);
            }
        }
コード例 #2
0
ファイル: Ventas.cs プロジェクト: PISIPexistencias/PISIP
        bool IngresaDetalle(int codClienteFactura)
        {
            bool respuesta = true;

            Clases.Conexion conectadetalle = new Clases.Conexion();
            try
            {
                int resultado1 = 0;
                if (conectadetalle.AbrirConexion() == true)
                {
                    Clases.DetalleFactura pDetalle = new Clases.DetalleFactura();
                    int j;
                    txtCodFactura.Text = Convert.ToString(Clases.Factura.ObtenerCodigoFactura(conecta.conexion, codClienteFactura));
                    numFilas           = dgvDetalleFactura.Rows.Count;
                    for (j = 0; j < (numFilas - 1); j++)
                    {
                        // detalle factura
                        pDetalle.Codigo_Factura         = Convert.ToInt32(txtCodFactura.Text);
                        pDetalle.Codigo_Producto        = Convert.ToInt32(dgvDetalleFactura[6, j].Value);
                        pDetalle.Secuencial_Detalle     = Convert.ToInt32(dgvDetalleFactura[0, j].Value);
                        pDetalle.Descripcion_Detalle    = Convert.ToString(dgvDetalleFactura[1, j].Value);
                        pDetalle.Cantidad_Detalle       = Convert.ToInt32(dgvDetalleFactura[2, j].Value);
                        pDetalle.PrecioUnitario_Detalle = Convert.ToDouble(dgvDetalleFactura[3, j].Value);
                        pDetalle.Total_Detalle          = Convert.ToDouble(dgvDetalleFactura[4, j].Value);


                        resultado1 = Clases.DetalleFactura.AgregarDetalle(conectadetalle.conexion, pDetalle);

                        if (resultado1 > 0)
                        {
                            if (ActualizaStock(pDetalle.Codigo_Producto, pDetalle.Cantidad_Detalle) == true)
                            {
                                //MessageBox.Show("Registro Ingresado exitosamente", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                respuesta = true;
                            }
                        }
                        else
                        {
                            respuesta = false;
                        }
                    }

                    conectadetalle.CerrarConexion();
                }


                return(respuesta);
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
                conectadetalle.CerrarConexion();
                respuesta = false;
                return(respuesta);
            }
        }
コード例 #3
0
 private void btnbuscar_Click(object sender, EventArgs e)
 {
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaEmpleado(conecta.conexion, txtCedEmpleado.Text, txtApeEmpleado.Text, txtNomEmpleado.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
        private void Registro_Empleados_Load(object sender, EventArgs e)
        {
            txtapellidos.CharacterCasing = CharacterCasing.Upper;
            txtnombres.CharacterCasing   = CharacterCasing.Upper;
            txtcargo.CharacterCasing     = CharacterCasing.Upper;
            try
            {
                if (lblAccion.Text == "I")
                {
                    txtcodigo.Clear();
                    txtcodBodega.Clear();
                    txtsucursal.Clear();
                    txtcedula.Clear();
                    txtapellidos.Clear();
                    txtnombres.Clear();
                    txtcargo.Clear();
                    //txtestado.Clear();
                }
                else if ((lblAccion.Text == "M") || (lblAccion.Text == "E"))
                {
                    if (conecta.AbrirConexion() == true)
                    {
                        EmpleadoSeleccionado = Clases.Empleado.ObtenerEmpleado(conecta.conexion, Convert.ToInt32(txtcodigo.Text));
                        txtcedula.Text       = EmpleadoSeleccionado.Cedula_Empleado;
                        txtcodBodega.Text    = Convert.ToString(EmpleadoSeleccionado.Cod_Bodega);
                        txtsucursal.Text     = EmpleadoSeleccionado.Sucursal_Bodega;
                        txtapellidos.Text    = EmpleadoSeleccionado.Apellidos_Empleado;
                        txtnombres.Text      = EmpleadoSeleccionado.Nombres_Empleado;
                        txtcargo.Text        = EmpleadoSeleccionado.Cargo_Empleado;
                        //txtestado.Text = Convert.ToString( EmpleadoSeleccionado.Estado_empleado);
                        if (EmpleadoSeleccionado.Estado_empleado == 0)
                        {
                            cmbEstado.Text = "Activo";
                        }
                        else
                        {
                            cmbEstado.Text = "Inactivo";
                        }

                        conecta.CerrarConexion();
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
 private void ConsultaProveedor_Load(object sender, EventArgs e)
 {
     txtNomProveedor.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaProveedor(conecta.conexion, txtCodProveedor.Text, txtNomProveedor.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #6
0
 private void Consulta_Producto_Load(object sender, EventArgs e)
 {
     txtNombreProducto.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaProducto(conecta.conexion, txtNombreProducto.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #7
0
 private void Actualizar_proveedor_Load(object sender, EventArgs e)
 {
     txtProveedor.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaProveedor(conecta.conexion, txtRucProveedor.Text, txtProveedor.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #8
0
 private void Consulta_Cliente_Load(object sender, EventArgs e)
 {
     txtApellidoCli.CharacterCasing = CharacterCasing.Upper;
     txtNombreCli.CharacterCasing   = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaCliente(conecta.conexion, txtCedulaCli.Text, txtApellidoCli.Text, txtNombreCli.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #9
0
        private void Registro_Usuario_Load(object sender, EventArgs e)
        {
            txtcodigo.CharacterCasing   = CharacterCasing.Upper;
            txtClaveUsu.CharacterCasing = CharacterCasing.Upper;
            try
            {
                Clases.Usuario pUsuario = new Clases.Usuario();
                pUsuario.CargaRol(conecta.conexion, cmbRol);
                if (lblAccion.Text == "I")
                {
                    txtcodigo.Clear();
                    txtCodEmpleado.Clear();
                    txtApellidoUsu.Clear();
                    txtNombreUsu.Clear();
                    txtClaveUsu.Clear();
                }
                else if ((lblAccion.Text == "M") || (lblAccion.Text == "E"))
                {
                    if (conecta.AbrirConexion() == true)
                    {
                        Usuarioseleccionado = Clases.Usuario.ObtenerUsuario(conecta.conexion, txtcodigo.Text);
                        txtcodigo.Text      = Usuarioseleccionado.Cod_Usuario;
                        txtCodEmpleado.Text = Convert.ToString(Usuarioseleccionado.Cod_Empl_Usuario);
                        txtApellidoUsu.Text = Usuarioseleccionado.Apellido_Empl_Usuario;
                        txtNombreUsu.Text   = Usuarioseleccionado.Nombre_Empl_Usuario;
                        txtClaveUsu.Text    = Usuarioseleccionado.Clave_Usuario;
                        cmbRol.Text         = Usuarioseleccionado.Perfil_Rol_Usuario;

                        if (Usuarioseleccionado.Estado_Usuario == 0)
                        {
                            cmbEstado.Text = "Activo";
                        }
                        else
                        {
                            cmbEstado.Text = "Inactivo";
                        }

                        conecta.CerrarConexion();
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
 private void Actualizar_clientes_Load(object sender, EventArgs e)
 {
     txt_ape_actualizar.CharacterCasing = CharacterCasing.Upper;
     txt_nom_actualizar.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaCliente(conecta.conexion, txt_ced_actualizar.Text, txt_ape_actualizar.Text, txt_nom_actualizar.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #11
0
 private void Registro_proveedor_Load(object sender, EventArgs e)
 {
     txtProveedor.CharacterCasing = CharacterCasing.Upper;
     txtContacto.CharacterCasing  = CharacterCasing.Upper;
     txtDireccion.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (lblAccion.Text == "I")
         {
             txtCodigo.Clear();
             txtRuc.Clear();
             txtProveedor.Clear();
             txtDireccion.Clear();
             txtContacto.Clear();
             txtFono.Clear();
             //txtEstado.Clear();
         }
         else if ((lblAccion.Text == "M") || (lblAccion.Text == "E"))
         {
             if (conecta.AbrirConexion() == true)
             {
                 ProveedorSeleccionado = Clases.Proveedor.ObtenerProveedor(conecta.conexion, Convert.ToInt32(txtCodigo.Text));
                 txtRuc.Text           = ProveedorSeleccionado.Ruc_Proveedor;
                 txtProveedor.Text     = ProveedorSeleccionado.Nombre_Proveedor;
                 txtDireccion.Text     = ProveedorSeleccionado.Direccion_Proveedor;
                 txtFono.Text          = ProveedorSeleccionado.Fono_Proveedor;
                 txtContacto.Text      = ProveedorSeleccionado.Contacto_Proveedor;
                 //txtEstado.Text = Convert.ToString( ProveedorSeleccionado.Estado_Proveedor);
                 if (ProveedorSeleccionado.Estado_Proveedor == 0)
                 {
                     cmbEstado.Text = "Activo";
                 }
                 else
                 {
                     cmbEstado.Text = "Inactivo";
                 }
                 conecta.CerrarConexion();
             }
         }
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #12
0
 private void Actualizar_Usuario_Load(object sender, EventArgs e)
 {
     txtCodUsuario.CharacterCasing  = CharacterCasing.Upper;
     txtApellidoUsu.CharacterCasing = CharacterCasing.Upper;
     txtNombreUsu.CharacterCasing   = CharacterCasing.Upper;
     try
     {
         if (conecta.AbrirConexion() == true)
         {
             ListaUsuario(conecta.conexion, txtCodUsuario.Text, txtApellidoUsu.Text, txtNombreUsu.Text);
             conecta.CerrarConexion();
         }
     }
     catch (MySql.Data.MySqlClient.MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #13
0
ファイル: Ventas.cs プロジェクト: PISIPexistencias/PISIP
        private void btnBuscaFactura_Click(object sender, EventArgs e)
        {
            try
            {
                Consulta_Factura consultaFactura = new Consulta_Factura();
                consultaFactura.ShowDialog();
                if (consultaFactura.dgvFactura.Rows.Count > 0)
                {
                    if (Convert.ToInt32(consultaFactura.dgvFactura.CurrentRow.Cells[0].Value) >= 0)
                    {
                        Clases.Conexion conectaPro = new Clases.Conexion();
                        txtCodFactura.Text   = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[0].Value);
                        txtCodigoCli.Text    = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[1].Value);
                        txtCedulaCli.Text    = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[2].Value);
                        txtNombreCli.Text    = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[3].Value) + " " + Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[4].Value);
                        dtpFechaFactura.Text = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[5].Value);
                        lblIva.Text          = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[6].Value);
                        lblSubTotal.Text     = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[7].Value);
                        lblTotal.Text        = Convert.ToString(consultaFactura.dgvFactura.CurrentRow.Cells[8].Value);
                        lblEstado.Visible    = true;
                        if (Convert.ToInt32(consultaFactura.dgvFactura.CurrentRow.Cells[9].Value) == 0)
                        {
                            lblEstado.Text       = "Activa";
                            btnModificar.Enabled = true;
                        }
                        else
                        {
                            lblEstado.Text       = "Anulada";
                            btnModificar.Enabled = false;
                        }

                        dgvDetalleFactura.Visible    = false;
                        dgvDetallefatMostrar.Visible = true;
                        if (conectaPro.AbrirConexion() == true)
                        {
                            Clases.Producto.llenaProducto(conectaPro.conexion, dgvDetallefatMostrar, Convert.ToInt32(txtCodFactura.Text));
                            dgvDetallefatMostrar.Columns[5].Visible = false;
                            dgvDetallefatMostrar.Columns[6].Visible = false;
                        }
                        conecta.CerrarConexion();
                        lblAccion.Text = "M";
                        //btnModificar.Enabled = true;
                        btnImprimir.Enabled       = true;
                        btnAgregarDetalle.Enabled = false;
                        btnIngresar.Enabled       = false;
                    }
                }
                else
                {
                    MessageBox.Show("No se ha Seleccionado ninguna fila");
                }
                consultaFactura.Dispose();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
                conecta.CerrarConexion();
            }
        }
コード例 #14
0
ファイル: Login.cs プロジェクト: PISIPexistencias/PISIP
        private void btningresar_Click(object sender, EventArgs e)
        {
            try
            {
                Clases.Conexion conecta = new Clases.Conexion();

                if ((conecta.AbrirConexion()) == true)
                {
                    MySqlCommand    comando = new MySqlCommand("select u.CODIGO_USUARIO,u.CLAVE_USUARIO,APELLIDOS_EMPLEADO,NOMBRES_EMPLEADO,ur.PRIMER_INGRESO FROM usuario u, empleados e,usuario_rol ur where u.codigo_usuario= '" + txtuser.Text + "' and u.clave_usuario='" + txtpass.Text + "' and u.codigo_empleado = e.codigo_empleado and u.CODIGO_USUARIO=ur.CODIGO_USUARIO ", conecta.conexion);
                    MySqlDataReader ejecuta = comando.ExecuteReader();
                    if (ejecuta.Read() == true)
                    {
                        if (Convert.ToInt16(ejecuta["PRIMER_INGRESO"]) == 1)
                        {
                            MessageBox.Show("Este es su primer ingreso al sistema por, por favor cambie la clave", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            CambioLogin cambiaLogin = new CambioLogin();
                            cambiaLogin.lblUsuario.Text    = Convert.ToString(ejecuta["CODIGO_USUARIO"]);
                            cambiaLogin.lblclave.Text      = Convert.ToString(ejecuta["CLAVE_USUARIO"]);
                            cambiaLogin.lblPrimeraVez.Text = Convert.ToString(ejecuta["PRIMER_INGRESO"]);
                            cambiaLogin.ShowDialog();
                            txtpass.Text = cambiaLogin.lblclave.Text;
                            cambiaLogin.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("Bienvenido " + ejecuta["APELLIDOS_EMPLEADO"] + " " + ejecuta["NOMBRES_EMPLEADO"]);

                            Menu_principal menu = new Menu_principal();
                            this.Hide();
                            menu.Show();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Usuario Incorrecto", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                        txtuser.Clear();
                        txtpass.Clear();
                    }
                    conecta.CerrarConexion();
                    conecta.conexion.Dispose();
                }
                else
                {
                    MessageBox.Show("no conectado");
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #15
0
 private void Registro_clientes_Load(object sender, EventArgs e)
 {
     txtapellidos.CharacterCasing = CharacterCasing.Upper;
     txtnombres.CharacterCasing   = CharacterCasing.Upper;
     txtmail.CharacterCasing      = CharacterCasing.Upper;
     txtdireccion.CharacterCasing = CharacterCasing.Upper;
     try
     {
         if (lblAccion.Text == "I")
         {
             txtcodigo.Clear();
             txtcedula.Clear();
             txtapellidos.Clear();
             txtnombres.Clear();
             txtmail.Clear();
             txtdireccion.Clear();
             txttelefono.Clear();
         }
         else if ((lblAccion.Text == "M") || (lblAccion.Text == "E"))
         {
             if (conecta.AbrirConexion() == true)
             {
                 ClienteSeleccionado = Clases.Cliente.ObtenerCliente(conecta.conexion, Convert.ToInt32(txtcodigo.Text));
                 txtcedula.Text      = ClienteSeleccionado.Cedula_Cliente;
                 txtapellidos.Text   = ClienteSeleccionado.Apellidos_Cliente;
                 txtnombres.Text     = ClienteSeleccionado.Nombres_Cliente;
                 txtmail.Text        = ClienteSeleccionado.Correo_Cliente;
                 txtdireccion.Text   = ClienteSeleccionado.Direccion_Cliente;
                 txttelefono.Text    = Convert.ToString(ClienteSeleccionado.Telefono_Cliente);
                 conecta.CerrarConexion();
             }
         }
     }
     catch (MySqlException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #16
0
        private void btnCambiar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtClaveActual.Text == lblclave.Text)
                {
                    if (txtClaveNueva.Text == txtComfirmaClave.Text)
                    {
                        Clases.Conexion conecta1 = new Clases.Conexion();
                        if ((conecta1.AbrirConexion()) == true)
                        {
                            int          resultado = 0;
                            MySqlCommand comando   = new MySqlCommand("update usuario set CLAVE_USUARIO='" + txtClaveNueva.Text + "' where CODIGO_USUARIO='" + lblUsuario.Text + "' ", conecta1.conexion);
                            comando.ExecuteNonQuery();
                            if (Convert.ToInt16(lblPrimeraVez.Text) == 1)
                            {
                                resultado = Clases.Roles.ModificarRolesPrimeraVez(conecta1.conexion, Convert.ToString(lblUsuario.Text));
                            }

                            if (resultado > 0)
                            {
                                lblclave.Text = txtClaveNueva.Text;
                            }
                            MessageBox.Show("La clave ha sido modificada ");
                            conecta1.CerrarConexion();
                            conecta1.conexion.Dispose();
                            this.Close();
                            //this.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("no conectado");
                        }
                    }
                    else
                    {
                        MessageBox.Show("La Clave Nueva y la Confrimacion no coinciden, por favor verifique", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("La Clave Actual no es la correcta, por favor verifique", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #17
0
ファイル: Login.cs プロジェクト: PISIPexistencias/PISIP
        private void btnCambioCalve_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtuser.Text != "")
                {
                    Clases.Conexion conecta = new Clases.Conexion();

                    if ((conecta.AbrirConexion()) == true)
                    {
                        MySqlCommand    comando = new MySqlCommand("select CODIGO_USUARIO,CLAVE_USUARIO,APELLIDOS_EMPLEADO,NOMBRES_EMPLEADO FROM usuario u, empleados e where u.codigo_usuario= '" + txtuser.Text + "' and u.codigo_empleado = e.codigo_empleado ", conecta.conexion);
                        MySqlDataReader ejecuta = comando.ExecuteReader();
                        if (ejecuta.Read() == true)
                        {
                            CambioLogin cambiaLogin = new CambioLogin();
                            cambiaLogin.lblclave.Text      = Convert.ToString(ejecuta["CLAVE_USUARIO"]);
                            cambiaLogin.lblUsuario.Text    = Convert.ToString(ejecuta["CODIGO_USUARIO"]);
                            cambiaLogin.lblPrimeraVez.Text = "2";
                            cambiaLogin.ShowDialog();
                        }
                        else
                        {
                            MessageBox.Show("Usuario No Existe", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                            txtuser.Clear();
                            txtpass.Clear();
                        }
                        conecta.CerrarConexion();
                    }
                }
                else
                {
                    MessageBox.Show("Por Favor Ingrese el Usuario", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
            }
        }
コード例 #18
0
        private void Registro_productos_Load(object sender, EventArgs e)
        {
            txtNombreProducto.CharacterCasing = CharacterCasing.Upper;
            try
            {
                if (lblAccion.Text == "I")
                {
                    txtCodProducto.Clear();
                    txtcodBodProducto.Clear();
                    txtSucursalProducto.Clear();
                    txtCodProvProducto.Clear();
                    txtNomProvProducto.Clear();
                    txtNombreProducto.Clear();
                    txtStockProducto.Text = "0";
                    txtnuevoStock.Text    = "0";
                    txtStockMinProducto.Clear();
                    txtPrecioCompraProducto.Clear();
                    txtPrecioVentaProducto.Clear();
                }
                else if ((lblAccion.Text == "M") || (lblAccion.Text == "E"))
                {
                    if (conecta.AbrirConexion() == true)
                    {
                        ProductoSeleccionado         = Clases.Producto.ObtenerProducto(conecta.conexion, Convert.ToInt32(txtCodProducto.Text));
                        txtCodProducto.Text          = Convert.ToString(ProductoSeleccionado.Cod_Producto);
                        txtNombreProducto.Text       = ProductoSeleccionado.Nombre_Producto;
                        txtcodBodProducto.Text       = Convert.ToString(ProductoSeleccionado.Cod_Bod_Producto);
                        txtSucursalProducto.Text     = ProductoSeleccionado.Sucursal_Bod_Producto;
                        txtCodProvProducto.Text      = Convert.ToString(ProductoSeleccionado.Cod_Prov_Producto);
                        txtNomProvProducto.Text      = ProductoSeleccionado.Nombre_Prov_Producto;
                        txtStockProducto.Text        = Convert.ToString(ProductoSeleccionado.Stock_Producto);
                        txtnuevoStock.Text           = "0";
                        txtStockMinProducto.Text     = Convert.ToString(ProductoSeleccionado.Stock_Min_Producto);
                        txtPrecioCompraProducto.Text = Convert.ToString(ProductoSeleccionado.Precio_Compra_Producto);
                        txtPrecioVentaProducto.Text  = Convert.ToString(ProductoSeleccionado.Precio_Venta_Producto);
                        // si cobra IVa=0 No cobra iva=1
                        if (ProductoSeleccionado.Iva_Producto == 0)
                        {
                            cmbCobraIva.Text = "SI";
                        }
                        else
                        {
                            cmbCobraIva.Text = "NO";
                        }
                        if (ProductoSeleccionado.Estado_Producto == 0)
                        {
                            cmbEstado.Text = "Activo";
                        }
                        else
                        {
                            cmbEstado.Text = "Inactivo";
                        }

                        conecta.CerrarConexion();
                    }
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }