inserito controllo periodo analisi x filtraggio dateTime + classi utility
This commit is contained in:
Binary file not shown.
@@ -303,6 +303,7 @@
|
||||
<Content Include="WebUserControls\mod_menu.ascx" />
|
||||
<Content Include="WebUserControls\mod_menuBottomFullpage.ascx" />
|
||||
<Content Include="WebUserControls\mod_myTempFile.ascx" />
|
||||
<Content Include="WebUserControls\mod_periodoAnalisi.ascx" />
|
||||
<Content Include="WebUserControls\mod_testata.ascx" />
|
||||
<Content Include="WebUserControls\mod_testataProt.ascx" />
|
||||
<Content Include="WebUserControls\mod_textAutocomplete.ascx" />
|
||||
@@ -478,6 +479,13 @@
|
||||
<Compile Include="WebUserControls\mod_myTempFile.ascx.designer.cs">
|
||||
<DependentUpon>mod_myTempFile.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_periodoAnalisi.ascx.cs">
|
||||
<DependentUpon>mod_periodoAnalisi.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_periodoAnalisi.ascx.designer.cs">
|
||||
<DependentUpon>mod_periodoAnalisi.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WebUserControls\mod_testata.ascx.cs">
|
||||
<DependentUpon>mod_testata.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
+53
-51
@@ -4,55 +4,57 @@
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
<configuration>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
|
||||
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
<appSettings>
|
||||
<!--config base applicazione-->
|
||||
<add key="CodModulo" value="ETS-WS" />
|
||||
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
|
||||
<add key="titleApp" value="ETS-WS_titleApp" />
|
||||
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
|
||||
<add key="appName" value="ETS-WS" />
|
||||
<add key="SiteName" value="ETS" />
|
||||
<add key="mainRev" value="0.7" />
|
||||
<add key="minRev" value="60" />
|
||||
<add key="copyRight" value="SteamWare, ETS © 2012" />
|
||||
<add key="tempUplDir" value="~/TempUploads" />
|
||||
<add key="archiveDir" value="~/ArchivioDocs" />
|
||||
<!--update pagina-->
|
||||
<add key="intUpdatePagina_ms" value="120000" />
|
||||
<!--config x WebServices autocompletamento-->
|
||||
<add key="MinCharAutocomplete" value="2" />
|
||||
<add key="MaxRowToDisplay" value="15" />
|
||||
<!--gestione modalità update richiesta-->
|
||||
<add key="instantUpdate" value="true" />
|
||||
<!--area conf dataset classi esterne-->
|
||||
<add key="ETS_WSConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" />
|
||||
<add key="ETS_AnagraficaConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" />
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
|
||||
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.60623.0" newVersion="4.1.60623.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
|
||||
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
<appSettings>
|
||||
<!--config base applicazione-->
|
||||
<add key="CodModulo" value="ETS-WS" />
|
||||
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
|
||||
<add key="titleApp" value="ETS-WS_titleApp" />
|
||||
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
|
||||
<add key="appName" value="ETS-WS" />
|
||||
<add key="SiteName" value="ETS" />
|
||||
<add key="mainRev" value="0.7" />
|
||||
<add key="minRev" value="60" />
|
||||
<add key="copyRight" value="SteamWare, ETS © 2012" />
|
||||
<add key="tempUplDir" value="~/TempUploads" />
|
||||
<add key="archiveDir" value="~/ArchivioDocs" />
|
||||
<!--area date-->
|
||||
<add key="defDayFrom" value="-366"/>
|
||||
<!--update pagina-->
|
||||
<add key="intUpdatePagina_ms" value="120000" />
|
||||
<!--config x WebServices autocompletamento-->
|
||||
<add key="MinCharAutocomplete" value="2" />
|
||||
<add key="MaxRowToDisplay" value="15" />
|
||||
<!--gestione modalità update richiesta-->
|
||||
<add key="instantUpdate" value="true" />
|
||||
<!--area conf dataset classi esterne-->
|
||||
<add key="ETS_WSConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" />
|
||||
<add key="ETS_AnagraficaConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" />
|
||||
</appSettings>
|
||||
<connectionStrings>
|
||||
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
|
||||
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.60623.0" newVersion="4.1.60623.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -2,6 +2,7 @@
|
||||
Inherits="ETS_WS.WebUserControls.mod_filtroRicerca" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<%@ Register Src="mod_textAutocomplete.ascx" TagName="mod_textAutocomplete" TagPrefix="uc1" %>
|
||||
<%@ Register Src="mod_periodoAnalisi.ascx" TagName="mod_periodoAnalisi" TagPrefix="uc2" %>
|
||||
<% if (false)
|
||||
{ %>
|
||||
<link href="../css/BuildBlocks.css" rel="stylesheet" type="text/css" />
|
||||
@@ -13,7 +14,7 @@
|
||||
<div>
|
||||
<div class="divSx secColA-5" style="width: 100%; text-align: left; margin: auto;
|
||||
height: 50px; vertical-align: bottom;">
|
||||
<div style="padding: 4px 8px 4px 8px;">
|
||||
<div style="padding: 4px 8px 4px 8px; font-size: 8pt;">
|
||||
<%--area dx: update + scelta dim pagina--%>
|
||||
<div class="divDx">
|
||||
<asp:Label runat="server" ID="LabelblPageSize" Text="Risultati per pagina" CssClass="labelInput" /><br />
|
||||
@@ -39,9 +40,7 @@
|
||||
</div>
|
||||
<%--Area sx: filtri--%>
|
||||
<div class="divSx">
|
||||
<asp:Label runat="server" ID="lblCerca" Text="Ricerca Libera" CssClass="labelInput" /><br />
|
||||
<asp:TextBox runat="server" ID="txtSearchAll" OnTextChanged="txtSearchAll_TextChanged"
|
||||
AutoPostBack="True" Width="15em" />
|
||||
<uc2:mod_periodoAnalisi ID="mod_periodoAnalisi1" runat="server" realtimeUpdate="true" />
|
||||
</div>
|
||||
<div class="divSx">
|
||||
<asp:CheckBox runat="server" ID="chkCommessa" Text="Filtra Commessa" CssClass="labelInput"
|
||||
@@ -78,6 +77,11 @@
|
||||
<div class="divSx">
|
||||
<asp:Button runat="server" ID="btnUpdate" Text="Update" Enabled="false" OnClick="btnUpdate_Click" />
|
||||
</div>
|
||||
<div class="divSx">
|
||||
<asp:Label runat="server" ID="lblCerca" Text="Ricerca Libera" CssClass="labelInput" /><br />
|
||||
<asp:TextBox runat="server" ID="txtSearchAll" OnTextChanged="txtSearchAll_TextChanged"
|
||||
AutoPostBack="True" Width="15em" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+20
-11
@@ -49,22 +49,13 @@ namespace ETS_WS.WebUserControls {
|
||||
protected global::System.Web.UI.UpdateProgress updtRicerca;
|
||||
|
||||
/// <summary>
|
||||
/// lblCerca control.
|
||||
/// mod_periodoAnalisi1 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 lblCerca;
|
||||
|
||||
/// <summary>
|
||||
/// txtSearchAll 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.TextBox txtSearchAll;
|
||||
protected global::mod_periodoAnalisi mod_periodoAnalisi1;
|
||||
|
||||
/// <summary>
|
||||
/// chkCommessa control.
|
||||
@@ -146,5 +137,23 @@ namespace ETS_WS.WebUserControls {
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button btnUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// lblCerca 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 lblCerca;
|
||||
|
||||
/// <summary>
|
||||
/// txtSearchAll 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.TextBox txtSearchAll;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" Inherits="mod_periodoAnalisi"
|
||||
CodeBehind="mod_periodoAnalisi.ascx.cs" %>
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
<table cellpadding="0" cellspacing="0" class="filtraggio">
|
||||
<tr>
|
||||
<td>
|
||||
<asp:Label ID="lblPeriodo" runat="server" Text="Periodo:" CssClass="labelInput" />
|
||||
|
||||
<asp:DropDownList ID="ddlTipoPeriodo" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DddlTipoPeriodo_SelectedIndexChanged" Font-Size="Smaller">
|
||||
<asp:ListItem Selected="True">selezione</asp:ListItem>
|
||||
<asp:ListItem>oggi</asp:ListItem>
|
||||
<asp:ListItem>ieri</asp:ListItem>
|
||||
<asp:ListItem>questa settimana</asp:ListItem>
|
||||
<asp:ListItem >ultimi 7gg</asp:ListItem>
|
||||
<asp:ListItem>questo mese</asp:ListItem>
|
||||
<asp:ListItem>ultimi 30gg</asp:ListItem>
|
||||
<asp:ListItem>1 anno</asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<br />
|
||||
<asp:TextBox ID="txtInizio" TabIndex="1" runat="server" Width="6em" Font-Size="8pt" MaxLength="10"
|
||||
AutoPostBack="True" OnTextChanged="txtInizio_TextChanged" />
|
||||
<asp:DropDownList ID="ddlOraInizio" TabIndex="2" runat="server" AutoPostBack="True"
|
||||
OnTextChanged="txtInizio_TextChanged" Font-Size="Smaller">
|
||||
<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>
|
||||
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtInizio"
|
||||
FirstDayOfWeek="Monday" Format="dd/MM/yyyy">
|
||||
</asp:CalendarExtender>
|
||||
→
|
||||
<asp:TextBox ID="txtFine" TabIndex="3" runat="server" Width="6em" Font-Size="8pt" MaxLength="10"
|
||||
AutoPostBack="True" OnTextChanged="txtFine_TextChanged" />
|
||||
<asp:DropDownList ID="ddlOraFine" TabIndex="2" runat="server" AutoPostBack="True"
|
||||
OnTextChanged="txtFine_TextChanged" Font-Size="Smaller">
|
||||
<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>
|
||||
<asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFine"
|
||||
FirstDayOfWeek="Monday" Format="dd/MM/yyyy">
|
||||
</asp:CalendarExtender>
|
||||
|
||||
<asp:Button ID="btnUpdate" runat="server" Text="update" Visible="false" OnClick="btnUpdate_Click" />
|
||||
</td>
|
||||
<td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -0,0 +1,349 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using ETS_Data;
|
||||
|
||||
|
||||
public partial class mod_periodoAnalisi : System.Web.UI.UserControl
|
||||
{
|
||||
#region area protected
|
||||
|
||||
protected intervalloDate _intervallo;
|
||||
|
||||
/// <summary>
|
||||
/// avvio componente
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnInit(EventArgs e)
|
||||
{
|
||||
base.OnInit(e);
|
||||
setIntervallo();
|
||||
setDurataMin();
|
||||
}
|
||||
/// <summary>
|
||||
/// definisce se sia da mostrare il selettore delle ore nel controllo
|
||||
/// </summary>
|
||||
protected bool mostraSelOra
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (utils.obj.isInSessionObject("mostraSelOra"))
|
||||
{
|
||||
answ = utils.obj.BoolSessionObj("mostraSelOra");
|
||||
}
|
||||
else
|
||||
{
|
||||
// leggo da sessione e salvo...
|
||||
try
|
||||
{
|
||||
answ = utils.obj.confReadBool("mostraSelOra");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
utils.obj.setSessionVal("mostraSelOra", answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gestione del selettore rapido dell'intervallo temporale...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void DddlTipoPeriodo_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// verifico cosa sia cambiato ed imposto date...
|
||||
datario _datario = new datario();
|
||||
switch (ddlTipoPeriodo.SelectedValue)
|
||||
{
|
||||
case "oggi":
|
||||
_intervallo = _datario.giornata(DateTime.Now);
|
||||
break;
|
||||
case "ieri":
|
||||
_intervallo = _datario.giornata(DateTime.Now.AddDays(-1));
|
||||
break;
|
||||
case "ultimi 7gg":
|
||||
_intervallo = _datario.ultimiGiorni(DateTime.Now, 7);
|
||||
break;
|
||||
case "questa settimana":
|
||||
_intervallo = _datario.questaSett(DateTime.Now);
|
||||
break;
|
||||
case "ultimi 30gg":
|
||||
_intervallo = _datario.ultimiGiorni(DateTime.Now, 30);
|
||||
break;
|
||||
case "questo mese":
|
||||
_intervallo = _datario.questoMese(DateTime.Now);
|
||||
break;
|
||||
case "1 anno":
|
||||
_intervallo = _datario.ultimiGiorni(DateTime.Now, 366);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((intervalloAnalisi.inizio != _intervallo.inizio) || (intervalloAnalisi.fine != _intervallo.fine))
|
||||
{
|
||||
verificaCoerenzaDate();
|
||||
aggiornaDateMostrate(false);
|
||||
if (realtimeUpdate)
|
||||
{
|
||||
esegueUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
// mostro btn update
|
||||
btnUpdate.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua update delle date mostrate da intervallo analisi (ed eventualmente riporta update...)
|
||||
/// </summary>
|
||||
/// <param name="doReportUpdate"></param>
|
||||
private void aggiornaDateMostrate(bool doReportUpdate)
|
||||
{
|
||||
scriviDate();
|
||||
if (doReportUpdate)
|
||||
{
|
||||
reportUpdate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// scrive nuove date in controllo
|
||||
/// </summary>
|
||||
private void scriviDate()
|
||||
{
|
||||
// se intervallo non è valorizzato leggo da sessione...
|
||||
if (!_intervallo.isValid)
|
||||
{
|
||||
_intervallo = intervalloAnalisi;
|
||||
}
|
||||
txtInizio.Text = _intervallo.inizio.ToShortDateString();
|
||||
ddlOraInizio.SelectedValue = _intervallo.inizio.Hour.ToString("00");
|
||||
txtFine.Text = _intervallo.fine.ToShortDateString();
|
||||
ddlOraFine.SelectedValue = _intervallo.fine.Hour.ToString("00");
|
||||
if (mostraSelOra)
|
||||
{
|
||||
ddlOraInizio.Visible = true;
|
||||
ddlOraFine.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ddlOraInizio.Visible = false;
|
||||
ddlOraFine.Visible = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta intervallo da sessione o di default
|
||||
/// </summary>
|
||||
private void setIntervallo()
|
||||
{
|
||||
intervalloDate _intervallo;
|
||||
try
|
||||
{
|
||||
_intervallo = (intervalloDate)Session["_intervallo"];
|
||||
}
|
||||
catch
|
||||
{
|
||||
_intervallo = new intervalloDate();
|
||||
_intervallo.inizio = DateTime.Now.AddDays(utils.obj.confReadInt("defDayFrom"));
|
||||
_intervallo.fine = DateTime.Now.AddDays(1);
|
||||
Session["_intervallo"] = _intervallo;
|
||||
Session["_inizio"] = _intervallo.inizio;
|
||||
Session["_fine"] = _intervallo.fine;
|
||||
}
|
||||
scriviDate();
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta durata minima
|
||||
/// </summary>
|
||||
private void setDurataMin()
|
||||
{
|
||||
int _durataMin;
|
||||
try
|
||||
{
|
||||
_durataMin = (int)Session["_durataMin"];
|
||||
}
|
||||
catch
|
||||
{
|
||||
_durataMin = 0;
|
||||
Session["_durataMin"] = _durataMin;
|
||||
}
|
||||
txtDurataMin.Text = _durataMin.ToString();
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs 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";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// salva in memoria le info
|
||||
/// </summary>
|
||||
private void aggiornaPeriodo()
|
||||
{
|
||||
_intervallo = new intervalloDate();
|
||||
// calcolo tempi arrotondati
|
||||
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);
|
||||
verificaCoerenzaDate();
|
||||
int _durataMin;
|
||||
_durataMin = Convert.ToInt32(txtDurataMin.Text);
|
||||
Session["_durataMin"] = _durataMin;
|
||||
reportUpdate();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica che le date dell'intervallo siano coerenti (inizio < fine)
|
||||
/// </summary>
|
||||
private void verificaCoerenzaDate()
|
||||
{
|
||||
// controllo date siano coerenti (fine > inizio)...
|
||||
if (_intervallo.inizio >= _intervallo.fine)
|
||||
{
|
||||
// controllo non siano date successive ad oggi...
|
||||
if (_intervallo.fine > DateTime.Now)
|
||||
{
|
||||
_intervallo.fine = DateTime.Now;
|
||||
}
|
||||
_intervallo.inizio = _intervallo.fine.AddDays(-1);
|
||||
}
|
||||
//intervalloAnalisi = _intervallo;
|
||||
aggiornaDateMostrate(false);
|
||||
}
|
||||
/// <summary>
|
||||
/// evento cambio testo data inizio
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtInizio_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaModifica();
|
||||
}
|
||||
/// <summary>
|
||||
/// evento cambio testo data fine
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void txtFine_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
salvaModifica();
|
||||
}
|
||||
/// <summary>
|
||||
/// salva modifica datetime
|
||||
/// </summary>
|
||||
private void salvaModifica()
|
||||
{
|
||||
// imposto il selettore a discesa...
|
||||
setPeriodoFree();
|
||||
if (realtimeUpdate)
|
||||
{
|
||||
esegueUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
// mostro btn update
|
||||
btnUpdate.Visible = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// in questo caso faccio udpate periodo mostrato
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
esegueUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// salva dato periodo e nasconde button update
|
||||
/// </summary>
|
||||
private void esegueUpdate()
|
||||
{
|
||||
aggiornaPeriodo();
|
||||
// nascondo btn update
|
||||
btnUpdate.Visible = false;
|
||||
}
|
||||
/// <summary>
|
||||
/// riporta aggiornamento a controller
|
||||
/// </summary>
|
||||
protected void reportUpdate()
|
||||
{
|
||||
intervalloAnalisi = _intervallo;
|
||||
// alzo l'evento d update/inserimento e ricarico cache...
|
||||
if (eh_doUpdate != null)
|
||||
{
|
||||
eh_doUpdate(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region area public
|
||||
|
||||
/// <summary>
|
||||
/// accesso dati intervallo in session
|
||||
/// </summary>
|
||||
public intervalloDate intervalloAnalisi
|
||||
{
|
||||
get
|
||||
{
|
||||
return (intervalloDate)Session["_intervallo"];
|
||||
}
|
||||
set
|
||||
{
|
||||
intervalloDate interv = value;
|
||||
Session["_intervallo"] = interv;
|
||||
Session["_inizio"] = interv.inizio;
|
||||
Session["_fine"] = interv.fine;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua update
|
||||
/// </summary>
|
||||
/// <param name="doReportUpdate"></param>
|
||||
public void doUpdate(bool doReportUpdate)
|
||||
{
|
||||
aggiornaDateMostrate(doReportUpdate);
|
||||
}
|
||||
/// <summary>
|
||||
/// imposta periodo libero di selezione
|
||||
/// </summary>
|
||||
public void setPeriodoFree()
|
||||
{
|
||||
ddlTipoPeriodo.SelectedIndex = 0;
|
||||
}
|
||||
/// <summary>
|
||||
/// determina se sia abilitato il realtime update (o se si deve vedere button update
|
||||
/// </summary>
|
||||
public bool realtimeUpdate
|
||||
{
|
||||
get
|
||||
{
|
||||
return utils.obj.BoolSessionObj("periodoRtUpd");
|
||||
}
|
||||
set
|
||||
{
|
||||
utils.obj.setSessionVal("periodoRtUpd", value);
|
||||
}
|
||||
}
|
||||
|
||||
#region gestione eventi
|
||||
|
||||
public event EventHandler eh_doUpdate;
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
public partial class mod_periodoAnalisi {
|
||||
|
||||
/// <summary>
|
||||
/// lblPeriodo 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 lblPeriodo;
|
||||
|
||||
/// <summary>
|
||||
/// ddlTipoPeriodo 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 ddlTipoPeriodo;
|
||||
|
||||
/// <summary>
|
||||
/// txtInizio 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.TextBox txtInizio;
|
||||
|
||||
/// <summary>
|
||||
/// ddlOraInizio 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;
|
||||
|
||||
/// <summary>
|
||||
/// CalendarExtender1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.CalendarExtender CalendarExtender1;
|
||||
|
||||
/// <summary>
|
||||
/// txtFine 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.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>
|
||||
/// CalendarExtender2 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::AjaxControlToolkit.CalendarExtender CalendarExtender2;
|
||||
|
||||
/// <summary>
|
||||
/// btnUpdate 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.Button btnUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// lblDurataMin 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 lblDurataMin;
|
||||
|
||||
/// <summary>
|
||||
/// txtDurataMin 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.TextBox txtDurataMin;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -362,4 +362,245 @@ namespace ETS_Data
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// definisce un intervalo di 2 date
|
||||
/// </summary>
|
||||
public struct intervalloDate
|
||||
{
|
||||
/// <summary>
|
||||
/// data inizio
|
||||
/// </summary>
|
||||
public DateTime inizio;
|
||||
/// <summary>
|
||||
/// data fine
|
||||
/// </summary>
|
||||
public DateTime fine;
|
||||
/// <summary>
|
||||
/// indica se sia valido il dato, ovvero inizio e fine > 0 e FINE >= INIZIO
|
||||
/// </summary>
|
||||
public bool isValid
|
||||
{
|
||||
get
|
||||
{
|
||||
bool cond1 = false;
|
||||
bool cond2 = false;
|
||||
bool cond3 = false;
|
||||
try
|
||||
{
|
||||
cond1 = inizio > Convert.ToDateTime("01/01/0001");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
try
|
||||
{
|
||||
cond2 = fine > Convert.ToDateTime("01/01/0001");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
try
|
||||
{
|
||||
cond3 = (fine.Subtract(inizio).TotalHours > 0);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return (cond1 && cond2 && cond3);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// classe di funzioni inerenti le date
|
||||
/// </summary>
|
||||
public class datario
|
||||
{
|
||||
/// <summary>
|
||||
/// inizializzazione empty
|
||||
/// </summary>
|
||||
public datario()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// costruisce un oggetto intervallo date
|
||||
/// </summary>
|
||||
/// <param name="inizio"></param>
|
||||
/// <param name="fine"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate setIntervallo(DateTime inizio, DateTime fine)
|
||||
{
|
||||
intervalloDate periodo = new intervalloDate();
|
||||
periodo.inizio = inizio;
|
||||
periodo.fine = fine;
|
||||
return periodo;
|
||||
}
|
||||
/// <summary>
|
||||
/// effettua l'operazione di intersezione tra 2 intervali di date restituendo ulteriore intervallo: NB se sono intervali disgiunti restituisce 9/9/9999 x inizio e fine
|
||||
/// </summary>
|
||||
/// <param name="interv1"></param>
|
||||
/// <param name="interv2"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate intersecaIntervalli(intervalloDate interv1, intervalloDate interv2)
|
||||
{
|
||||
intervalloDate interv3;
|
||||
// verifico non siano disgiunti...
|
||||
if (interv1.fine < interv2.inizio || interv2.fine < interv1.inizio)
|
||||
{
|
||||
interv3.inizio = Convert.ToDateTime("9/9/9999");
|
||||
interv3.fine = Convert.ToDateTime("9/9/9999");
|
||||
}
|
||||
else
|
||||
{
|
||||
interv3 = interv1;
|
||||
if (interv2.inizio > interv1.inizio)
|
||||
{
|
||||
interv3.inizio = interv2.inizio;
|
||||
}
|
||||
if (interv2.fine < interv1.fine)
|
||||
{
|
||||
interv3.fine = interv2.fine;
|
||||
}
|
||||
}
|
||||
return interv3;
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto mese precedente alla dataLilmite
|
||||
/// </summary>
|
||||
/// <param name="dataLimite"></param>
|
||||
public intervalloDate mesePrecedente(DateTime dataLimite)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.inizio = dataLimite.AddMonths(-1).AddDays(-(dataLimite.Day - 1)).Subtract(dataLimite.TimeOfDay);
|
||||
interv.fine = dataLimite.AddDays(-(dataLimite.Day - 1)).Subtract(dataLimite.TimeOfDay);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto mese corrente fino alla dataLilmite
|
||||
/// </summary>
|
||||
/// <param name="dataLimite"></param>
|
||||
public intervalloDate meseCorrente(DateTime dataLimite)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.inizio = dataLimite.AddDays(-(dataLimite.Day - 1)).Subtract(dataLimite.TimeOfDay);
|
||||
interv.fine = dataLimite.Subtract(dataLimite.TimeOfDay);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// confronta le date e restituisce true se le date sono nello stesso mese
|
||||
/// </summary>
|
||||
/// <param name="data1"></param>
|
||||
/// <param name="data2"></param>
|
||||
/// <returns></returns>
|
||||
public bool stessoMese(DateTime data1, DateTime data2)
|
||||
{
|
||||
bool stessoMese = false;
|
||||
if ((data1.Year == data2.Year) && (data1.Month == data2.Month))
|
||||
{
|
||||
stessoMese = true;
|
||||
}
|
||||
return stessoMese;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo del giorno completo che comprende la data indicata
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate giornata(DateTime data)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.inizio = data.Subtract(data.TimeOfDay);
|
||||
interv.fine = interv.inizio.AddDays(1);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo di N giorni fino alla data indicata
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="numGiorniPrima"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate ultimiGiorni(DateTime data, int numGiorniPrima)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.fine = data.Subtract(data.TimeOfDay).AddDays(1);
|
||||
interv.inizio = interv.fine.AddDays(-numGiorniPrima);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo della settimana corrente per la data indicata
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate questaSett(DateTime data)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.fine = data.Subtract(data.TimeOfDay).AddDays(1);
|
||||
DayOfWeek giorno = data.DayOfWeek;
|
||||
int numGG = 0;
|
||||
switch (giorno)
|
||||
{
|
||||
case DayOfWeek.Monday:
|
||||
numGG = 1;
|
||||
break;
|
||||
case DayOfWeek.Tuesday:
|
||||
numGG = 2;
|
||||
break;
|
||||
case DayOfWeek.Wednesday:
|
||||
numGG = 3;
|
||||
break;
|
||||
case DayOfWeek.Thursday:
|
||||
numGG = 4;
|
||||
break;
|
||||
case DayOfWeek.Friday:
|
||||
numGG = 5;
|
||||
break;
|
||||
case DayOfWeek.Saturday:
|
||||
numGG = 6;
|
||||
break;
|
||||
case DayOfWeek.Sunday:
|
||||
numGG = 7;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
interv.inizio = interv.fine.AddDays(-numGG);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo del mese corrente per la data indicata (dal giorno 1 all'indomani delal data indicata)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate questoMese(DateTime data)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.fine = data.Subtract(data.TimeOfDay).AddDays(1);
|
||||
interv.inizio = interv.fine.AddDays(-data.Day);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo del mese che comprende la data indicata (dal primo all'ultimo giorno)
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate estremiMese(DateTime data)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.inizio = data.AddDays(-(data.Day - 1)).Subtract(data.TimeOfDay);
|
||||
interv.fine = interv.inizio.AddMonths(1);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// restituisce l'intervallo dell'anno corrente per la data indicata
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public intervalloDate estremiAnno(DateTime data)
|
||||
{
|
||||
intervalloDate interv = new intervalloDate();
|
||||
interv.inizio = data.AddDays(-(data.Day - 1)).AddMonths(-(data.Month - 1)).Subtract(data.TimeOfDay);
|
||||
interv.fine = interv.inizio.AddMonths(12);
|
||||
return interv;
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto singleton
|
||||
/// </summary>
|
||||
public static datario mngr = new datario();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user