avanzamenti x componente selettore date (ma fa ancora abb schifio...)

This commit is contained in:
Samuele E. Locatelli
2014-03-28 18:06:31 +01:00
parent a12058bc8e
commit cb7f4eaf65
6 changed files with 230 additions and 152 deletions
+53 -23
View File
@@ -6,29 +6,59 @@
*/
// Gestione oggetti datepicker (globale)
function fixDatePicker()
{
$.datepicker.setDefaults($.datepicker.regional["it"]);
$(".datepicker").datepicker({
//showOtherMonths: true,
//selectOtherMonths: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy"
});
}
//// Gestione oggetti datepicker (globale)
//function fixDatePicker() {
// $.datepicker.setDefaults($.datepicker.regional["it"]);
// $(".datepicker").datepicker({
// //showOtherMonths: true,
// //selectOtherMonths: true,
// showButtonPanel: true,
// changeMonth: true,
// changeYear: true,
// dateFormat: "dd/mm/yy"
// });
//}
// richiamo quando il DOM della pagina è ok...
$(function () {
fixDatePicker();
});
//// richiamo quando il DOM della pagina è ok...
//$(function () {
// fixDatePicker();
//});
// oggetto da legare all'update parziale ajax x sistemare script vari
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
// re-bind post eventi here
fixDatePicker();
});
//// oggetto da legare all'update parziale ajax x sistemare script vari
//var prm = Sys.WebForms.PageRequestManager.getInstance();
//prm.add_endRequest(function () {
// // re-bind your jQuery events here
// $(function () {
// fixDatePicker();
// });
//});
//$(function () {
// $.datepicker.setDefaults($.datepicker.regional["it"]);
// $(".datepicker").datepicker({
// //showOtherMonths: true,
// //selectOtherMonths: true,
// showButtonPanel: true,
// changeMonth: true,
// changeYear: true,
// dateFormat: "dd/mm/yy"
// });
//});
//// oggetto da legare all'update parziale ajax x sistemare btns & co
//var prm = Sys.WebForms.PageRequestManager.getInstance();
//prm.add_endRequest(function () {
// // re-bind your jQuery events here
// $(function () {
// $.datepicker.setDefaults($.datepicker.regional["it"]);
// $(".datepicker").datepicker({
// //showOtherMonths: true,
// //selectOtherMonths: true,
// showButtonPanel: true,
// changeMonth: true,
// changeYear: true,
// dateFormat: "dd/mm/yy"
// });
// });
//});
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="col-sm-4">
<div class="row">
<div class="col-md-12">
<uc2:mod_selPeriodo ID="mod_selPeriodo1" runat="server" />
<uc2:mod_selPeriodo ID="mod_selPeriodo1" runat="server" autoUpdate="true" />
</div>
<div class="col-md-12">
<uc1:mod_autocomplete runat="server" ID="acCliente" contextKey="c" minCharAutocomplete="2" showKey="false" ServicePath="../Services/WS_data.asmx/Clients" placeholder="Ricerca Cliente" />
+98 -89
View File
@@ -1,7 +1,11 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_selPeriodo.ascx.cs" Inherits="C2P.WebUserControls.mod_selPeriodo" %>
<%--<script>
$(function () {
<%if (false)
{ %>
<webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" />
<%} %>
<script>
// Gestione oggetti datepicker (globale)
function fixDatePicker() {
$.datepicker.setDefaults($.datepicker.regional["it"]);
$(".datepicker").datepicker({
//showOtherMonths: true,
@@ -11,99 +15,104 @@
changeYear: true,
dateFormat: "dd/mm/yy"
});
}
// richiamo quando il DOM della pagina è ok...
$(function () {
fixDatePicker();
});
// oggetto da legare all'update parziale ajax x sistemare btns & co
// oggetto da legare all'update parziale ajax x sistemare script vari
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
// re-bind your jQuery events here
$(function () {
$.datepicker.setDefaults($.datepicker.regional["it"]);
$(".datepicker").datepicker({
//showOtherMonths: true,
//selectOtherMonths: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy"
});
fixDatePicker();
});
});
</script>--%>
<div style="font-size:8pt;">
<asp:Label ID="lblPeriodo" runat="server"></asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="txtInizio" TabIndex="1" runat="server" Width="6em" MaxLength="10" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" CssClass="datepicker" />
<asp:DropDownList ID="ddlOraInizio" TabIndex="2" runat="server" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" CssClass="btn btn-default btn-sm">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>13</asp:ListItem>
<asp:ListItem>14</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>16</asp:ListItem>
<asp:ListItem>17</asp:ListItem>
<asp:ListItem>18</asp:ListItem>
<asp:ListItem>19</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>21</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>23</asp:ListItem>
</asp:DropDownList>
</script>
<div style="font-size: 8pt;">
<div class="input-group">
<span class="input-group-addon">
<asp:Label ID="lblPeriodo" runat="server"><%: traduci("Date") %></asp:Label>
</span>
<asp:TextBox ID="txtInizio" TabIndex="1" runat="server" Width="6em" MaxLength="10" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" CssClass="datepicker form-control" />
<%--<asp:DropDownList ID="ddlOraInizio" TabIndex="2" runat="server" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" CssClass="btn btn-default btn-sm">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>13</asp:ListItem>
<asp:ListItem>14</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>16</asp:ListItem>
<asp:ListItem>17</asp:ListItem>
<asp:ListItem>18</asp:ListItem>
<asp:ListItem>19</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>21</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>23</asp:ListItem>
</asp:DropDownList>--%>
</div>
<div class="input-group">
<span class="input-group-addon">
<asp:Label ID="Label1" runat="server"><%: traduci("Date") %></asp:Label>
</span>
<%--&nbsp;&#8594&nbsp;--%>
<asp:TextBox ID="txtFine" TabIndex="3" runat="server" Width="6em" MaxLength="10" AutoPostBack="True" OnTextChanged="txtFine_TextChanged" CssClass="datepicker form-control" />
<%--<asp:DropDownList ID="ddlOraFine" TabIndex="2" runat="server" AutoPostBack="True" OnTextChanged="txtFine_TextChanged" CssClass="btn btn-default btn-sm">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>13</asp:ListItem>
<asp:ListItem>14</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>16</asp:ListItem>
<asp:ListItem>17</asp:ListItem>
<asp:ListItem>18</asp:ListItem>
<asp:ListItem>19</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>21</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>23</asp:ListItem>
</asp:DropDownList>--%>
<span class="input-group-addon">
<asp:DropDownList ID="ddlSelPeriodo" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSelPeriodo_SelectedIndexChanged" CssClass="btn btn-default btn-xs">
<asp:ListItem Value="1">selezione</asp:ListItem>
<asp:ListItem Value="2">oggi</asp:ListItem>
<asp:ListItem Value="3">ieri</asp:ListItem>
<asp:ListItem>questa sett.</asp:ListItem>
<asp:ListItem Selected="True">ultimi 7gg</asp:ListItem>
<asp:ListItem>questo mese</asp:ListItem>
<asp:ListItem>ultimi 30gg</asp:ListItem>
<asp:ListItem>1 anno</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnUpdate" CssClass="btn btn-default btn-xs" runat="server" Text="update" Visible="false" OnClick="btnUpdate_Click" />
&nbsp;&#8594&nbsp;
<asp:TextBox ID="txtFine" TabIndex="3" runat="server" Width="6em" MaxLength="10" AutoPostBack="True" OnTextChanged="txtFine_TextChanged" CssClass="datepicker" />
<asp:DropDownList ID="ddlOraFine" TabIndex="2" runat="server" AutoPostBack="True" OnTextChanged="txtFine_TextChanged" CssClass="btn btn-default btn-sm">
<asp:ListItem>00</asp:ListItem>
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>13</asp:ListItem>
<asp:ListItem>14</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>16</asp:ListItem>
<asp:ListItem>17</asp:ListItem>
<asp:ListItem>18</asp:ListItem>
<asp:ListItem>19</asp:ListItem>
<asp:ListItem>20</asp:ListItem>
<asp:ListItem>21</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>23</asp:ListItem>
</asp:DropDownList>
&nbsp;&nbsp;&nbsp;
<asp:DropDownList ID="ddlSelPeriodo" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSelPeriodo_SelectedIndexChanged" CssClass="btn btn-default btn-sm">
<asp:ListItem>selezione</asp:ListItem>
<asp:ListItem>oggi</asp:ListItem>
<asp:ListItem>ieri</asp:ListItem>
<asp:ListItem>questa settimana</asp:ListItem>
<asp:ListItem Selected="True">ultimi 7gg</asp:ListItem>
<asp:ListItem>questo mese</asp:ListItem>
<asp:ListItem>ultimi 30gg</asp:ListItem>
<asp:ListItem>1 anno</asp:ListItem>
</asp:DropDownList>
&nbsp;&nbsp;&nbsp;
<asp:Button ID="btnUpdate" CssClass="btn btn-default btn-sm" runat="server" Text="update" Visible="false" OnClick="btnUpdate_Click" />
&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblDurataMin" runat="server" Visible="false"></asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="txtDurataMin" TabIndex="3" runat="server" Width="30px" MaxLength="3" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" Visible="false"></asp:TextBox>
<asp:Label ID="lblDurataMin" runat="server" Visible="false"></asp:Label>
<asp:TextBox ID="txtDurataMin" TabIndex="3" runat="server" Width="30px" MaxLength="3" AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" Visible="false"></asp:TextBox>
</span>
</div>
</div>
+67 -28
View File
@@ -11,10 +11,21 @@ namespace C2P.WebUserControls
{
public partial class mod_selPeriodo : System.Web.UI.UserControl
{
#region area protected
protected intervalloDate _intervallo;
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
txtInizio.ToolTip = "inizio periodo di riferimento per i dati mostrati";
txtFine.ToolTip = "fine periodo di riferimento per i dati mostrati";
lblDurataMin.Text = "Visualizza eventi con durata superiore a";
}
}
/// <summary>
/// avvio componente
/// </summary>
@@ -22,6 +33,9 @@ namespace C2P.WebUserControls
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
txtInizio.ToolTip = "inizio periodo di riferimento per i dati mostrati";
txtFine.ToolTip = "fine periodo di riferimento per i dati mostrati";
lblDurataMin.Text = "Visualizza eventi con durata superiore a";
setIntervallo();
setDurataMin();
}
@@ -63,10 +77,12 @@ namespace C2P.WebUserControls
datario _datario = new datario();
switch (ddlSelPeriodo.SelectedValue)
{
case "oggi":
case "1": // selezione libera
break;
case "2": // oggi
_intervallo = _datario.giornata(DateTime.Now);
break;
case "ieri":
case "3": // ieri
_intervallo = _datario.giornata(DateTime.Now.AddDays(-1));
break;
case "ultimi 7gg":
@@ -93,6 +109,10 @@ namespace C2P.WebUserControls
aggiornaDateMostrate(false);
// mostro btn update
btnUpdate.Visible = true;
if (autoUpdate)
{
forceUpdate();
}
}
}
/// <summary>
@@ -118,8 +138,9 @@ namespace C2P.WebUserControls
_intervallo = intervalloAnalisi;
}
txtInizio.Text = _intervallo.inizio.ToShortDateString();
ddlOraInizio.SelectedValue = _intervallo.inizio.Hour.ToString("00");
txtFine.Text = _intervallo.fine.ToShortDateString();
#if false
ddlOraInizio.SelectedValue = _intervallo.inizio.Hour.ToString("00");
ddlOraFine.SelectedValue = _intervallo.fine.Hour.ToString("00");
if (mostraSelOra)
{
@@ -131,6 +152,8 @@ namespace C2P.WebUserControls
ddlOraInizio.Visible = false;
ddlOraFine.Visible = false;
}
#endif
}
/// <summary>
/// imposta intervallo da sessione o di default
@@ -171,27 +194,20 @@ namespace C2P.WebUserControls
txtDurataMin.Text = _durataMin.ToString();
}
/// <summary>
/// caricamento pagina
/// update periodo
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
lblPeriodo.Text = "Periodo di riferimento: ";
txtInizio.ToolTip = "inizio periodo di riferimento per i dati mostrati";
txtFine.ToolTip = "fine periodo di riferimento per i dati mostrati";
lblDurataMin.Text = "Visualizza eventi con durata superiore a";
}
private void aggiornaPeriodo()
{
_intervallo = new intervalloDate();
// calcolo tempi arrotondati
#if false
int oraInizio = Convert.ToInt32(ddlOraInizio.SelectedValue);
int oraFine = Convert.ToInt32(ddlOraFine.SelectedValue);
_intervallo.inizio = Convert.ToDateTime(txtInizio.Text).AddHours(oraInizio);
_intervallo.fine = Convert.ToDateTime(txtFine.Text).AddHours(oraFine);
_intervallo.fine = Convert.ToDateTime(txtFine.Text).AddHours(oraFine);
#endif
_intervallo.inizio = Convert.ToDateTime(txtInizio.Text);
_intervallo.fine = Convert.ToDateTime(txtFine.Text);
verificaCoerenzaDate();
int _durataMin;
_durataMin = Convert.ToInt32(txtDurataMin.Text);
@@ -223,11 +239,22 @@ namespace C2P.WebUserControls
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtInizio_TextChanged(object sender, EventArgs e)
{
procDateMod();
}
/// <summary>
/// verifica la modifica delle date..
/// </summary>
private void procDateMod()
{
// imposto il selettore a discesa...
setPeriodoFree();
// mostro btn update
btnUpdate.Visible = true;
if (autoUpdate)
{
forceUpdate();
}
}
/// <summary>
/// evento cambio testo data fine
@@ -236,10 +263,7 @@ namespace C2P.WebUserControls
/// <param name="e"></param>
protected void txtFine_TextChanged(object sender, EventArgs e)
{
// imposto il selettore a discesa...
setPeriodoFree();
// mostro btn update
btnUpdate.Visible = true;
procDateMod();
}
/// <summary>
/// in questo caso faccio udpate periodo mostrato
@@ -247,6 +271,13 @@ namespace C2P.WebUserControls
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUpdate_Click(object sender, EventArgs e)
{
forceUpdate();
}
/// <summary>
/// forza update
/// </summary>
private void forceUpdate()
{
aggiornaPeriodo();
// nascondo btn update
@@ -265,10 +296,6 @@ namespace C2P.WebUserControls
}
}
#endregion
#region area public
public intervalloDate intervalloAnalisi
{
get
@@ -300,6 +327,19 @@ namespace C2P.WebUserControls
{
ddlSelPeriodo.SelectedIndex = 0;
}
/// <summary>
/// indica se il controllo debba fare update in automatico o attendere pressione button update da utente
/// </summary>
public bool autoUpdate { get; set; }
/// <summary>
/// wrapper traduzione
/// </summary>
/// <param name="lemma"></param>
/// <returns></returns>
public string traduci(object lemma)
{
return user_std.UtSn.Traduci(lemma.ToString());
}
#region gestione eventi
@@ -308,6 +348,5 @@ namespace C2P.WebUserControls
#endregion
#endregion
}
}
+11 -11
View File
@@ -12,6 +12,15 @@ namespace C2P.WebUserControls {
public partial class mod_selPeriodo {
/// <summary>
/// BundleReference1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Microsoft.AspNet.Web.Optimization.WebForms.BundleReference BundleReference1;
/// <summary>
/// lblPeriodo control.
/// </summary>
@@ -31,13 +40,13 @@ namespace C2P.WebUserControls {
protected global::System.Web.UI.WebControls.TextBox txtInizio;
/// <summary>
/// ddlOraInizio control.
/// Label1 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.DropDownList ddlOraInizio;
protected global::System.Web.UI.WebControls.Label Label1;
/// <summary>
/// txtFine control.
@@ -48,15 +57,6 @@ namespace C2P.WebUserControls {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtFine;
/// <summary>
/// ddlOraFine 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.DropDownList ddlOraFine;
/// <summary>
/// ddlSelPeriodo control.
/// </summary>
BIN
View File
Binary file not shown.