bozza gestione webapi

This commit is contained in:
Samuele E. Locatelli
2020-09-03 14:06:49 +02:00
parent 511f13d985
commit 52ab3cb1b9
7 changed files with 105 additions and 8 deletions
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace GPW_Smart.Controllers
{
public class TempRilController : ApiController
{
// GET api/<controller>
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<controller>/5
public string Get(int id)
{
return "value";
}
// POST api/<controller>
public void Post([FromBody] string value)
{
}
// PUT api/<controller>/5
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<controller>/5
public void Delete(int id)
{
}
}
}
+11
View File
@@ -140,6 +140,10 @@
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
@@ -165,6 +169,12 @@
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
@@ -733,6 +743,7 @@
<Compile Include="BaseUserControl.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Controllers\TempRilController.cs" />
<Compile Include="Default.aspx.cs">
<DependentUpon>Default.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
+37 -3
View File
@@ -1,4 +1,5 @@
using System;
using GPW_data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
@@ -26,7 +27,40 @@ namespace GPW_Smart.WS
/// <summary>
/// Restituisce un array di informazioni...
/// Restituisce un array di informazioni x rilievo temperature (serie dati)...
/// - TITOLO
/// - vettore valori come x,y
/// </summary>
/// <param name="idxDipendente"></param>
/// <param name="dataRif"></param>
/// <param name="maxRecords"></param>
/// <returns></returns>
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<object> rilTempSerie(int idxDipendente, DateTime dataRif, int maxRecords = 0)
{
// init valori..
List<object> allData = new List<object>();
List<chartJsTimeSerie> valori = new List<chartJsTimeSerie>();
// aggiungo TITOLO della serie dati...
allData.Add("Temperatura Rilevata");
// recupero dati
var tabDati = DataProxy.DP.taRT.getByUserPeriod(idxDipendente, dataRif, maxRecords);
foreach (var item in tabDati)
{
valori.Add(new chartJsTimeSerie() { x = item.dtRilievo, y = item.tempRil });
}
allData.Add(valori);
// restituisco oggetto!
return allData;
}
/// <summary>
/// Restituisce un array di informazioni x rilievo temperature (istogramma freq dati)...
/// - TITOLO
/// - MaxValore
/// - vettore etichette
@@ -35,7 +69,7 @@ namespace GPW_Smart.WS
/// <returns></returns>
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public List<object> userScoreData(int idxUser, DateTime dataRif)
public List<object> rilTempHist(int idxUser, DateTime dataRif, int maxRecords = 0)
{
// init valori..
List<object> allData = new List<object>();
+8 -4
View File
@@ -136,8 +136,7 @@
</appSettings>
<connectionStrings>
<add name="GPW_data.Properties.Settings.GPWConnectionString" connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=GPW;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
<add name="ErrorLog" connectionString="Data Source=SQL2016DEV;Initial Catalog=Elmah;Persist Security Info=True;User ID=sa;Password=keyhammer16;"
providerName="System.Data.SqlClient"/>
<add name="ErrorLog" connectionString="Data Source=SQL2016DEV;Initial Catalog=Elmah;Persist Security Info=True;User ID=sa;Password=keyhammer16;" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@@ -431,9 +430,14 @@
<remove name="Session" />
<add name="Session" type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode" />
</modules>
</system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ErrorLog"/>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="ErrorLog" />
<security allowRemoteAccess="false" />
</elmah>
<location path="elmah.axd" inheritInChildApplications="false">
+1 -1
View File
@@ -1,7 +1,7 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_chart.ascx.cs" Inherits="GPW_Smart.WebUserControls.cmp_chart" %>
<canvas id="myChart" width="300" height="150"></canvas>
<canvas id="myChart" width="300" height="300"></canvas>
<asp:HiddenField runat="server" ID="hfIdxPaziente" />
<asp:HiddenField runat="server" ID="hfData" />
+7
View File
@@ -21,6 +21,13 @@
<package id="Microsoft.AspNet.SessionState.SessionStateModule" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net462" />
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.Client.it" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.Core.it" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.AspNet.WebApi.WebHost.it" version="5.2.7" targetFramework="net462" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.0" targetFramework="net462" />
<package id="Microsoft.NETCore.Platforms" version="3.1.0" targetFramework="net462" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net462" />
+2
View File
@@ -161,7 +161,9 @@
<DesignTime>True</DesignTime>
<DependentUpon>DS_Utility.xsd</DependentUpon>
</Compile>
<Compile Include="Enums.cs" />
<Compile Include="licenzeGPW.cs" />
<Compile Include="Objects.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>