示例#1
0
    protected void btnAdd_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton imgButton = (sender as ImageButton);
        GridViewRow row       = imgButton.Parent.Parent as GridViewRow;



        string cuenta = ((Label)row.FindControl("colCuentaBancoFinancieroo")).Text;
        int    banco  = Convert.ToInt32(((Label)row.FindControl("colBancoFinanciero")).Text);
        int    FI     = Convert.ToInt32(((Label)row.FindControl("colIdFuenteInformacion")).Text);



        FuenteInformacion fuenteInofrmacion = Conciliacion.Migracion.Runtime.App.Consultas.ObtieneFuenteInformacionPorId(banco, cuenta, FI);

        HttpContext.Current.Session["FuneteInformacion"] = fuenteInofrmacion;


        cboPopUpTipoArchivo.DataValueField = "IdTipoArchivo";
        cboPopUpTipoArchivo.DataTextField  = "Descripcion";
        cboPopUpTipoArchivo.DataSource     = App.Consultas.ObtieneListaTipoArchivo();
        cboPopUpTipoArchivo.DataBind();
        cboPopUpTipoArchivo.SelectedIndex = PosisionarCombo(fuenteInofrmacion.IdTipoArchivo, cboPopUpTipoArchivo);


        this.popUpEtiquetas.Show();
    }
        public override System.Data.DataColumn[] ObtenerColumnas(FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            try
            {
                using (StreamReader archivo = new StreamReader(rutaArchivo))
                {
                    string       cabecera    = archivo.ReadLine();
                    string[]     strColumnas = cabecera.Split(',');
                    DataColumn[] columnas    = new DataColumn[strColumnas.Length];
                    int          index       = 0;
                    foreach (string campo in strColumnas)
                    {
                        columnas[index] = new DataColumn(Regex.Replace(campo, @"[^a-zA-z0-9 ]+", "").Replace(' ', '_').Trim());
                        index++;
                    }
                    return(columnas);
                }
            }
            catch (Exception ex)
            {
                stackTrace = new StackTrace();
                this.ImplementadorMensajes.MostrarMensaje("Clase :" + this.GetType().Name + "\n\r" + "Metodo :" + stackTrace.GetFrame(0).GetMethod().Name + "\n\r" + "Error :" + ex.Message);
                stackTrace = null;
            }



            return(null);
        }
