diff --git a/GMW/WS/AutoCompletamento.asmx.cs b/GMW/WS/AutoCompletamento.asmx.cs index f3c82eb1..baa3f02a 100644 --- a/GMW/WS/AutoCompletamento.asmx.cs +++ b/GMW/WS/AutoCompletamento.asmx.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; +using System.Web.Script.Services; using SteamWare; using GMW_data; @@ -93,5 +94,26 @@ namespace GMW.WS return suggerimenti.ToArray(); } + [WebMethod] + [ScriptMethod(ResponseFormat = ResponseFormat.Json)] + public string[] celle(string prefixText, int count) + { + // inizializzo risposta + List suggerimenti = new List(); + // proseguo SOLO SE min "MinCharAutocomplete" char... + if (count >= memLayer.ML.confReadInt("MinCharAutocomplete")) + { + // elenco candidati + DS_magazzino.CelleDataTable tabCelle = MagClass.magazzino.taCelle.getByCodCellaLike(prefixText, memLayer.ML.confReadString("CodCS")); + // aggiungo ogni riga... + foreach (DS_magazzino.CelleRow riga in tabCelle) + { + suggerimenti.Add(string.Format("{0}#{1}", riga.CodCella, riga.CodCella)); + } + } + return suggerimenti.ToArray(); + } + + } } diff --git a/GMW/WS/DataFeed.asmx b/GMW/WS/DataFeed.asmx new file mode 100644 index 00000000..c255fdb1 --- /dev/null +++ b/GMW/WS/DataFeed.asmx @@ -0,0 +1 @@ +<%@ WebService Language="C#" CodeBehind="DataFeed.asmx.cs" Class="GMW.WS.DataFeed" %> diff --git a/GMW/WS/DataFeed.asmx.cs b/GMW/WS/DataFeed.asmx.cs new file mode 100644 index 00000000..1e3b9a4e --- /dev/null +++ b/GMW/WS/DataFeed.asmx.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Services; +using System.Web.Script.Services; +using SteamWare; +using GMW_data; + +namespace GMW.WS +{ + /// + /// Summary description for WS_Data + /// + [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 DataFeed : System.Web.Services.WebService + { + + [WebMethod] + [ScriptMethod(ResponseFormat = ResponseFormat.Json)] + public string[] test(string prefixText) + { + //TODO: implement real search here! + // dummy implementation + List output = new List(); + for (int i = 0; i < 100; i++) + { + output.Add(string.Format("{0}{1}#{1}", prefixText, i)); + } + return output.ToArray(); + } + + [WebMethod] + [ScriptMethod(ResponseFormat = ResponseFormat.Json)] + public string[] celle(string prefixText, int count) + { + // inizializzo risposta + List suggerimenti = new List(); + // proseguo SOLO SE min "MinCharAutocomplete" char... + if (count >= memLayer.ML.confReadInt("MinCharAutocomplete")) + { + // elenco candidati + DS_magazzino.CelleDataTable tabCelle = MagClass.magazzino.taCelle.getByCodCellaLike(prefixText, memLayer.ML.confReadString("CodCS")); + // aggiungo ogni riga... + foreach (DS_magazzino.CelleRow riga in tabCelle) + { + suggerimenti.Add(string.Format("{0}#{1}", riga.CodCella, riga.CodCella)); + } + } + return suggerimenti.ToArray(); + } + + //[WebMethod] + //[ScriptMethod(ResponseFormat = ResponseFormat.Json)] + //public string[] Fornitori(string keywordStartsWith) + //{ + // // inizializzo risposta + // List suggerimenti = new List(); + // // elenco candidati + // DS_utilsProjEts.v_selFornitoriClaDataTable tabella = DataProxy_ProjEts.DP.taSelForn.getBySearchLike(keywordStartsWith); + // // aggiungo ogni riga... + // foreach (DS_utilsProjEts.v_selFornitoriClaRow riga in tabella) + // { + // //suggerimenti.Add(riga.label); + // suggerimenti.Add(string.Format("{0}#{1}", riga.label, riga.value)); + // } + // return suggerimenti.ToArray(); + //} + + } +} diff --git a/GMW/test.aspx b/GMW/test.aspx index 0ca10002..636eb81a 100644 --- a/GMW/test.aspx +++ b/GMW/test.aspx @@ -1,48 +1,20 @@ <%@ Page Title="" Language="C#" MasterPageFile="~/FullPage.master" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="GMW.test" %> +<%@ Register src="WebUserControls/mod_autocomplete.ascx" tagname="mod_autocomplete" tagprefix="uc1" %> + -
-
- +
+
+
+ Autocomplete! + - +
+
+
diff --git a/GMW/test.aspx.cs b/GMW/test.aspx.cs index 6911d214..52ef4c5c 100644 --- a/GMW/test.aspx.cs +++ b/GMW/test.aspx.cs @@ -12,31 +12,7 @@ namespace GMW { protected void Page_Load(object sender, EventArgs e) { - // se l'utente c'è... - if (user_std.UtSn.isAuth && !Page.IsPostBack) - { - forzaUpdateMenu(); - updateTreeMenu(); - } - } - /// - /// aggiornamento del menù - /// - private void updateTreeMenu() - { - XmlDataSource1.Data = user_std.UtSn.mappaSito; - //user_std.UtSn.ricaricaMappaSito(); - //XmlDataSource1.Data = user_std.UtSn.mappaSitoLive; - XmlDataSource1.XPath = "mainMenu/menu"; - XmlDataSource1.DataBind(); - } - /// - /// forza l'update del menù sx - /// - public void forzaUpdateMenu() - { - user_std.UtSn.ricaricaMappaSito(); - updateTreeMenu(); + } } } \ No newline at end of file diff --git a/GMW/test.aspx.designer.cs b/GMW/test.aspx.designer.cs index 8e18b400..c21553e0 100644 --- a/GMW/test.aspx.designer.cs +++ b/GMW/test.aspx.designer.cs @@ -13,39 +13,12 @@ namespace GMW { public partial class test { /// - /// itemPlaceholderContainer control. + /// mod_autocomplete1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl itemPlaceholderContainer; - - /// - /// menu control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater menu; - - /// - /// A5 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlAnchor A5; - - /// - /// XmlDataSource1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.XmlDataSource XmlDataSource1; + protected global::GMW.WebUserControls.mod_autocomplete mod_autocomplete1; } }