diff --git a/Export/RepExportaciones.aspx b/Export/RepExportaciones.aspx index b8f405ae6..10ceb0b76 100644 --- a/Export/RepExportaciones.aspx +++ b/Export/RepExportaciones.aspx @@ -6,7 +6,7 @@ - Exportaciones +
  • @@ -45,7 +45,7 @@
    - + diff --git a/Export/RepExportaciones.aspx.cs b/Export/RepExportaciones.aspx.cs index 3ee4b2c68..883250892 100644 --- a/Export/RepExportaciones.aspx.cs +++ b/Export/RepExportaciones.aspx.cs @@ -25,6 +25,8 @@ public partial class Export_RepExportaciones : ClsPaginas set { ViewState["CveExportacion"] = value; } } + public string EmptyDataTextPersonalizado { get; set; } + public string ToolTipPersonalizado { get; set; } private bool EsImportacion { get{ return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); } @@ -35,14 +37,35 @@ public partial class Export_RepExportaciones : ClsPaginas { if (!IsPostBack) { + // Primero, inicializa la bandera EsImportacion = false; - - if (Request["Opcion"] != null) + if (Request["Opcion"] != null && Request["Opcion"] == "I") { - if (Request["Opcion"] == "I") EsImportacion = true; } - LtlPeriodoseleccionado.Text = EsImportacion ? "Importaciones" : "Exportaciones"; + + Page.Title = EsImportacion ? "Importaciones" : "Exportaciones"; + // Ahora sí, usa la bandera para los textos + if (EsImportacion) + { + LtlTitulo.Text = "Importaciones"; + EmptyDataTextPersonalizado = "No se encontraron importaciones"; + ToolTipPersonalizado = "Importaciones"; + HLAgregarExp.Text = " Agregar Importación"; + HLAgregarExp.NavigateUrl = "ExpDetalle.aspx?CveExportacion=-1&Opcion=I"; + } + else + { + LtlTitulo.Text = "Exportaciones"; + EmptyDataTextPersonalizado = "No se encontraron exportaciones"; + ToolTipPersonalizado = "Exportaciones"; + HLAgregarExp.Text = " Agregar Exportación"; + HLAgregarExp.NavigateUrl = "ExpDetalle.aspx?CveExportacion=-1"; + } + + GVExportaciones.EmptyDataText = EmptyDataTextPersonalizado; + GVExportaciones.ToolTip = ToolTipPersonalizado; + CargaExportaciones(); } } @@ -61,7 +84,11 @@ public partial class Export_RepExportaciones : ClsPaginas protected void EditarExp_Click(object sender, EventArgs e) { GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - Response.Redirect($"/Export/ExpDetalle.aspx?CveExportacion={gvRow.DataKey("CveExportacion")}", true); + string cve = gvRow.DataKey("CveExportacion").ToString(); + string url = EsImportacion + ? $"/Export/ExpDetalle.aspx?CveExportacion={cve}&Opcion=I" + : $"/Export/ExpDetalle.aspx?CveExportacion={cve}"; + Response.Redirect(url, true); upDatosExp.Update(); } protected void EliminarExp_Click(object sender, EventArgs e) @@ -76,4 +103,21 @@ public partial class Export_RepExportaciones : ClsPaginas Alert("La Exportación se ha eliminado correctamente."); } } -} \ No newline at end of file + + protected void GVExportaciones_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + HyperLink hl = (HyperLink)e.Row.FindControl("HlExpDetalle"); + if (hl != null) + { + string cve = DataBinder.Eval(e.Row.DataItem, "CveExportacion").ToString(); + if (EsImportacion) + hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cve}&Opcion=I"; + else + hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cve}"; + } + } + } +} +