示例#3
0
    private void ConfigurarImportacion()
    {
        try
        {
            HttpContext.Current.Session["FInformacion"] = null;
            HttpContext.Current.Session["IController"]  = null;
            cboColumnaOrigen.Items.Clear();
            if (this.cboTipoFuenteInformacion.Items.Count > 0)
            {
                finformacion = App.Consultas.ObtieneFuenteInformacionPorId(Convert.ToInt32(this.cboBancoFinanciero.SelectedValue), cboCuentaFinanciero.SelectedValue.ToString(), Convert.ToInt32(this.cboTipoFuenteInformacion.SelectedValue));

                HttpContext.Current.Session["FInformacion"] = finformacion;
                string ruta         = "~/Plantillas/ImportacionArchivos/Muestras/";
                string rutaCompleta = MapPath(ruta) + finformacion.RutaArchivo;
                iController = new ImportacionController(finformacion, rutaCompleta, 0);

                HttpContext.Current.Session["IController"] = iController;
                cboColumnaOrigen.DataSource = iController.ObtenerCamposEstadoCuenta();
                cboColumnaOrigen.DataBind();
                cboColumnaOrigen.SelectedIndex = 0;
                cboTabla.SelectedIndex         = 0;
                cboColumna.Items.Clear();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
示例#4
0
    private int  verificarColumnas(FuenteInformacion fuente, string ruta)
    {
        ImportacionController controller = new ImportacionController(fuente, ruta);
        int columnas = controller.ObtenerColumnasEstadoCuenta().Length;

        return(columnas);
    }
示例#5
0
 public void ConfigurarImportacion()
 {
     HttpContext.Current.Session["FInformacion"] = null;
     HttpContext.Current.Session["IController"]  = null;
     if (this.cboTipoFuenteInformacion.Items.Count > 0)
     {
         finformacion = Conciliacion.Migracion.Runtime.App.Consultas.ObtieneFuenteInformacionPorId(Convert.ToInt32(this.cboBancoFinanciero.SelectedValue), cboCuentaFinanciero.SelectedValue.ToString(), Convert.ToInt32(this.cboTipoFuenteInformacion.SelectedValue));
         HttpContext.Current.Session["FInformacion"] = finformacion;
     }
 }
        public override System.Data.DataColumn[] ObtenerColumnas(FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            try
            {
                DataSet dsMsExcel = new DataSet();
                using (System.Data.OleDb.OleDbConnection objOleConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + rutaArchivo + ";Mode=ReadWrite;Extended Properties=\"Excel 12.0 Xml;HDR=NO;IMEX=1\""))
                {
                    System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter();
                    if (File.Exists(rutaArchivo))
                    {
                        objOleConnection.Open();
                        DataTable worksheets = objOleConnection.GetSchema("Tables");
                        string    hoja       = worksheets.Rows[0][2].ToString();
                        System.Data.OleDb.OleDbCommand select = new System.Data.OleDb.OleDbCommand("SELECT  * FROM [" + hoja + "]", objOleConnection);
                        select.CommandType    = CommandType.Text;
                        adapter.SelectCommand = select;
                        dsMsExcel.Tables.Clear();
                        adapter.Fill(dsMsExcel);
                        if (dsMsExcel.Tables.Count > 0)
                        {
                            DataRow      col      = dsMsExcel.Tables[0].Rows[0];
                            DataColumn[] columnas = new DataColumn[col.ItemArray.Length];
                            int          index    = 0;
                            string       nombre;
                            foreach (object campo in col.ItemArray)
                            {
                                if (!string.IsNullOrEmpty(campo.ToString()))
                                {
                                    nombre = campo.ToString().Trim();
                                }
                                else
                                {
                                    nombre = "-----------" + index.ToString();
                                }

                                columnas[index] = new DataColumn(nombre);
                                index++;
                            }
                            return(columnas);
                        }
                    }
                    else
                    {
                        throw new Exception("El archivo " + Path.GetFileName(rutaArchivo) + " no existe. Corrija el mapeo y vuelva a intentarlo.");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(null);
        }
 protected void btnCerrarMapeo_Click(object sender, EventArgs e)
 {
     finformacion = (FuenteInformacion)HttpContext.Current.Session["FInformacion"];
     iController  = (ImportacionController)HttpContext.Current.Session["IController"];
     if (verificarFecha(iController))
     {
         DesbloquearControles();
         LimpiezaTotal();
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('No existe ningún campo de tipo fecha, configure uno.');", true);
     }
 }
        public override System.Data.DataColumn[] ObtenerColumnas(FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            try
            {
                DataSet dsMsExcel = new DataSet();
                using (System.Data.OleDb.OleDbConnection objOleConnection = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + rutaArchivo + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1'"))
                {
                    System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter();
                    objOleConnection.Open();
                    DataTable worksheets = objOleConnection.GetSchema("Tables");
                    string    hoja       = worksheets.Rows[0][2].ToString();
                    System.Data.OleDb.OleDbCommand select = new System.Data.OleDb.OleDbCommand("SELECT  * FROM [" + hoja + "]", objOleConnection);
                    select.CommandType    = CommandType.Text;
                    adapter.SelectCommand = select;
                    dsMsExcel.Tables.Clear();
                    adapter.Fill(dsMsExcel);
                    if (dsMsExcel.Tables.Count > 0)
                    {
                        DataRow      col      = dsMsExcel.Tables[0].Rows[0];
                        DataColumn[] columnas = new DataColumn[col.ItemArray.Length];
                        int          index    = 0;
                        string       nombre;
                        foreach (object campo in col.ItemArray)
                        {
                            if (!string.IsNullOrEmpty(campo.ToString()))
                            {
                                nombre = campo.ToString().Trim();
                            }
                            else
                            {
                                nombre = "NULL" + index.ToString();
                            }

                            columnas[index] = new DataColumn(nombre);
                            index++;
                        }
                        return(columnas);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(null);
        }
        public System.Data.DataTable LeerArchivo(FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            DataTable tabla = new DataTable();

            try
            {
                tabla.Columns.AddRange(ObtenerColumnas(fuenteInformacion, rutaArchivo));
                tabla = ObtenerContenido(tabla, fuenteInformacion, rutaArchivo);
            }
            catch (Exception ex)
            {
                stackTrace = new StackTrace();
                this.ImplementadorMensajes.MostrarMensaje("Clase :" + this.GetType().Name + "\n\r" + "Metodo :" + stackTrace.GetFrame(0).GetMethod().Name + "\n\r" + "Error :" + ex.Message);
                stackTrace = null;
                return(null);
            }
            return(tabla);
        }
        public override System.Data.DataColumn[] ObtenerColumnas(FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            using (StreamReader archivo = new StreamReader(rutaArchivo))
            {
                string cabecera = archivo.ReadLine();
                //string[] strColumnas = cabecera.Split(Convert.ToChar(fuenteInformacion.TipoArchivo.Separador.Trim()));
                //string[] strColumnas = Regex.Split(cabecera, @fuenteInformacion.TipoArchivo.Separador.Trim());
                string[] strColumnas = esEspecial(fuenteInformacion.TipoArchivo.Separador.Trim()) ? Regex.Split(cabecera, @fuenteInformacion.TipoArchivo.Separador.Trim()) : cabecera.Split(Convert.ToChar(fuenteInformacion.TipoArchivo.Separador.Trim()));

                DataColumn[] columnas = new DataColumn[strColumnas.Length];
                int          index    = 0;
                foreach (string campo in strColumnas)
                {
                    columnas[index] = new DataColumn(Regex.Replace(campo, @"[^a-zA-z0-9 ]+", "").Replace(' ', '_').Trim());
                    index++;
                }
                return(columnas);
            }
            return(null);
        }
示例#11
0
    protected void btnDelete_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton imgButton            = (sender as ImageButton);
        GridViewRow row                  = imgButton.Parent.Parent as GridViewRow;
        Label       lblCuenta            = (Label)row.FindControl("colCuentaBancoFinancieroo");
        Label       lblBanco             = (Label)row.FindControl("colBancoFinanciero");
        Label       lblFuenteInformacion = (Label)row.FindControl("colIdFuenteInformacion");


        FuenteInformacion fid = (FuenteInformacion)App.FuenteInformacion.CrearObjeto();

        fid.CuentaBancoFinanciero = lblCuenta.Text;
        fid.BancoFinanciero       = Convert.ToInt32(lblBanco.Text);
        fid.IdFuenteInformacion   = Convert.ToInt32(lblFuenteInformacion.Text);
        if (fid.Eliminar())
        {
            this.grvFuenteInformacion.DataSource = App.Consultas.ObtieneListaFuenteInformacionPorBancoCuenta(Convert.ToInt32(cboBancoFinanciero.SelectedValue), cboCuentaFinanciero.SelectedValue.ToString());
            this.grvFuenteInformacion.DataBind();
        }
    }
示例#12
0
    protected void btnGuardarArchivo_Click(object sender, EventArgs e)
    {
        FuenteInformacion fuenteInofrmacion = (FuenteInformacion)HttpContext.Current.Session["FuneteInformacion"]; // Conciliacion.Migracion.Runtime.App.Consultas.ObtieneFuenteInformacionPorId(banco, cuenta,FI);
        int    columnas     = fuenteInofrmacion.NumColumnas;
        string ruta         = "~/Plantillas/ImportacionArchivos/Muestras/";
        string RUTA         = base.MapPath(ruta);
        string rutaCompleta = MapPath(ruta) + fuenteInofrmacion.RutaArchivo;

        if (HttpContext.Current.Session["Archivo"] != null)
        {
            if (File.Exists(rutaCompleta))
            {
                File.Delete(rutaCompleta);
            }
            rutaCompleta = Path.ChangeExtension(rutaCompleta, Path.GetExtension(HttpContext.Current.Session["NombreArchivo"].ToString()));
            if (SubirArchivo(rutaCompleta))
            {
                fuenteInofrmacion.RutaArchivo   = Path.ChangeExtension(fuenteInofrmacion.RutaArchivo, Path.GetExtension(HttpContext.Current.Session["NombreArchivo"].ToString()));
                fuenteInofrmacion.IdTipoArchivo = Convert.ToInt32(this.cboPopUpTipoArchivo.SelectedValue);
                fuenteInofrmacion.NumColumnas   = verificarColumnas(fuenteInofrmacion, rutaCompleta);//Convert.ToInt32(this.txtNumColumnas.Text);
                if (fuenteInofrmacion.Actualizar())
                {
                    this.popUpEtiquetas.Hide();
                    if (columnas != fuenteInofrmacion.NumColumnas)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('El número de columnas cambio.Verifique el mapeo de este archivo.');", true);
                    }
                    this.grvFuenteInformacion.DataSource = App.Consultas.ObtieneListaFuenteInformacionPorBancoCuenta(Convert.ToInt32(cboBancoFinanciero.SelectedValue), cboCuentaFinanciero.SelectedValue.ToString());
                    this.grvFuenteInformacion.DataBind();
                }
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Seleccione un archivo.');", true);
        }
    }
示例#13
0
    protected void btnGuardarDatos_Click(object sender, EventArgs e)
    {
        if (ValidarDatos())
        {
            string ruta         = "~/Plantillas/ImportacionArchivos/Muestras/";
            string RUTA         = base.MapPath(ruta);
            string sName        = this.cboCorporativo.SelectedItem.Text.Trim().Replace(' ', '_').Replace('.', '_') + "_" + this.cboBancoFinanciero.SelectedItem.Text.Trim().Replace(' ', '_').Replace('.', '_') + "_" + this.cboCuentaFinanciero.SelectedItem.Text.Trim().Replace(' ', '_').Replace('.', '_') + "_" + this.cboTipoFuenteInformacion.SelectedItem.Text.Trim().Replace(' ', '_').Replace('.', '_') + Path.GetExtension(HttpContext.Current.Session["NombreArchivo"].ToString());
            string rutaCompleta = MapPath(ruta) + sName;
            if (HttpContext.Current.Session["Archivo"] != null)
            {
                if (SubirArchivo(rutaCompleta))
                {
                    FuenteInformacion fuenteInofrmacion = (FuenteInformacion)App.FuenteInformacion.CrearObjeto();
                    fuenteInofrmacion.IdFuenteInformacion     = Convert.ToInt32(cboTipoFuenteInformacion.SelectedValue); //App.Consultas.ObtieneFuenteInformacionNumeroMaximo(Convert.ToInt32(this.cboBancoFinanciero.SelectedValue.ToString()), cboCuentaFinanciero.SelectedValue.ToString()) + 1;
                    fuenteInofrmacion.BancoFinanciero         = Convert.ToInt32(this.cboBancoFinanciero.SelectedValue.ToString());
                    fuenteInofrmacion.CuentaBancoFinanciero   = cboCuentaFinanciero.SelectedValue.ToString();
                    fuenteInofrmacion.RutaArchivo             = sName;
                    fuenteInofrmacion.IdTipoFuenteInformacion = Convert.ToInt32(cboTipoFuenteInformacion.SelectedValue);
                    fuenteInofrmacion.IdSucursal    = Convert.ToInt32(this.cboSucursal.SelectedValue.ToString());
                    fuenteInofrmacion.IdTipoArchivo = Convert.ToInt32(this.cboTipoArchivo.SelectedValue);
                    fuenteInofrmacion.NumColumnas   = verificarColumnas(fuenteInofrmacion, rutaCompleta);//Convert.ToInt32(this.txtNumColumnas.Text);
                    if (fuenteInofrmacion.Guardar())
                    {
                        Limpiar();
                    }
                    else
                    {
                        if (File.Exists(rutaCompleta))
                        {
                            File.Delete(rutaCompleta);
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.uppPrincipal,
                                                        uppPrincipal.GetType(),
                                                        Guid.NewGuid().ToString(),
                                                        "alert('Ocurrierón errores al tratar de cargar el archivo.');",
                                                        true);
                }

                //ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Ocurrierón errores al tratar de cargar el archivo.');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.uppPrincipal,
                                                    uppPrincipal.GetType(),
                                                    Guid.NewGuid().ToString(),
                                                    "alert('Seleccione un archivo.');",
                                                    true);
                //ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Seleccione un archivo.');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.uppPrincipal,
                                                uppPrincipal.GetType(),
                                                Guid.NewGuid().ToString(),
                                                "alert('" + LimpiarTexto(mensaje.ToString()) + "');",
                                                true);
            //ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('" + LimpiarTexto(mensaje.ToString()) + "');", true);
        }

        HttpContext.Current.Session["Archivo"]       = null;
        HttpContext.Current.Session["NombreArchivo"] = null;
    }
示例#14
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);
        }
    }
        protected override System.Data.DataTable ObtenerContenido(System.Data.DataTable contenido, FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            string linea;
            int    index = 0;

            try
            {
                using (StreamReader archivo = new StreamReader(rutaArchivo))
                {
                    while ((linea = archivo.ReadLine()) != null)
                    {
                        try
                        {
                            string[] fila = linea.Split(',');
                            if (index != 0)
                            {
                                contenido.Rows.Add(fila);
                            }
                            index++;
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                stackTrace = new StackTrace();
                this.ImplementadorMensajes.MostrarMensaje("Clase :" + this.GetType().Name + "\n\r" + "Metodo :" + stackTrace.GetFrame(0).GetMethod().Name + "\n\r" + "Error :" + ex.Message);
                stackTrace = null;
            }
            return(contenido);
        }
示例#16
0
    protected void btnGuardarDatos_Click(object sender, EventArgs e)
    {
        try
        {
            if (ValidarDatos())
            {
                ConfigurarImportacion();
                finformacion = (FuenteInformacion)HttpContext.Current.Session["FInformacion"];
                string ruta         = "~/Archivos/ArchivosTemporales/";
                string rutaCompleta = MapPath(ruta) + finformacion.RutaArchivo;
                if (HttpContext.Current.Session["Archivo"] != null)
                {
                    SubirArchivo(rutaCompleta);
                    if (finformacion.FuenteInformacionDetalle.Count > 0)
                    {
                        if (SubirArchivo(rutaCompleta))
                        {
                            //CultureInfo culture = new CultureInfo("en-US");
                            TablaDestino tablaDestino = (TablaDestino)App.TablaDestino.CrearObjeto();
                            tablaDestino.IdCorporativo = Convert.ToInt32(this.cboCorporativo.SelectedValue);
                            tablaDestino.IdSucursal    = Convert.ToInt32(this.cboSucursal.SelectedValue);
                            tablaDestino.Anio          = Convert.ToInt32(this.cboAnio.SelectedValue);
                            tablaDestino.Folio         = Conciliacion.Migracion.Runtime.App.Consultas.ObtieneTablaDestinoNumeroMaximo(Convert.ToInt32(this.cboCorporativo.SelectedValue), Convert.ToInt32(this.cboSucursal.SelectedValue), Convert.ToInt32(this.cboAnio.SelectedValue)) + 1;
                            tablaDestino.IdFrecuencia  = 1;
                            //tablaDestino.FInicial = Convert.ToDateTime(dpFInicial.Text);
                            //tablaDestino.FFinal = Convert.ToDateTime(dpFFinal.Text);
                            tablaDestino.IdStatusConciliacion = "CONCILIACION ABIERTA";
                            tablaDestino.FAlta = DateTime.Now; //DateTb{bime.ParseExact(DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss"), "MM/dd/yyyy hh:mm:ss", culture); ;
                            tablaDestino.CuentaBancoFinanciero = cboCuentaFinanciero.SelectedValue.ToString();
                            tablaDestino.Usuario = ((SeguridadCB.Public.Usuario)HttpContext.Current.Session["Usuario"]).IdUsuario;
                            tablaDestino.IdTipoFuenteInformacion = finformacion.IdTipoFuenteInformacion;
                            ImportacionController importador = new ImportacionController(finformacion, rutaCompleta, int.Parse(cboBancoFinanciero.SelectedValue.ToString()));
                            //ImportacionController importador = new ImportacionController(finformacion, rutaCompleta,0);
                            App.ImplementadorMensajes.ContenedorActual = this;

                            if (importador.ImportarArchivo(tablaDestino))
                            {
                                Limpiar();
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(),
                                                                    "alert('Ocurrieron errores al importar el archivo);",
                                                                    true);
                            }

                            if (File.Exists(rutaCompleta))
                            {
                                File.Delete(rutaCompleta);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Ocurrier�n errores al tratar de cargar el archivo.');", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('La Cuenta no tiene configurada una plantilla de Mapeo.');", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('Seleccione un archivo.');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert('" + LimpiarTexto(mensaje.ToString()) + "');", true);
            }
            HttpContext.Current.Session["Archivo"]       = null;
            HttpContext.Current.Session["NombreArchivo"] = null;
        }
        catch (Exception ex)
        {
            //ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "alert(" + ex.Message + "');", true);
            objApp.ImplementadorMensajes.MostrarMensaje(ex.Message);
        }
    }
 public abstract DataColumn[] ObtenerColumnas(FuenteInformacion fuenteInformacion, string rutaArchivo);
 protected abstract DataTable ObtenerContenido(DataTable contenido, FuenteInformacion fuenteInformacion, string rutaArchivo);
 protected override System.Data.DataTable ObtenerContenido(System.Data.DataTable contenido, FuenteInformacion fuenteInformacion, string rutaArchivo)
 {
     try
     {
         DataSet dsMsExcel = new DataSet();
         using (System.Data.OleDb.OleDbConnection objOleConnection = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + rutaArchivo + ";Mode=ReadWrite;Extended Properties=\"Excel 12.0 Xml;HDR=YES;IMEX=1\""))
         {
             System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter();
             objOleConnection.Open();
             DataTable worksheets = objOleConnection.GetSchema("Tables");
             string    hoja       = worksheets.Rows[0][2].ToString();
             System.Data.OleDb.OleDbCommand select = new System.Data.OleDb.OleDbCommand("SELECT  * FROM [" + hoja + "]", objOleConnection);
             select.CommandType    = CommandType.Text;
             adapter.SelectCommand = select;
             dsMsExcel.Tables.Clear();
             adapter.Fill(dsMsExcel);
             if (dsMsExcel.Tables.Count > 0)
             {
                 foreach (DataRow filaEstadoCuenta in dsMsExcel.Tables[0].Rows)
                 {
                     contenido.Rows.Add(filaEstadoCuenta.ItemArray);
                 }
                 contenido.Rows.Remove(contenido.Rows[0]);
                 return(contenido);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(null);
 }
        protected override System.Data.DataTable ObtenerContenido(System.Data.DataTable contenido, FuenteInformacion fuenteInformacion, string rutaArchivo)
        {
            string linea;
            int    index = 0;

            using (StreamReader archivo = new StreamReader(rutaArchivo))
            {
                while ((linea = archivo.ReadLine()) != null)
                {
                    //string[] fila = linea.Split(Convert.ToChar(fuenteInformacion.TipoArchivo.Separador.Trim()));
                    //string[] fila = Regex.Split(linea, @fuenteInformacion.TipoArchivo.Separador.Trim());
                    string[] fila = esEspecial(fuenteInformacion.TipoArchivo.Separador.Trim()) ? Regex.Split(linea, @fuenteInformacion.TipoArchivo.Separador.Trim()) : linea.Split(Convert.ToChar(fuenteInformacion.TipoArchivo.Separador.Trim()));
                    if (index != 0)
                    {
                        if (fila.Length == fuenteInformacion.NumColumnas)
                        {
                            contenido.Rows.Add(fila);
                        }
                    }
                    index++;
                }
            }
            return(contenido);
        }