public Object execute(Object O)
    {
        VOReg = (preCompraVO)O;

        if (VOReg.Operacion == preCompraVO.ACTUALIZAR)
        {
            return(actualizaPreCompra());
        }
        else if (VOReg.Operacion == preCompraVO.INSERTAR)
        {
            return(funInsertaPreCompra());
        }
        else if (VOReg.Operacion == preCompraVO.BUSCAR)
        {
            return(buscarPreCompra());
        }

        return(VOReg);
    }
    protected void btnGenera_Click(object sender, EventArgs e)
    {
        //protected void lnkContinuar_Click(object sender, EventArgs e)
        //{
        lblMensaje.Text  = validaCamposProductos();
        lblMensaje2.Text = lblMensaje.Text;
        if (lblMensaje.Text == "")
        {
            preCompraVO preCompVO = new preCompraVO();
            preCompraBL preCompBL = new preCompraBL();
            preCompVO.TipoDocumentoId = Int32.Parse(rdoLstTipoDocumento.SelectedValue);
            preCompVO.MonedaId        = Int32.Parse(lstMoneda.SelectedValue);
            preCompVO.CveLinea        = lblLineaId.Text;
            preCompVO.Sucursal        = lblSucursal.Text;

            preCompVO.CveAgente = 0;//Int32.Parse(lblTmpAgente.Text);

            //preCompVO.FolioPedido = lstPedido.Text;
            preCompVO.FolioPedido = "";//txtPedido.Text;
            preCompVO.UsuarioId   = Int32.Parse(Session["usuarioID"].ToString());
            //lblTemporal.Text = rdoLstTipoDocumento.SelectedItem.Text.Split('(')[1].Split(')')[0];
            preCompVO.FolioOrdenCompra = rdoLstTipoDocumento.SelectedItem.Text.Split('(')[1].Split(')')[0];
            //ArrayList listaProductosCompras = getListaProductosCompras();
            preCompVO.ClaveProveedor = lstProveedor.SelectedValue;
            preCompVO.Comentario     = txtComentario.Text.Trim();
            preCompVO.ArrProductos   = getListaProductosCompras();
            preCompVO.Operacion      = preCompraVO.INSERTAR;
            preCompVO = (preCompraVO)preCompBL.execute(preCompVO);
            if (preCompVO.ComprasId > 0)
            {
                lblCompraId.Text = preCompVO.ComprasId.ToString();
            }

            Response.Redirect("~/Admin/compras/caidaCompras.aspx?strTipoDocumento=" + rdoLstTipoDocumento.SelectedValue + "&strFolioDocumento=" + rdoLstTipoDocumento.SelectedItem.Text.Split('(')[1].Split(')')[0] + "&strMoneda=" + lstMoneda.SelectedValue + "&strLineaId=" + lblLineaId.Text + "&strMarca=" + lblMarca.Text + "&strSucursal=" + lblSucursal.Text + "&strCompraId=" + lblCompraId.Text + "&strClaveProveedor=" + lstProveedor.SelectedValue + "&strNombreProveedor=" + lstProveedor.SelectedItem.Text + "&strComentario=" + txtComentario.Text + "&Fecha=" + DateTime.Now.ToString("d") + "&Tipo=" + rdoLstTipoDocumento.SelectedValue);
        }
    }