TFS_ANTIGUO/SIGPC/ProyectoSIGPC/ControlUsuario/cuwCalendario.ascx.cs
kledezma 7fdadc4709 KLB
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C519
2021-01-22 15:05:35 +00:00

88 lines
2.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=======================================================================
// 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;
}
}
}