Exemplo n.º 1
0
    protected void btnDelete_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ImageButton imgButton            = (sender as ImageButton);
            GridViewRow row                  = imgButton.Parent.Parent as GridViewRow;
            Label       lblCuenta            = (Label)row.FindControl("colIdCuentaBanco");
            Label       lblBanco             = (Label)row.FindControl("colIdBanco");
            Label       lblFuenteInformacion = (Label)row.FindControl("colIdFuenteInformacion");
            Label       lblSecuencia         = (Label)row.FindControl("lblGVSecuencia");

            FuenteInformacionDetalle fid = (FuenteInformacionDetalle)App.FuenteInformacionDetalle.CrearObjeto();
            fid.CuentaBancoFinanciero = lblCuenta.Text;
            fid.BancoFinanciero       = Convert.ToInt32(lblBanco.Text);
            fid.IdFuenteInformacion   = Convert.ToInt32(lblFuenteInformacion.Text);
            fid.Secuencia             = Convert.ToInt32(lblSecuencia.Text);
            if (fid.Eliminar())
            {
                iController = (ImportacionController)HttpContext.Current.Session["IController"];
                if (iController != null)
                {
                    cboColumna.DataSource = iController.ObtenerColumnasDestino(this.cboTabla.Text.ToString());
                    cboColumna.DataBind();
                    this.grvMapeos.DataSource = iController.ObtieneCamposMapeados();
                    this.grvMapeos.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            objApp.ImplementadorMensajes.MostrarMensaje("Error:\n" + ex.Message);
        }
    }
Exemplo n.º 2
0
    protected void btnGuardarDatos_Click(object sender, EventArgs e)
    {
        try
        {
            if (tabNuevaConciliacion.ActiveTabIndex == 0)
            {
                if (ValidarDatos(tabNuevaConciliacion.ActiveTabIndex))
                {
                    finformacion = (FuenteInformacion)HttpContext.Current.Session["FInformacion"];
                    iController  = (ImportacionController)HttpContext.Current.Session["IController"];

                    bool existeFecha = false;
                    if (chkTipoFecha.Checked)
                    {
                        existeFecha = verificarFecha(iController);
                    }
                    if (!existeFecha)
                    {
                        FuenteInformacionDetalle FID = App.FuenteInformacionDetalle;
                        FID.CuentaBancoFinanciero = cboCuentaFinanciero.SelectedValue.ToString();
                        FID.BancoFinanciero       = Convert.ToInt32(cboBancoFinanciero.SelectedValue);
                        FID.IdFuenteInformacion   = finformacion.IdFuenteInformacion;
                        FID.Secuencia             = App.Consultas.ObtieneFuenteInformacionDetalleNumeroMaximo(finformacion.BancoFinanciero, finformacion.CuentaBancoFinanciero, finformacion.IdFuenteInformacion) + 1;
                        FID.ColumnaOrigen         = cboColumnaOrigen.SelectedValue.ToString();
                        FID.IdConceptoBanco       = 0;
                        FID.TablaDestino          = cboTabla.SelectedValue.ToString();
                        FID.ColumnaDestino        = cboColumna.SelectedValue.ToString();
                        FID.EsTipoFecha           = chkTipoFecha.Checked;
                        if (FID.Guardar())
                        {
                            this.grvMapeos.DataSource = iController.ObtieneCamposMapeados();
                            this.grvMapeos.DataBind();
                            cboColumna.DataSource = iController.ObtenerColumnasDestino(this.cboTabla.SelectedValue.ToString());
                            cboColumna.DataBind();
                            cboColumnaOrigen.DataSource = iController.ObtenerCamposEstadoCuenta();
                            cboColumnaOrigen.DataBind();
                            Limpiar();
                            BloquearControles();
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Ya existe un campo de Fecha.');", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('" + LimpiarTexto(mensaje.ToString()) + "');", true);
                }
            }
            else
            {
                if (ValidarDatos(tabNuevaConciliacion.ActiveTabIndex))
                {
                    iController  = (ImportacionController)HttpContext.Current.Session["IController"];
                    finformacion = (FuenteInformacion)HttpContext.Current.Session["FInformacion"];

                    if (finformacion.CopiarFuenteInformacionDetalle(ddlCuentaBancariaFuente.SelectedValue))
                    {
                        this.grvMapeos.DataSource = iController.ObtieneCamposMapeados();
                        this.grvMapeos.DataBind();
                        cboColumna.DataSource = iController.ObtenerColumnasDestino(this.cboTabla.SelectedValue.ToString());
                        cboColumna.DataBind();
                        cboColumnaOrigen.DataSource = iController.ObtenerCamposEstadoCuenta();
                        cboColumnaOrigen.DataBind();
                        Limpiar();
                        BloquearControles();
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('" + LimpiarTexto(mensaje.ToString()) + "');", true);
                }
            }
        }
        catch (Exception ex)
        {
            objApp.ImplementadorMensajes.MostrarMensaje("Error:\n" + ex.Message);
        }
    }