88 lines
2.9 KiB
C#
88 lines
2.9 KiB
C#
//=======================================================================
|
||
// Instituto Costarricense de Acueductos y Alcantarillados. - 2012
|
||
// Sistema de Autoevaluación para Control Interno
|
||
//
|
||
// Explicación de los contenidos del archivo.
|
||
// =========================================================================
|
||
// Historial
|
||
// PERSONA DIA – MES - AÑO DESCRIPCIÓN
|
||
// Pedro Leiva Cerdas 19 – Abril - 2012 Entrega del sistema.
|
||
// …………………………………………………………
|
||
// …………………………………………………………
|
||
// //======================================================================
|
||
// Derechos Reservados (C) 2012 AyA.
|
||
// ESTE CÓDIGO ES PROVEÍDO “TAL CUAL ES” SIN GARANTÍA ALGUNA
|
||
// DE NINGÚN TIPO, SEA IMPLICITA O EXPLICITA.
|
||
// NO SE PERMITE SU REPRODUCCIÓN PARCIAL O TOTAL, NI SU COMERCIALIZACIÓN
|
||
//======================================================================
|
||
using System;
|
||
using System.Web.UI;
|
||
|
||
public partial class _controlesusuario_cuwCalendario : System.Web.UI.UserControl
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!Page.IsPostBack)
|
||
{
|
||
this.txtDate.Text = DateTime.Today.ToString("dd/MM/yyyy");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Bloquea la interfaz del control para que el mismo no pueda ser modificado
|
||
/// </summary>
|
||
public bool ReadOnly
|
||
{
|
||
get
|
||
{
|
||
return this.txtDate.Enabled;
|
||
}
|
||
set
|
||
{
|
||
this.txtDate.Enabled = value;
|
||
this.CalendarDate.Enabled = value;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Devuelve o define la fecha elegida en el calendario
|
||
/// </summary>
|
||
public Nullable<DateTime> FechaElegida
|
||
{
|
||
get
|
||
{
|
||
return Convert.ToDateTime(this.txtDate.Text);
|
||
}
|
||
set
|
||
{
|
||
txtDate.Text = value == null ? string.Empty : Convert.ToDateTime(value).ToString("dd/MM/yyyy");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Metodo que valida si la fecha ingresada por el usuario es valida
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void txtDate_TextChanged(object sender, EventArgs e)
|
||
{
|
||
validarFecha();
|
||
}
|
||
|
||
/// <summary>
|
||
/// Metodo que valida si la fecha ingresada por el usuario es valida
|
||
/// </summary>
|
||
private void validarFecha()
|
||
{
|
||
try
|
||
{
|
||
string[] fecha = txtDate.Text.Split('/');
|
||
DateTime dtTemp = new DateTime(Convert.ToInt32(fecha[2]), Convert.ToInt32(fecha[1]), Convert.ToInt32(fecha[0]));
|
||
}
|
||
catch
|
||
{
|
||
//this.cuwMensajeAviso.showMessage(Resources.MensajesAplicacion.FechaErronea, TiposDeMensaje.ALERTA);
|
||
FechaElegida = DateTime.Today;
|
||
}
|
||
}
|
||
}
|