using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Script.Services; namespace PUB.Services { /// /// Descrizione di riepilogo per WS_data /// [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 suggerimenti = new List(); #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(); } /// /// stituisce un array di array di informazioni... /// - TITOLO /// - MaxValore /// - vettore etichette /// - vettore valori /// /// [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List userScoreData(int idxUser, DateTime dataRif) { // init valori.. List allData = new List(); List etichette = new List(); List valori = new List(); // 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 simData(string dataType, DateTime dataRif, int nLimit) { // init valori.. List allData = new List(); List etichette = new List(); List valori = new List(); // 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 suggerimenti = new List(); 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 suggerimenti = new List(); 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 suggerimenti = new List(); #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; } } }