Cambios ExpDetalle Importacion

This commit is contained in:
Luis Carlos Quijada
2025-07-08 17:02:23 -06:00
parent bc0548336b
commit 38352b3d81
3 changed files with 145 additions and 17 deletions

View File

@@ -28,7 +28,7 @@ public partial class Export_RepExportaciones : ClsPaginas
private bool EsImportacion
{
get{ return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); }
get { return (ViewState["EsImportacion"] == null) ? false : Boolean.Parse(ViewState["EsImportacion"].ToString()); }
set { ViewState["EsImportacion"] = value; }
}
public string EmptyDataTextPersonalizado { get; set; }
@@ -43,7 +43,7 @@ public partial class Export_RepExportaciones : ClsPaginas
if (Request["Opcion"] != null)
{
if (Request["Opcion"] == "I")
EsImportacion = true;
EsImportacion = true;
}
Page.Title = EsImportacion ? "Importaciones" : "Exportaciones";
@@ -86,7 +86,7 @@ public partial class Export_RepExportaciones : ClsPaginas
}
protected void CargaExportaciones()
{
bool EsExportacion = !EsImportacion;
string SubProyectos = DdlSubProyecto.GetSelectedValuesM();
SubProyectos = SubProyectos == "" ? "-1" : SubProyectos;
@@ -125,4 +125,76 @@ public partial class Export_RepExportaciones : ClsPaginas
Alert("La Exportación se ha eliminado correctamente.");
}
}
}
protected void GVExportaciones_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var dataItem = (System.Data.DataRowView)e.Row.DataItem;
int cveExportacion = Convert.ToInt32(dataItem["CveExportacion"]);
HyperLink hl = (HyperLink)e.Row.FindControl("HlExpDetalle");
// Usa la bandera EsImportacion de la página
if (EsImportacion)
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}&Opcion=I";
else
hl.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}";
// EDITAR
HyperLink hlEditar = (HyperLink)e.Row.FindControl("HlEditar");
if (EsImportacion)
hlEditar.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}&Opcion=I";
else
hlEditar.NavigateUrl = $"ExpDetalle.aspx?CveExportacion={cveExportacion}";
// Tipo Exportación
Label lblTipoExp = (Label)e.Row.FindControl("lblTipoExp");
if (lblTipoExp != null)
{
string valor = dataItem["TipoExportacion"].ToString();
switch (valor)
{
case "1":
lblTipoExp.Text = "(IMP) Importación";
break;
case "2":
lblTipoExp.Text = "(EXP) Exportación/retorno";
break;
case "3":
lblTipoExp.Text = "(TRA) Tránsitos";
break;
default:
lblTipoExp.Text = "Desconocido";
break;
}
}
// Estatus
Label lblEstatus = (Label)e.Row.FindControl("lblEstatus");
if (lblEstatus != null)
{
string valor = dataItem["CveExportacionEstatus"].ToString();
switch (valor)
{
case "1":
lblEstatus.Text = "Tránsito";
break;
case "2":
lblEstatus.Text = "Completa";
break;
default:
lblEstatus.Text = "Desconocido";
break;
}
}
}
}
protected void GVExportaciones_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
// Cambia el texto del primer encabezado (ajusta el índice si no es la primera columna)
e.Row.Cells[0].Text = EsImportacion ? "Importación" : "Exportación";
}
}
}