//======================================================================= // 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"); } } /// /// Bloquea la interfaz del control para que el mismo no pueda ser modificado /// public bool ReadOnly { get { return this.txtDate.Enabled; } set { this.txtDate.Enabled = value; this.CalendarDate.Enabled = value; } } /// /// Devuelve o define la fecha elegida en el calendario /// public Nullable FechaElegida { get { return Convert.ToDateTime(this.txtDate.Text); } set { txtDate.Text = value == null ? string.Empty : Convert.ToDateTime(value).ToString("dd/MM/yyyy"); } } /// /// Metodo que valida si la fecha ingresada por el usuario es valida /// /// /// protected void txtDate_TextChanged(object sender, EventArgs e) { validarFecha(); } /// /// Metodo que valida si la fecha ingresada por el usuario es valida /// 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; } } }