//Metodo que se ejecuta el MasterView protected void btnDescargarDS_OnClick(object sender, EventArgs e) { try { MultiView1.ActiveViewIndex = 1; h2_titulo.InnerHtml = "Descarga Expediente -> Descarga Data Stage"; if (Session["DS"] == null) { string mensaje = string.Empty; DataTable dt2 = new DataTable(); dt2 = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje); Session["DS"] = dt2; } GridDS.DataSource = Session["DS"]; GridDS.DataBind(); GridDS.Settings.VerticalScrollableHeight = 280; GridDS.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; } catch (Exception ex) { int idusuario = 0; string mensaje = ""; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "DescargaExpediente-btnDescargarDS_OnClick", ex, lblCadena.Text, ref mensaje); } }
/// <summary> /// Users request to query the db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExecuteQuery_Click(object sender, EventArgs e) { //Secondary security fix if (IsEditable && txtQuery.Text.ToLower().StartsWith("select")) { try { var ds = ExportHelper.ReturnDataSet(txtQuery.Text); if (ds != null) { GridDS.DataSource = ds; GridDS.DataBind(); //Check if the gridds has records on it, we show the exporter buttons liExportCsv.Visible = GridDS.Rows.Count > 0; liExportXml.Visible = GridDS.Rows.Count > 0; } } catch (Exception ex) { Skin.AddModuleMessage(this, "Query Error: " + ex.Message, ModuleMessage.ModuleMessageType.RedError); GridDS.DataSource = null; GridDS.DataBind(); } } else { Skin.AddModuleMessage(this, "Your query MUST start with the word SELECT", ModuleMessage.ModuleMessageType.RedError); } }
protected void Page_Init(object sender, EventArgs e) { GridED.SettingsPager.PageSize = GridPageSize; #region Grid Principal //Cuando se quiera filtrar el Grid entra en el if if (Session["GridED"] != null) { GridED.DataSource = Session["GridED"]; GridED.DataBind(); GridED.SettingsPager.PageSize = GridPageSize; } #endregion #region Cuenta Gastos //Cuando se quiera filtrar el GridDS entra en el if if (Session["DS"] != null) { GridDS.DataSource = Session["DS"]; GridDS.DataBind(); GridDS.SettingsPager.PageSize = GridPageSizeDS; } #endregion }
//Metodo que llama al Callback para actualizar el GridPageSizeDS y el GridDS protected void GridDS_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { GridPageSizeDS = int.Parse(e.Parameters); GridDS.SettingsPager.PageSize = GridPageSizeDS; GridDS.DataBind(); GridDS.Settings.VerticalScrollableHeight = 280; GridDS.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; }
/// <summary> /// show all tables of the current database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void linkShowTables_Click(object sender, EventArgs e) { try { var ds = ExportHelper.ReturnDataSet( "SELECT table_name AS Name FROM INFORMATION_SCHEMA.Tables WHERE (TABLE_TYPE = 'BASE TABLE') Order By table_name"); if (ds != null) { GridDS.DataSource = ds; GridDS.DataBind(); } } catch (Exception ex) { Skin.AddModuleMessage(this, "Error In Getting Tables: " + ex.Message, ModuleMessage.ModuleMessageType.RedError); } }
protected void lkb_ActualizarDS_Click(object sender, EventArgs e) { try { string mensaje = string.Empty; Session["DS"] = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje); GridDS.DataSource = Session["DS"]; GridDS.DataBind(); GridDS.Settings.VerticalScrollableHeight = 280; GridDS.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; } catch (Exception ex) { string mensaje = string.Empty; int idusuario = 0; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "DescargaExpediente-lkb_ActualizarDS_Click", ex, lblCadena.Text, ref mensaje); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["Cadena"] == null) { //string alerta = "<script>alert('La sesión ha expirado, debe volver a iniciar sesión');window.location.href='Login.aspx'</script>"; //Response.Write(alerta); Session["Tab"] = "Salir"; Response.Redirect("Login.aspx", false); return; } else { lblCadena.Text = Session["Cadena"].ToString(); Session["Tab"] = "Inicio"; } if (!Page.IsPostBack) { nombreArchivo = Request.Path.Substring(Request.Path.LastIndexOf("/") + 1); if (Session["Permisos"] != null) { DataTable dt = ((DataTable)Session["Permisos"]).Select("Archivo like '%" + nombreArchivo + "%'").CopyToDataTable(); tituloPagina = dt.Rows[0]["NombreModulo"].ToString(); permisoConsultar = Convert.ToBoolean(Convert.ToInt32(dt.Rows[0]["Consultar"].ToString())); if (!permisoConsultar) { Response.Redirect("Default.aspx"); } permisoExportar = Convert.ToBoolean(Convert.ToInt32(dt.Rows[0]["Exportar"].ToString())); Page.Title = tituloPagina; } Session["GridED"] = null; TituloPanel(string.Empty); RANGO.Text = DESDE.Text = HASTA.Text = string.Empty; DataTable dtGrid = new DataTable(); GridED.DataSource = dtGrid; GridED.DataBind(); GridED.Settings.VerticalScrollableHeight = 280; GridED.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; InhabilitarBotonDescarga(); string mensaje = ""; DataTable dta = new DataTable(); dta = catalogo.TraerAduanas(lblCadena.Text, ref mensaje); cmbADUANA.DataSource = dta; cmbADUANA.DataBind(); //Trae en una sesion la tabla de datastage mensaje = string.Empty; Session["DS"] = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje); GridDS.DataSource = Session["DS"]; GridDS.DataBind(); GridDS.Settings.VerticalScrollableHeight = 280; GridDS.Settings.VerticalScrollBarMode = ScrollBarMode.Visible; } } catch (Exception ex) { string mensaje = string.Empty; int idusuario = 0; if (Session["IdUsuario"] != null) { idusuario = int.Parse(Session["IdUsuario"].ToString()); } excepcion.RegistrarExcepcion(idusuario, "Page_Load", ex, lblCadena.Text, ref mensaje); if (mensaje.Length == 0) { mensaje = "Error: " + excepcion.SerializarExMessage(lblCadena.Text, ex); } //Response.Redirect("Login.aspx"); } }