From 9a699f8f44c7e6622e64d9c5d975a773bbfe0759 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sun, 3 Jun 2018 22:53:32 +0200 Subject: [PATCH] abbozzato controllo recupero SeqStati --- MP-Site/MP-Site.csproj | 8 +++ MP-Site/WS/MPData.asmx.cs | 68 ++++++++++++++++++- .../WebUserControls/mod_sequencerStatiJS.ascx | 57 ++++++++++++++++ .../mod_sequencerStatiJS.ascx.cs | 61 +++++++++++++++++ .../mod_sequencerStatiJS.ascx.designer.cs | 42 ++++++++++++ MP-Site/test.aspx | 24 ++++--- MP-Site/test.aspx.designer.cs | 9 +++ 7 files changed, 257 insertions(+), 12 deletions(-) create mode 100644 MP-Site/WebUserControls/mod_sequencerStatiJS.ascx create mode 100644 MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.cs create mode 100644 MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.designer.cs diff --git a/MP-Site/MP-Site.csproj b/MP-Site/MP-Site.csproj index e50cc363..52edb626 100644 --- a/MP-Site/MP-Site.csproj +++ b/MP-Site/MP-Site.csproj @@ -543,6 +543,13 @@ mod_sequencerStati.ascx + + mod_sequencerStatiJS.ascx + ASPXCodeBehind + + + mod_sequencerStatiJS.ascx + mod_sequencerTempiCiclo.ascx ASPXCodeBehind @@ -682,6 +689,7 @@ PreserveNewest + diff --git a/MP-Site/WS/MPData.asmx.cs b/MP-Site/WS/MPData.asmx.cs index d1a0efe4..89d3c252 100644 --- a/MP-Site/WS/MPData.asmx.cs +++ b/MP-Site/WS/MPData.asmx.cs @@ -1,4 +1,5 @@ -using System; +using SteamWare; +using System; using System.Web.Script.Serialization; using System.Web.Script.Services; using System.Web.Services; @@ -68,6 +69,71 @@ namespace MoonPro.WS Context.Response.Write(js.Serialize(items)); } + [WebMethod] + [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] + public void seqStati(string idxMacch, string dataFrom, string dataTo) + { + JavaScriptSerializer js = new JavaScriptSerializer(); + Context.Response.Clear(); + Context.Response.ContentType = "application/json"; + + resoconti _resoconti = new resoconti(); + + intervalloDate intervallo = new intervalloDate(); + intervallo.fine = Convert.ToDateTime(dataTo); + intervallo.inizio = Convert.ToDateTime(dataFrom); + +#if false + objSequencer datiSequencer = _resoconti.sequenzaDati(idxMacch, intervallo); + foreach (DataLayer_generic.serieDatiRow item in datiSequencer.serieDati.Rows) + { + item. + } +#endif + + int numVal = 1000; + // genero numVal valori random inizio/fine... + int maxMinutes = 5; + Random random = new Random(); + visjsDsItem[] items = new visjsDsItem[numVal]; + DateTime lastDate = DateTime.Now.AddDays(-7); + DateTime endDate; + int lancio = 0; + string currCSS = "sv"; + for (int i = 0; i < numVal; i++) + { + lancio = random.Next(10); + if (lancio <= 7) + { + currCSS = "sv"; + } + else if (lancio <= 8) + { + currCSS = "sg"; + } + else + { + currCSS = "sr"; + } + endDate = lastDate.AddSeconds(random.Next(maxMinutes * 60)); + items[i] = new visjsDsItem() + { + id = i, + content = string.Format("Random data {0}", i), + start = lastDate.ToString("yyyy-MM-dd HH:mm"), + end = endDate.ToString("yyyy-MM-dd HH:mm"), + group = "1", // per mostrare multi macchine + type = "background", // importante x non vedere bordi... + className = currCSS + }; + lastDate = endDate; + } + + + + + Context.Response.Write(js.Serialize(items)); + } [WebMethod] [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)] public void getData() diff --git a/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx new file mode 100644 index 00000000..b2f510a4 --- /dev/null +++ b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx @@ -0,0 +1,57 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_sequencerStatiJS.ascx.cs" Inherits="MoonPro.WebUserControls.mod_sequencerStatiJS" %> + +
+ + + + + diff --git a/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.cs b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.cs new file mode 100644 index 00000000..b1e03344 --- /dev/null +++ b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.cs @@ -0,0 +1,61 @@ +using SteamWare; +using System; +using System.Linq; +using System.Web.UI.WebControls; + +namespace MoonPro.WebUserControls +{ + public partial class mod_sequencerStatiJS : System.Web.UI.UserControl + { + /// + /// caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + } + /// + /// Idx macchina da plottare + /// + public string idxMacchina + { + get + { + return hfIdxMacc.Value; + } + set + { + hfIdxMacc.Value = value; + } + } + /// + /// Inizio periodo, formato yyyyMMdd + /// + public string DataFrom + { + get + { + return hfDataFrom.Value; + } + set + { + hfDataFrom.Value = value; + } + } + /// + /// Fine periodo, formato yyyyMMdd + /// + public string DataTo + { + get + { + return hfDataTo.Value; + } + set + { + hfDataTo.Value = value; + } + } + } +} \ No newline at end of file diff --git a/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.designer.cs b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.designer.cs new file mode 100644 index 00000000..21e65ed6 --- /dev/null +++ b/MP-Site/WebUserControls/mod_sequencerStatiJS.ascx.designer.cs @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace MoonPro.WebUserControls { + + + public partial class mod_sequencerStatiJS { + + /// + /// Controllo hfIdxMacc. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfIdxMacc; + + /// + /// Controllo hfDataFrom. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfDataFrom; + + /// + /// Controllo hfDataTo. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.WebControls.HiddenField hfDataTo; + } +} diff --git a/MP-Site/test.aspx b/MP-Site/test.aspx index 95f65a51..86562186 100644 --- a/MP-Site/test.aspx +++ b/MP-Site/test.aspx @@ -1,10 +1,12 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/WebMasterPages/MAPO_refresh.Master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="MoonPro.test" %> <%@ Register Src="WebUserControls/mod_realtimeClock.ascx" TagName="mod_realtimeClock" TagPrefix="uc1" %> +<%@ Register Src="~/WebUserControls/mod_sequencerStatiJS.ascx" TagPrefix="uc1" TagName="mod_sequencerStatiJS" %> + -
+ <%--
--%>
- +
diff --git a/MP-Site/test.aspx.designer.cs b/MP-Site/test.aspx.designer.cs index abf1430e..7f6eb359 100644 --- a/MP-Site/test.aspx.designer.cs +++ b/MP-Site/test.aspx.designer.cs @@ -20,5 +20,14 @@ namespace MoonPro { /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. /// protected global::MoonPro.WebUserControls.mod_realtimeClock mod_realtimeClock1; + + /// + /// Controllo mod_sequencerStatiJS. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::MoonPro.WebUserControls.mod_sequencerStatiJS mod_sequencerStatiJS; } }