diff --git a/Site.master.vb b/Site.master.vb index bef60c318..9e2ae8cb7 100644 --- a/Site.master.vb +++ b/Site.master.vb @@ -460,7 +460,7 @@ Partial Class Site 'End If 'OC.Dispose() - LtlMNotificaciones.Text = LtlMNotificaciones.Text & Notificaciones.ToString + LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString) Notificaciones.Clear() End Sub @@ -494,11 +494,41 @@ Partial Class Site #Region "TIPO DE CAMBIO" Private Sub CargaTipoCambio() + + If Application("TipoCambioActual") Is Nothing Then + 'sino existe el dato, lo carga por ser la primera vez + Application("TipoCambioActual") = GetTipoCambio() + Else + Dim TCA As TipoCambioActual = CType(Application("TipoCambioActual"), TipoCambioActual) + If TCA.Fecha <> DateTime.Today Then + Application("TipoCambioActual") = GetTipoCambio() + End If + End If + lblTipoCambio.Text = String.Format(" | TC {0:C4}", CType(Application("TipoCambioActual"), TipoCambioActual).TipoCambio) + + End Sub + + Private Function GetTipoCambio() As TipoCambioActual + Dim Retorno As TipoCambioActual = Nothing + + 'sino existe el dato, lo carga por ser la primera vez Dim ObjGenerales As ClsGenerales = New ClsGenerales - If ObjGenerales.GetTipoCambio(-1, DateTime.Now) And ObjGenerales.DtResultados.Rows.Count > 0 Then - lblTipoCambio.Text = String.Format(" | TC {0:C4}", ObjGenerales.DtResultados(0)("TipoCambio").ToString().ToDecimal()) + If ObjGenerales.GetTipoCambio(-1, DateTime.Today) And ObjGenerales.DtResultados.Rows.Count > 0 Then + 'lblTipoCambio.Text = String.Format(" | TC {0:C4}", ObjGenerales.DtResultados(0)("TipoCambio").ToString().ToDecimal()) + If ObjGenerales.DtResultados.Rows.Count > 0 Then + Retorno = New TipoCambioActual With {.Fecha = DateTime.Today, .TipoCambio = ObjGenerales.DtResultados(0)("TipoCambio").ToString().ToDecimal()} + End If + End If ObjGenerales.Dispose() - End Sub + + Return Retorno + End Function + + #End Region +End Class +Public Class TipoCambioActual + Public Fecha As Date + Public TipoCambio As Decimal End Class \ No newline at end of file