private bool verificarFecha(ImportacionController iController) { bool resultado = false; List <FuenteInformacionDetalle> lista = iController.ObtieneCamposMapeados(); foreach (FuenteInformacionDetalle detalle in lista) { if (detalle.EsTipoFecha) { resultado = detalle.EsTipoFecha; break; } } return(resultado); }
protected void cboTabla_SelectedIndexChanged(object sender, EventArgs e) { try { iController = (ImportacionController)HttpContext.Current.Session["IController"]; if (iController != null) { cboColumna.DataSource = iController.ObtenerColumnasDestino(this.cboTabla.SelectedItem.Text); cboColumna.DataBind(); this.grvMapeos.DataSource = iController.ObtieneCamposMapeados(); this.grvMapeos.DataBind(); } } catch (Exception ex) { objApp.ImplementadorMensajes.MostrarMensaje("Error:\n" + ex.Message); } }
protected void paginasDropDownList_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownList oIraPag = (DropDownList)sender; int iNumPag; grvMapeos.PageIndex = int.TryParse(oIraPag.Text.Trim(), out iNumPag) && iNumPag > 0 && iNumPag <= grvMapeos.PageCount ? iNumPag - 1 : 0; iController = (ImportacionController)HttpContext.Current.Session["IController"]; this.grvMapeos.DataSource = iController.ObtieneCamposMapeados(); this.grvMapeos.DataBind(); } catch (Exception ex) { objApp.ImplementadorMensajes.MostrarMensaje("Error:\n" + ex.Message); } }
protected void btnCerrarMapeo_Click(object sender, EventArgs e) { try { 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); } } catch (Exception ex) { objApp.ImplementadorMensajes.MostrarMensaje("Error:\n" + ex.Message); } }
private void ConfigurarImportacion() { 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); HttpContext.Current.Session["IController"] = iController; cboColumnaOrigen.DataSource = iController.ObtenerCamposEstadoCuenta(); cboColumnaOrigen.DataBind(); cboColumnaOrigen.SelectedIndex = 0; cboTabla.SelectedIndex = 0; cboColumna.Items.Clear(); } }
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 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); } }