Limpieza masiva ClsPaginas

-RegistraScript se unifica en una sola clase static/shared y se simplica el código
-Alert se vuelve estático
-Random() no se manda a crear cada vez que se registra un script (esto tenía un costo alto)
-Se corrigieron unos errores en los nombres de funciones
-Las clases que ya heredan de Clspaginas, se les quita el this a RegistraScript y a Alert puesto que era innecesario (y además al haberlos vuelto métodos estáticos, NO pueden llamarse de un this)
This commit is contained in:
MLopez
2023-01-31 21:56:06 -07:00
parent 1b6f6366c2
commit 021e50c4b7
77 changed files with 323 additions and 341 deletions

View File

@@ -145,12 +145,12 @@ public partial class GPS_Shipments : ClsPaginas
{
IniciaDTStops();
LimpiarModal();
this.RegistraScript("$('#DivShipment').modal({backdrop: 'static', keyboard: false});");
RegistraScript("$('#DivShipment').modal({backdrop: 'static', keyboard: false});");
}
protected void LnkAddNewStop_Click(object sender, EventArgs e)
{
LimpiarModalStop();
this.RegistraScript("$('#DivStop').modal({backdrop: 'static', keyboard: false});");
RegistraScript("$('#DivStop').modal({backdrop: 'static', keyboard: false});");
}
protected void LnkAddStop_Click(object sender, EventArgs e)
{
@@ -190,7 +190,7 @@ public partial class GPS_Shipments : ClsPaginas
this.OnError("Ocurrió un error al registrar la parada (stop)", ex);
}
this.RegistraScript("$('#DivStop').modal('hide');");
RegistraScript("$('#DivStop').modal('hide');");
}
protected void LimpiarModal()
{
@@ -623,13 +623,13 @@ public partial class GPS_Shipments : ClsPaginas
if (TieneError)
{
ObjGPS.RollBack();
this.Alert("No se pudo guardar el shipment.", TipoMensaje.MsgError);
Alert("No se pudo guardar el shipment.", TipoMensaje.MsgError);
}
else
{
ObjGPS.Commit();
this.Alert("El shipment se envió correctamente a FreightVerify.", TipoMensaje.MsgInformacion);
this.RegistraScript("$('#DivShipment').modal('hide');");
Alert("El shipment se envió correctamente a FreightVerify.", TipoMensaje.MsgInformacion);
RegistraScript("$('#DivShipment').modal('hide');");
}
ObjGPS.Dispose();
@@ -639,7 +639,7 @@ public partial class GPS_Shipments : ClsPaginas
}
else
{
this.Alert("No se pudo enviar el shipment a FreightVerify.", TipoMensaje.MsgError);
Alert("No se pudo enviar el shipment a FreightVerify.", TipoMensaje.MsgError);
}
}
@@ -650,7 +650,7 @@ public partial class GPS_Shipments : ClsPaginas
CargaStops(CveShipment);
this.RegistraScript("$('#DivEvent').modal({backdrop: 'static', keyboard: false});", "1");
RegistraScript("$('#DivEvent').modal({backdrop: 'static', keyboard: false});", "1");
CargaPosicionStop(DdlStops.SelectedValue.ToEntero());
UpEvent.Update();
}
@@ -662,7 +662,7 @@ public partial class GPS_Shipments : ClsPaginas
TxtLatLongEvent.Text = string.Format("{0},{1}", row["Lat"].ToString(), row["Lon"].ToString());
TxtLatLongEvent.Text = string.Format("{0},{1}", row["Lat"].ToString(), row["Lon"].ToString());
this.RegistraScript($"cargapin('{row["Lat"].ToString()}','{row["Lon"].ToString()}');", "2"); ;
RegistraScript($"cargapin('{row["Lat"].ToString()}','{row["Lon"].ToString()}');", "2"); ;
}
private void CargaStops(int CveShipment)
{
@@ -693,7 +693,7 @@ public partial class GPS_Shipments : ClsPaginas
}
else
{
this.Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
}
CargaDatos();
UpDatos.Update();
@@ -727,16 +727,16 @@ public partial class GPS_Shipments : ClsPaginas
if (envio)
{
Alert("Se envio el evento correctamente.");
this.RegistraScript("$('#DivEvent').modal('hide');");
RegistraScript("$('#DivEvent').modal('hide');");
}
else
{
this.Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
}
}
else
{
this.Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
Alert("No se pudo eliminar el shipment.", TipoMensaje.MsgError);
}
}