using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace GPW.WebUserControls { public partial class mod_dateTimeJQM : System.Web.UI.UserControl { /// /// avvio pagina /// /// /// protected void Page_Load(object sender, EventArgs e) { // cambio il target x il popup che mostrerà il selettore calendario... hlPUCal.NavigateUrl = string.Format("#{0}", popupBasic.UniqueID).Replace("$", "_"); } /// /// Valore di arrotondamento x selettore minuti /// public int snapMinuti { get { int answ = 5; try { answ = Convert.ToInt32(lblSnapMin.Text); } catch { } return answ; } set { lblSnapMin.Text = value.ToString(); } } /// /// valore datetime selezionato! /// public DateTime valoreDateTime { get { DateTime answ = DateTime.Now; try { int oreSel = Convert.ToInt32(ddlOra.SelectedValue); int minSel = Convert.ToInt32(ddlMin.SelectedValue); answ = Convert.ToDateTime(lblDataRif.Text).AddHours(oreSel).AddMinutes(minSel); } catch { } return answ; } set { lblDataRif.Text = value.Date.ToShortDateString(); ddlOra.SelectedValue = value.Hour.ToString(); ddlMin.SelectedValue = value.Minute.ToString(); } } /// /// stringa data /// public string lblabelData { get { return lblData.Text; } set { lblData.Text = value; } } /// /// stringa ora /// public string lblabelOra { get { return lblOra.Text; } set { lblOra.Text = value; } } /// /// aggiorno data selezionata! /// /// /// protected void calDataRif_SelectionChanged(object sender, EventArgs e) { // recupero ore e minuti... int oreSel = Convert.ToInt32(ddlOra.SelectedValue); int minSel = Convert.ToInt32(ddlMin.SelectedValue); valoreDateTime = calDataRif.SelectedDate.AddHours(oreSel).AddMinutes(minSel); } } }