Fix controllo calendario dataOra...
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_attivitaIns.ascx.cs" Inherits="GPW.WebUserControls.mod_attivitaIns" %>
|
||||
<%@ Register Src="mod_dateTimeJQM.ascx" TagName="mod_dateTimeJQM" TagPrefix="uc1" %>
|
||||
|
||||
|
||||
|
||||
<div data-role="header" data-position="fixed">
|
||||
<h3>Edit / Nuova Attività</h3>
|
||||
</div>
|
||||
|
||||
@@ -1,39 +1,44 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_dateTimeJQM.ascx.cs" Inherits="GPW.WebUserControls.mod_dateTimeJQM" %>
|
||||
<% if (false)
|
||||
{ %>
|
||||
<link rel="stylesheet" type="text/css" href="~/Content/jquery.mobile-1.4.5.min.css" />
|
||||
<script type="text/javascript" src="~/Scripts/jquery-3.1.1.min.js"></script>
|
||||
<script type="text/javascript" src="~/Scripts/jquery.mobile-1.4.5.min.js"></script>
|
||||
<% } %>
|
||||
<div class="ui-grid-a">
|
||||
<div class="ui-block-a" style="font-size: xx-small; text-align: right;">
|
||||
<asp:Label runat="server" ID="lblData" />
|
||||
<asp:HyperLink ID="hlPUCal" runat="server" NavigateUrl="#popupBasic" data-rel="popup" data-role="button" data-mini="true">
|
||||
<asp:Label runat="server" ID="lblDataRif" Font-Size="11pt" />
|
||||
</asp:HyperLink>
|
||||
<asp:Panel runat="server" data-role="popup" ID="popupBasic">
|
||||
<p>
|
||||
<asp:Calendar runat="server" ID="calDataRif" OnSelectionChanged="calDataRif_SelectionChanged" />
|
||||
</p>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
<div class="ui-block-b" style="font-size: xx-small;">
|
||||
<asp:Label runat="server" ID="lblOra" />
|
||||
<fieldset data-role="controlgroup" data-type="horizontal">
|
||||
<asp:DropDownList runat="server" ID="ddlOra" name="Ora" DataSourceID="odsOra" DataTextField="Ora" DataValueField="Ora" data-mini="true">
|
||||
</asp:DropDownList>
|
||||
<asp:DropDownList runat="server" ID="ddlMin" name="Min" DataSourceID="odsMin" DataTextField="Minuto" DataValueField="Minuto"
|
||||
data-mini="true">
|
||||
</asp:DropDownList>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<asp:TextBox runat="server" ID="txtData" TextMode="Date" />
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<asp:DropDownList runat="server" ID="ddlOra" name="Ora" DataSourceID="odsOra" DataTextField="Ora" DataValueField="Ora" data-mini="true">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<asp:DropDownList runat="server" ID="ddlMin" name="Min" DataSourceID="odsMin" DataTextField="Minuto" DataValueField="Minuto"
|
||||
data-mini="true">
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<asp:ObjectDataSource ID="odsOra" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GPW_data.DS_UtilityTableAdapters.stp_getHoursTableAdapter">
|
||||
</asp:ObjectDataSource>
|
||||
|
||||
<%--<div class="ui-grid-a">
|
||||
<div class="ui-block-a" style="font-size: xx-small; text-align: right;">
|
||||
<asp:Label runat="server" ID="lblData" />
|
||||
<asp:HyperLink ID="hlPUCal" runat="server" NavigateUrl="#popupBasic" data-rel="popup" data-role="button" data-mini="true">
|
||||
<asp:Label runat="server" ID="lblDataRif" Font-Size="11pt" />
|
||||
</asp:HyperLink>
|
||||
<asp:Panel runat="server" data-role="popup" ID="popupBasic">
|
||||
<p>
|
||||
<asp:Calendar runat="server" ID="calDataRif" OnSelectionChanged="calDataRif_SelectionChanged" />
|
||||
</p>
|
||||
</asp:Panel>
|
||||
</div>
|
||||
<div class="ui-block-b" style="font-size: xx-small;">
|
||||
<asp:Label runat="server" ID="lblOra" />
|
||||
<fieldset data-role="controlgroup" data-type="horizontal">
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>--%>
|
||||
<asp:ObjectDataSource ID="odsOra" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="GPW_data.DS_UtilityTableAdapters.stp_getHoursTableAdapter"></asp:ObjectDataSource>
|
||||
<asp:ObjectDataSource ID="odsMin" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData" TypeName="GPW_data.DS_UtilityTableAdapters.stp_getMinTableAdapter">
|
||||
<SelectParameters>
|
||||
<%--<asp:Parameter DefaultValue="5" Name="interv" Type="Int32" />--%>
|
||||
<asp:ControlParameter ControlID="lblSnapMin" DefaultValue="5" Name="interv" Type="Int32" PropertyName="Text" />
|
||||
</SelectParameters>
|
||||
<SelectParameters>
|
||||
<%--<asp:Parameter DefaultValue="5" Name="interv" Type="Int32" />--%>
|
||||
<asp:ControlParameter ControlID="lblSnapMin" DefaultValue="5" Name="interv" Type="Int32" PropertyName="Text" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
<asp:Label runat="server" Visible="false" ID="lblSnapMin" />
|
||||
@@ -1,111 +1,62 @@
|
||||
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
|
||||
public partial class mod_dateTimeJQM : 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>
|
||||
/// avvio pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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("$", "_");
|
||||
}
|
||||
/// <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(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();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// stringa data
|
||||
/// </summary>
|
||||
public string lblabelData
|
||||
{
|
||||
get
|
||||
{
|
||||
return lblData.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
lblData.Text = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// stringa ora
|
||||
/// </summary>
|
||||
public string lblabelOra
|
||||
{
|
||||
get
|
||||
{
|
||||
return lblOra.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
lblOra.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// aggiorno data selezionata!
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-69
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace GPW.WebUserControls {
|
||||
@@ -13,101 +13,56 @@ namespace GPW.WebUserControls {
|
||||
public partial class mod_dateTimeJQM {
|
||||
|
||||
/// <summary>
|
||||
/// lblData control.
|
||||
/// Controllo txtData.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblData;
|
||||
protected global::System.Web.UI.WebControls.TextBox txtData;
|
||||
|
||||
/// <summary>
|
||||
/// hlPUCal control.
|
||||
/// Controllo ddlOra.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink hlPUCal;
|
||||
|
||||
/// <summary>
|
||||
/// lblDataRif control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblDataRif;
|
||||
|
||||
/// <summary>
|
||||
/// popupBasic control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Panel popupBasic;
|
||||
|
||||
/// <summary>
|
||||
/// calDataRif control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Calendar calDataRif;
|
||||
|
||||
/// <summary>
|
||||
/// lblOra control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblOra;
|
||||
|
||||
/// <summary>
|
||||
/// ddlOra control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList ddlOra;
|
||||
|
||||
/// <summary>
|
||||
/// ddlMin control.
|
||||
/// Controllo ddlMin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList ddlMin;
|
||||
|
||||
/// <summary>
|
||||
/// odsOra control.
|
||||
/// Controllo odsOra.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource odsOra;
|
||||
|
||||
/// <summary>
|
||||
/// odsMin control.
|
||||
/// Controllo odsMin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource odsMin;
|
||||
|
||||
/// <summary>
|
||||
/// lblSnapMin control.
|
||||
/// Controllo lblSnapMin.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblSnapMin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user