Files
2021-03-26 17:17:28 +01:00

62 lines
1.3 KiB
C#

using System;
namespace GPW.WebUserControls
{
public partial class mod_dateTime : System.Web.UI.UserControl
{
/// <summary>
/// avvio pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Valore di arrotondamento x selettore minuti
/// </summary>
public int snapMinuti
{
get
{
int answ = 5;
try
{
answ = Convert.ToInt32(lblSnapMin.Text);
}
catch
{ }
return answ;
}
set
{
lblSnapMin.Text = value.ToString();
}
}
/// <summary>
/// valore datetime selezionato!
/// </summary>
public DateTime valoreDateTime
{
get
{
DateTime answ = DateTime.Now;
try
{
int oreSel = Convert.ToInt32(ddlOra.SelectedValue);
int minSel = Convert.ToInt32(ddlMin.SelectedValue);
answ = Convert.ToDateTime(txtData.Text).AddHours(oreSel).AddMinutes(minSel);
}
catch
{ }
return answ;
}
set
{
txtData.Text = value.Date.ToString("yyyy-MM-dd");
ddlOra.SelectedValue = value.Hour.ToString();
ddlMin.SelectedValue = value.Minute.ToString();
}
}
}
}