Aggiunta classe x recuperare dati json
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<script src="~/vis/vis.js"></script>
|
||||
<link href="~/vis/vis.min.css" rel="stylesheet" />
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "GetEventsList",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: ChartVis,
|
||||
error: OnError
|
||||
|
||||
});
|
||||
|
||||
|
||||
function ChartVis(response) {
|
||||
// DOM element where the Timeline will be attached
|
||||
var container = document.getElementById('visualization');
|
||||
|
||||
// Create a DataSet (allows two way data-binding)
|
||||
var items = new vis.DataSet(response);
|
||||
|
||||
// Configuration for the Timeline
|
||||
var options = {};
|
||||
|
||||
// Create a Timeline
|
||||
var timeline = new vis.Timeline(container, items, options);
|
||||
}
|
||||
function OnError(response) {
|
||||
alert("Error !");
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<div id="visualization"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,39 +4,38 @@ using System.Web.Services;
|
||||
|
||||
namespace MoonPro.WS
|
||||
{
|
||||
/// <summary>
|
||||
/// servizi per AutoCompletamento oggetti
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://www.steamware.net/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[System.ComponentModel.ToolboxItem(false)]
|
||||
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
|
||||
[System.Web.Script.Services.ScriptService]
|
||||
public class AutoCompletamento : System.Web.Services.WebService
|
||||
{
|
||||
/// <summary>
|
||||
/// servizi per AutoCompletamento oggetti
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://www.steamware.net/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[System.ComponentModel.ToolboxItem(false)]
|
||||
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
|
||||
[System.Web.Script.Services.ScriptService]
|
||||
public class AutoCompletamento : System.Web.Services.WebService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// elenco articoli per ricerca interattiva
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod(Description = "elenco articoli per ricerca interattiva")]
|
||||
public string[] elencoArticoli(string prefixText, int count)
|
||||
/// <summary>
|
||||
/// elenco articoli per ricerca interattiva
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[WebMethod(Description = "elenco articoli per ricerca interattiva")]
|
||||
public string[] elencoArticoli(string prefixText, int count)
|
||||
{
|
||||
// inizializzo risposta
|
||||
List<string> suggerimenti = new List<string>();
|
||||
// proseguo SOLO SE min "MinCharAutocomplete" char...
|
||||
if (count >= memLayer.ML.confReadInt("MinCharAutocomplete"))
|
||||
{
|
||||
// elenco candidati
|
||||
MapoDb.DS_Utility.v_selArticoliDataTable tabDati = MapoDb.DataLayer.obj.taSelArt.getByConditio(prefixText);
|
||||
// aggiungo ogni riga...
|
||||
foreach (MapoDb.DS_Utility.v_selArticoliRow riga in tabDati)
|
||||
{
|
||||
// inizializzo risposta
|
||||
List<string> suggerimenti = new List<string>();
|
||||
// proseguo SOLO SE min "MinCharAutocomplete" char...
|
||||
if (count >= memLayer.ML.confReadInt("MinCharAutocomplete"))
|
||||
{
|
||||
// elenco candidati
|
||||
MapoDb.DS_Utility.v_selArticoliDataTable tabDati = MapoDb.DataLayer.obj.taSelArt.getByConditio(prefixText);
|
||||
// aggiungo ogni riga...
|
||||
foreach (MapoDb.DS_Utility.v_selArticoliRow riga in tabDati)
|
||||
{
|
||||
suggerimenti.Add(riga.value);
|
||||
}
|
||||
}
|
||||
return suggerimenti.ToArray();
|
||||
suggerimenti.Add(riga.value);
|
||||
}
|
||||
|
||||
}
|
||||
return suggerimenti.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<%@ WebService Language="C#" CodeBehind="MPData.asmx.cs" Class="MoonPro.WS.MPData" %>
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Script.Services;
|
||||
using System.Web.Services;
|
||||
|
||||
namespace MoonPro.WS
|
||||
{
|
||||
/// <summary>
|
||||
/// Descrizione di riepilogo per MPData
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://tempuri.org/")]
|
||||
[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.
|
||||
[ScriptService]
|
||||
public class MPData : System.Web.Services.WebService
|
||||
{
|
||||
|
||||
[WebMethod]
|
||||
public string HelloWorld()
|
||||
{
|
||||
return "Hello World";
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
|
||||
public void randomData()
|
||||
{
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
Context.Response.Clear();
|
||||
Context.Response.ContentType = "application/json";
|
||||
// genero numVal valori random inizio/fine...
|
||||
int numVal = 10;
|
||||
int maxMinutes = 60;
|
||||
Random random = new Random();
|
||||
visjsDsItem[] items = new visjsDsItem[numVal];
|
||||
DateTime lastDate = DateTime.Now.AddDays(-7);
|
||||
for (int i = 0; i < numVal; i++)
|
||||
{
|
||||
items[i] = new visjsDsItem()
|
||||
{
|
||||
id = i,
|
||||
content = string.Format("Random data {0}", i),
|
||||
start = lastDate,
|
||||
end = lastDate.AddHours(random.Next(maxMinutes)),
|
||||
group = "1",
|
||||
className = ""
|
||||
};
|
||||
}
|
||||
Context.Response.Write(js.Serialize(items));
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
|
||||
public void getData()
|
||||
{
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
Context.Response.Clear();
|
||||
Context.Response.ContentType = "application/json";
|
||||
Random random = new Random();
|
||||
int i = 1;
|
||||
DateTime lastDate = DateTime.Now;
|
||||
int maxMinutes = 60;
|
||||
visjsDsItem item = new visjsDsItem()
|
||||
{
|
||||
id = i,
|
||||
content = string.Format("Random data {0}", i),
|
||||
start = lastDate,
|
||||
end = lastDate.AddHours(random.Next(maxMinutes)),
|
||||
group = "1",
|
||||
className = ""
|
||||
};
|
||||
Context.Response.Write(js.Serialize(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+32
-1
@@ -300,7 +300,7 @@ public class resoconti
|
||||
if (answ == 0)
|
||||
{
|
||||
MapoDb.DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow riga = (MapoDb.DS_ProdTempi.stp_repDonati_getLastStatoDurataMacchinaRow)(MapoDb.DataLayer.obj.taDatiStatoMacch.GetData(idx, 0)[0]);
|
||||
answ = riga.idxStato;
|
||||
answ = riga.idxStato;
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -606,3 +606,34 @@ public class resoconti
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Item Dataset di vis.js
|
||||
/// </summary>
|
||||
public class visjsDsItem
|
||||
{
|
||||
/// <summary>
|
||||
/// identificativo univoco
|
||||
/// </summary>
|
||||
public int id;
|
||||
/// <summary>
|
||||
/// Testo descrittivo
|
||||
/// </summary>
|
||||
public string content;
|
||||
/// <summary>
|
||||
/// Inizio dell'evento
|
||||
/// </summary>
|
||||
public DateTime start;
|
||||
/// <summary>
|
||||
/// Fine dell'evento
|
||||
/// </summary>
|
||||
public DateTime end;
|
||||
/// <summary>
|
||||
/// Gruppo dell'item
|
||||
/// </summary>
|
||||
public string group;
|
||||
/// <summary>
|
||||
/// Classe css
|
||||
/// </summary>
|
||||
public string className;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user