187 lines
5.4 KiB
C#
187 lines
5.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
using System.Web.Script.Services;
|
|
|
|
namespace PUB.Services
|
|
{
|
|
/// <summary>
|
|
/// Descrizione di riepilogo per WS_data
|
|
/// </summary>
|
|
[WebService(Namespace = "http://www.steamware.net/")]
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
[System.ComponentModel.ToolboxItem(false)]
|
|
// Per consentire la chiamata di questo servizio Web dallo script utilizzando ASP.NET AJAX, rimuovere il commento dalla riga seguente.
|
|
[System.Web.Script.Services.ScriptService]
|
|
public class WS_data : System.Web.Services.WebService
|
|
{
|
|
|
|
[WebMethod]
|
|
public string HelloWorld()
|
|
{
|
|
return "Hello World";
|
|
}
|
|
|
|
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public string[] Prestazioni(string prefixText)
|
|
{
|
|
// inizializzo risposta
|
|
List<string> suggerimenti = new List<string>();
|
|
#if false
|
|
// elenco candidati
|
|
ScheMe_Data.DS_Utility.v_selPrestazioniDataTable tabella = DtProxy.man.taVSPrest.searchLike(prefixText);
|
|
// aggiungo ogni riga...
|
|
foreach (ScheMe_Data.DS_Utility.v_selPrestazioniRow riga in tabella)
|
|
{
|
|
//suggerimenti.Add(riga.label);
|
|
suggerimenti.Add(string.Format("{0}#{1}", riga.label, riga.value));
|
|
if (suggerimenti.Count == memLayer.ML.confReadInt("maxNumSuggest"))
|
|
{
|
|
suggerimenti.Add("...#");
|
|
return suggerimenti.ToArray();
|
|
}
|
|
}
|
|
#endif
|
|
return suggerimenti.ToArray();
|
|
}
|
|
|
|
/// <summary>
|
|
/// stituisce un array di array di informazioni...
|
|
/// - TITOLO
|
|
/// - MaxValore
|
|
/// - vettore etichette
|
|
/// - vettore valori
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public List<object> userScoreData(int idxUser, DateTime dataRif)
|
|
{
|
|
// init valori..
|
|
List<object> allData = new List<object>();
|
|
List<string> etichette = new List<string>();
|
|
List<int> valori = new List<int>();
|
|
|
|
// aggiungo TITOLO della serie dati...
|
|
string titolo = string.Format("VMD - {0:yyyy-MM-dd}", dataRif);
|
|
allData.Add(titolo);
|
|
int maxVal = 4;
|
|
allData.Add(maxVal);
|
|
#if false
|
|
// leggo info...
|
|
DS_Applicazione.VisVMDDataTable tab = DtProxy.man.taVVMD.getByPaziente(idxUser, dataRif);
|
|
// recupero SOLO i PENALTY... e sono 8...
|
|
int valore = 0;
|
|
for (int i = 0; i < tab.Columns.Count; i++)
|
|
{
|
|
// recupero nome colonna, se è "_" inserisco...
|
|
if (tab.Columns[i].ToString().IndexOf("_p") >= 0)
|
|
{
|
|
etichette.Add(tab.Columns[i].ToString().Replace("_p", ""));
|
|
Int32.TryParse(tab[0][i].ToString(), out valore);
|
|
valori.Add(valore);
|
|
}
|
|
}
|
|
#endif
|
|
allData.Add(etichette);
|
|
allData.Add(valori);
|
|
// restituisco oggetto!
|
|
return allData;
|
|
}
|
|
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public List<object> simData(string dataType, DateTime dataRif, int nLimit)
|
|
{
|
|
// init valori..
|
|
List<object> allData = new List<object>();
|
|
List<string> etichette = new List<string>();
|
|
List<int> valori = new List<int>();
|
|
|
|
// aggiungo TITOLO della serie dati...
|
|
string titolo = string.Format("TEST - {0:yyyy-MM-dd}", dataRif);
|
|
allData.Add(titolo);
|
|
int maxVal = 4;
|
|
allData.Add(maxVal);
|
|
|
|
Random random = new Random();
|
|
int maxValue = 4;
|
|
int r = 0;
|
|
for (int i = 0; i < nLimit; i++)
|
|
{
|
|
r = random.Next(maxValue);
|
|
etichette.Add(r.ToString());
|
|
valori.Add(r);
|
|
}
|
|
allData.Add(etichette);
|
|
allData.Add(valori);
|
|
// restituisco oggetto!
|
|
return allData;
|
|
}
|
|
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public string[] lblRadar()
|
|
{
|
|
// inizializzo risposta
|
|
List<string> suggerimenti = new List<string>();
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
suggerimenti.Add(string.Format("LBL_{0:00}", i));
|
|
}
|
|
return suggerimenti.ToArray();
|
|
}
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public string[] valRadar(string dataType, DateTime dataRif)
|
|
{
|
|
// inizializzo risposta
|
|
List<string> suggerimenti = new List<string>();
|
|
Random random = new Random();
|
|
int maxValue = 4;
|
|
int r = 0;
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
r = random.Next(maxValue);
|
|
suggerimenti.Add(r.ToString());
|
|
}
|
|
return suggerimenti.ToArray();
|
|
}
|
|
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public string[] Vocabolario()
|
|
{
|
|
// inizializzo risposta
|
|
List<string> suggerimenti = new List<string>();
|
|
#if false
|
|
// elenco candidati
|
|
DataLayer_generic.VocabolarioDataTable tabella = selDataVoc.mgr.getVocabolario();
|
|
// aggiungo ogni riga...
|
|
foreach (DataLayer_generic.VocabolarioRow riga in tabella)
|
|
{
|
|
//suggerimenti.Add(riga.label);
|
|
suggerimenti.Add(string.Format("{0}#{1}#{2}", riga.Lingua, riga.Lemma, riga.Traduzione));
|
|
}
|
|
#endif
|
|
return suggerimenti.ToArray();
|
|
}
|
|
|
|
[WebMethod]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public string updateLemma(string lingua, string lemma, string traduzione)
|
|
{
|
|
string answ = "";
|
|
#if false
|
|
selDataVoc.mgr.upsertLemma(lingua, lemma, traduzione);
|
|
#endif
|
|
return answ;
|
|
}
|
|
}
|
|
}
|