Vers 0.6.56

Update modalità sync DB con testing e riallineamento produzione c2p.steamware.net
This commit is contained in:
Samuele E. Locatelli
2014-04-29 12:41:49 +02:00
parent 086aaa7482
commit 4e1228fd79
13 changed files with 310 additions and 184 deletions
+9 -9
View File
@@ -295,19 +295,19 @@
<Content Include="Service References\RemoteWS\C2P.RemoteWS.RawMatResponse.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</Content>
<Content Include="Service References\RemoteWS\C2P.RemoteWS.testResponse.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</Content>
<Content Include="Service References\RemoteWS\C2P.RemoteWS.VocabolarioResponse.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</Content>
<Content Include="Service References\RemoteWS\WS_data.disco" />
<Content Include="Service References\RemoteWS\configuration91.svcinfo" />
<Content Include="Service References\RemoteWS\configuration.svcinfo" />
<Content Include="Service References\RemoteWS\Reference.svcmap">
<Content Include="Service References\RemoteWS\C2P.RemoteWS.updateLemmaResponse.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</Content>
<None Include="Service References\RemoteWS\WS_data.disco" />
<None Include="Service References\RemoteWS\configuration91.svcinfo" />
<None Include="Service References\RemoteWS\configuration.svcinfo" />
<None Include="Service References\RemoteWS\Reference.svcmap">
<Generator>WCF Proxy Generator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</Content>
</None>
<Content Include="Settings.aspx" />
<Content Include="test.aspx" />
<Content Include="UpdateVoc.aspx" />
@@ -387,7 +387,7 @@
<SubType>Designer</SubType>
</Content>
<Content Include="Bundle.config" />
<Content Include="Service References\RemoteWS\WS_data.wsdl" />
<None Include="Service References\RemoteWS\WS_data.wsdl" />
<None Include="Web.WinLab.config">
<DependentUpon>Web.config</DependentUpon>
</None>
@@ -5,6 +5,6 @@
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="testResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>C2P.RemoteWS.testResponse, Service References.RemoteWS.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
<GenericObjectDataSource DisplayName="updateLemmaResponse" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>C2P.RemoteWS.updateLemmaResponse, Service References.RemoteWS.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>
+111 -99
View File
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -24,13 +24,6 @@ namespace C2P.RemoteWS {
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="RemoteWS.WS_dataSoap")]
public interface WS_dataSoap {
// CODEGEN: Generating message contract since element name prefixText from namespace http://tempuri.org/ is not marked nillable
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/test", ReplyAction="*")]
C2P.RemoteWS.testResponse test(C2P.RemoteWS.testRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/test", ReplyAction="*")]
System.Threading.Tasks.Task<C2P.RemoteWS.testResponse> testAsync(C2P.RemoteWS.testRequest request);
// CODEGEN: Generating message contract since element name prefixText from namespace http://tempuri.org/ is not marked nillable
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Clients", ReplyAction="*")]
C2P.RemoteWS.ClientsResponse Clients(C2P.RemoteWS.ClientsRequest request);
@@ -58,74 +51,13 @@ namespace C2P.RemoteWS {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Vocabolario", ReplyAction="*")]
System.Threading.Tasks.Task<C2P.RemoteWS.VocabolarioResponse> VocabolarioAsync(C2P.RemoteWS.VocabolarioRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class testRequest {
[System.ServiceModel.MessageBodyMemberAttribute(Name="test", Namespace="http://tempuri.org/", Order=0)]
public C2P.RemoteWS.testRequestBody Body;
// CODEGEN: Generating message contract since element name lingua from namespace http://tempuri.org/ is not marked nillable
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/updateLemma", ReplyAction="*")]
C2P.RemoteWS.updateLemmaResponse updateLemma(C2P.RemoteWS.updateLemmaRequest request);
public testRequest() {
}
public testRequest(C2P.RemoteWS.testRequestBody Body) {
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
public partial class testRequestBody {
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
public string prefixText;
public testRequestBody() {
}
public testRequestBody(string prefixText) {
this.prefixText = prefixText;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class testResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Name="testResponse", Namespace="http://tempuri.org/", Order=0)]
public C2P.RemoteWS.testResponseBody Body;
public testResponse() {
}
public testResponse(C2P.RemoteWS.testResponseBody Body) {
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
public partial class testResponseBody {
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
public C2P.RemoteWS.ArrayOfString testResult;
public testResponseBody() {
}
public testResponseBody(C2P.RemoteWS.ArrayOfString testResult) {
this.testResult = testResult;
}
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/updateLemma", ReplyAction="*")]
System.Threading.Tasks.Task<C2P.RemoteWS.updateLemmaResponse> updateLemmaAsync(C2P.RemoteWS.updateLemmaRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
@@ -393,6 +325,82 @@ namespace C2P.RemoteWS {
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class updateLemmaRequest {
[System.ServiceModel.MessageBodyMemberAttribute(Name="updateLemma", Namespace="http://tempuri.org/", Order=0)]
public C2P.RemoteWS.updateLemmaRequestBody Body;
public updateLemmaRequest() {
}
public updateLemmaRequest(C2P.RemoteWS.updateLemmaRequestBody Body) {
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
public partial class updateLemmaRequestBody {
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
public string lingua;
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
public string lemma;
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
public string traduzione;
public updateLemmaRequestBody() {
}
public updateLemmaRequestBody(string lingua, string lemma, string traduzione) {
this.lingua = lingua;
this.lemma = lemma;
this.traduzione = traduzione;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
public partial class updateLemmaResponse {
[System.ServiceModel.MessageBodyMemberAttribute(Name="updateLemmaResponse", Namespace="http://tempuri.org/", Order=0)]
public C2P.RemoteWS.updateLemmaResponseBody Body;
public updateLemmaResponse() {
}
public updateLemmaResponse(C2P.RemoteWS.updateLemmaResponseBody Body) {
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute(Namespace="http://tempuri.org/")]
public partial class updateLemmaResponseBody {
[System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
public string updateLemmaResult;
public updateLemmaResponseBody() {
}
public updateLemmaResponseBody(string updateLemmaResult) {
this.updateLemmaResult = updateLemmaResult;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface WS_dataSoapChannel : C2P.RemoteWS.WS_dataSoap, System.ServiceModel.IClientChannel {
}
@@ -420,31 +428,6 @@ namespace C2P.RemoteWS {
base(binding, remoteAddress) {
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
C2P.RemoteWS.testResponse C2P.RemoteWS.WS_dataSoap.test(C2P.RemoteWS.testRequest request) {
return base.Channel.test(request);
}
public C2P.RemoteWS.ArrayOfString test(string prefixText) {
C2P.RemoteWS.testRequest inValue = new C2P.RemoteWS.testRequest();
inValue.Body = new C2P.RemoteWS.testRequestBody();
inValue.Body.prefixText = prefixText;
C2P.RemoteWS.testResponse retVal = ((C2P.RemoteWS.WS_dataSoap)(this)).test(inValue);
return retVal.Body.testResult;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.Threading.Tasks.Task<C2P.RemoteWS.testResponse> C2P.RemoteWS.WS_dataSoap.testAsync(C2P.RemoteWS.testRequest request) {
return base.Channel.testAsync(request);
}
public System.Threading.Tasks.Task<C2P.RemoteWS.testResponse> testAsync(string prefixText) {
C2P.RemoteWS.testRequest inValue = new C2P.RemoteWS.testRequest();
inValue.Body = new C2P.RemoteWS.testRequestBody();
inValue.Body.prefixText = prefixText;
return ((C2P.RemoteWS.WS_dataSoap)(this)).testAsync(inValue);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
C2P.RemoteWS.ClientsResponse C2P.RemoteWS.WS_dataSoap.Clients(C2P.RemoteWS.ClientsRequest request) {
return base.Channel.Clients(request);
@@ -542,5 +525,34 @@ namespace C2P.RemoteWS {
inValue.Body = new C2P.RemoteWS.VocabolarioRequestBody();
return ((C2P.RemoteWS.WS_dataSoap)(this)).VocabolarioAsync(inValue);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
C2P.RemoteWS.updateLemmaResponse C2P.RemoteWS.WS_dataSoap.updateLemma(C2P.RemoteWS.updateLemmaRequest request) {
return base.Channel.updateLemma(request);
}
public string updateLemma(string lingua, string lemma, string traduzione) {
C2P.RemoteWS.updateLemmaRequest inValue = new C2P.RemoteWS.updateLemmaRequest();
inValue.Body = new C2P.RemoteWS.updateLemmaRequestBody();
inValue.Body.lingua = lingua;
inValue.Body.lemma = lemma;
inValue.Body.traduzione = traduzione;
C2P.RemoteWS.updateLemmaResponse retVal = ((C2P.RemoteWS.WS_dataSoap)(this)).updateLemma(inValue);
return retVal.Body.updateLemmaResult;
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.Threading.Tasks.Task<C2P.RemoteWS.updateLemmaResponse> C2P.RemoteWS.WS_dataSoap.updateLemmaAsync(C2P.RemoteWS.updateLemmaRequest request) {
return base.Channel.updateLemmaAsync(request);
}
public System.Threading.Tasks.Task<C2P.RemoteWS.updateLemmaResponse> updateLemmaAsync(string lingua, string lemma, string traduzione) {
C2P.RemoteWS.updateLemmaRequest inValue = new C2P.RemoteWS.updateLemmaRequest();
inValue.Body = new C2P.RemoteWS.updateLemmaRequestBody();
inValue.Body.lingua = lingua;
inValue.Body.lemma = lemma;
inValue.Body.traduzione = traduzione;
return ((C2P.RemoteWS.WS_dataSoap)(this)).updateLemmaAsync(inValue);
}
}
}
+49 -47
View File
@@ -2,25 +2,6 @@
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="test">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="prefixText" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="testResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="testResult" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="Clients">
<s:complexType>
<s:sequence>
@@ -35,6 +16,11 @@
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="Items">
<s:complexType>
<s:sequence>
@@ -73,14 +59,24 @@
</s:sequence>
</s:complexType>
</s:element>
<s:element name="updateLemma">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="lingua" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="lemma" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="traduzione" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="updateLemmaResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="updateLemmaResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="testSoapIn">
<wsdl:part name="parameters" element="tns:test" />
</wsdl:message>
<wsdl:message name="testSoapOut">
<wsdl:part name="parameters" element="tns:testResponse" />
</wsdl:message>
<wsdl:message name="ClientsSoapIn">
<wsdl:part name="parameters" element="tns:Clients" />
</wsdl:message>
@@ -105,11 +101,13 @@
<wsdl:message name="VocabolarioSoapOut">
<wsdl:part name="parameters" element="tns:VocabolarioResponse" />
</wsdl:message>
<wsdl:message name="updateLemmaSoapIn">
<wsdl:part name="parameters" element="tns:updateLemma" />
</wsdl:message>
<wsdl:message name="updateLemmaSoapOut">
<wsdl:part name="parameters" element="tns:updateLemmaResponse" />
</wsdl:message>
<wsdl:portType name="WS_dataSoap">
<wsdl:operation name="test">
<wsdl:input message="tns:testSoapIn" />
<wsdl:output message="tns:testSoapOut" />
</wsdl:operation>
<wsdl:operation name="Clients">
<wsdl:input message="tns:ClientsSoapIn" />
<wsdl:output message="tns:ClientsSoapOut" />
@@ -126,18 +124,13 @@
<wsdl:input message="tns:VocabolarioSoapIn" />
<wsdl:output message="tns:VocabolarioSoapOut" />
</wsdl:operation>
<wsdl:operation name="updateLemma">
<wsdl:input message="tns:updateLemmaSoapIn" />
<wsdl:output message="tns:updateLemmaSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WS_dataSoap" type="tns:WS_dataSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="test">
<soap:operation soapAction="http://tempuri.org/test" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Clients">
<soap:operation soapAction="http://tempuri.org/Clients" style="document" />
<wsdl:input>
@@ -174,18 +167,18 @@
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateLemma">
<soap:operation soapAction="http://tempuri.org/updateLemma" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WS_dataSoap12" type="tns:WS_dataSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="test">
<soap12:operation soapAction="http://tempuri.org/test" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Clients">
<soap12:operation soapAction="http://tempuri.org/Clients" style="document" />
<wsdl:input>
@@ -222,6 +215,15 @@
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateLemma">
<soap12:operation soapAction="http://tempuri.org/updateLemma" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WS_data">
<wsdl:port name="WS_dataSoap" binding="tns:WS_dataSoap">
+9 -16
View File
@@ -19,21 +19,6 @@ namespace C2P.Services
[System.Web.Script.Services.ScriptService]
public class WS_data : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string[] test(string prefixText)
{
//TODO: implement real search here!
// dummy implementation
List<string> output = new List<string>();
for (int i = 0; i < 10; i++)
{
output.Add(string.Format("{0}{1}#{1}", prefixText, i));
}
return output.ToArray();
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string[] Clients(string prefixText)
@@ -99,7 +84,15 @@ namespace C2P.Services
}
return suggerimenti.ToArray();
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string updateLemma(string lingua, string lemma, string traduzione)
{
string answ = "";
selDataVoc.mgr.upsertLemma(lingua, lemma, traduzione);
return answ;
}
}
}
+38 -3
View File
@@ -1,4 +1,39 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_SyncVoc.ascx.cs" Inherits="C2P.WebUserControls.mod_SyncVoc" %>
<asp:Button runat="server" ID="btnSync" CssClass="btn btn-default" Text="Load" OnClick="btnSync_Click" />
<br />
<asp:Label runat="server" ID="lblRes" />
<div class="container">
<div class="row">
<div class="col-xs-6 col-xs-offset-3 text-center">
<h1>Sync Db Vocabolario</h1>
<asp:Button runat="server" ID="btnSync" CssClass="btn btn-default" Text="Update vocabolario" OnClick="btnSync_Click" Width="100%" />
</div>
</div>
<div class="row">
<div class="col-xs-6">Lemmi Locali</div>
<div class="col-xs-6">
<asp:Label runat="server" ID="lblNumLoc" />
</div>
</div>
<div class="row">
<div class="col-xs-6">Lemmi Remoti</div>
<div class="col-xs-6">
<asp:Label runat="server" ID="lblNumRem" />
</div>
</div>
<div class="row">
<div class="col-xs-6">Update Locali</div>
<div class="col-xs-6">
<asp:Label runat="server" ID="lblUpdLoc" />
</div>
</div>
<div class="row">
<div class="col-xs-6">Insert Remoti</div>
<div class="col-xs-6">
<asp:Label runat="server" ID="lblInsRem" />
</div>
</div>
<div class="row">
<div class="col-xs-12">
<asp:Label runat="server" ID="lblRes" />
</div>
</div>
</div>
+56 -8
View File
@@ -10,9 +10,32 @@ namespace C2P.WebUserControls
{
public partial class mod_SyncVoc : System.Web.UI.UserControl
{
/// <summary>
/// wrapper classe WS remota
/// </summary>
protected RemoteWS.WS_dataSoapClient clientWS = new RemoteWS.WS_dataSoapClient();
/// <summary>
/// dati remoti
/// </summary>
protected List<string> remoteData;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
reloadData();
}
}
private void reloadData()
{
DataWrap.DW.resetVocabolario();
// carico dati locali...
lblNumLoc.Text = string.Format("{0} record", DataWrap.DW.dictVocabolario.Count);
// carico dati remoti
remoteData = clientWS.Vocabolario();
lblNumRem.Text = string.Format("{0} record", remoteData.Count);
}
/// <summary>
/// (Ri)carico dati vocabolario remoto
@@ -21,25 +44,50 @@ namespace C2P.WebUserControls
/// <param name="e"></param>
protected void btnSync_Click(object sender, EventArgs e)
{
reloadData();
// inizio processo...
DateTime inizio = DateTime.Now;
RemoteWS.WS_dataSoapClient client = new RemoteWS.WS_dataSoapClient();
List<string> risultati = client.Vocabolario();
// ciclo sui risultati...
string[] termine;
int fatti = 0;
foreach (string risultato in risultati)
int updLoc = 0;
int insRem = 0;
// step 1: update da remoto a locale
foreach (string risultato in remoteData)
{
// cerco termini splittando
try
{
termine = risultato.Split('#');
// cerco il termine nel nostro db e faccio upsert (always)
selDataVoc.mgr.upsertLemma(termine[0], termine[1], termine[2]);
fatti++;
// verifico se il termine sia cambiato...
if (DataWrap.DW.dictVocabolario[termine[0] + "#" + termine[1]] != termine[2] || DataWrap.DW.dictVocabolario[termine[0] + "#" + termine[1]] == null)
{
// faccio upsert
selDataVoc.mgr.upsertLemma(termine[0], termine[1], termine[2]);
updLoc++;
}
}
catch { }
}
// step 2: caricamento termini NUOVI locali in db remoto...
string trovato = "";
foreach (string key in DataWrap.DW.dictVocabolario.Keys)
{
// cerco la chiave nell'elenco...
trovato = remoteData.Find(x => x.StartsWith(key));
// se non la trovo chiamo metodo di upsert!
if (trovato == "" || trovato == null)
{
termine = key.Split('#');
clientWS.updateLemma(termine[0], termine[1], DataWrap.DW.dictVocabolario[key]);
insRem++;
}
}
// mostro esito!
lblRes.Text = string.Format("Sync effettuato: {0} termini, {1} ms", fatti, DateTime.Now.Subtract(inizio).TotalMilliseconds);
lblUpdLoc.Text = string.Format("{0} termini aggiornati in locale", updLoc);
lblInsRem.Text = string.Format("{0} termini nuovi caricati in remoto", insRem);
lblRes.Text = string.Format("Sync effettuato: {0} ms", DateTime.Now.Subtract(inizio).TotalMilliseconds);
// ricarico dati locali e remoti
reloadData();
}
}
}
+36
View File
@@ -21,6 +21,42 @@ namespace C2P.WebUserControls {
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSync;
/// <summary>
/// lblNumLoc control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumLoc;
/// <summary>
/// lblNumRem control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblNumRem;
/// <summary>
/// lblUpdLoc control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblUpdLoc;
/// <summary>
/// lblInsRem control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblInsRem;
/// <summary>
/// lblRes control.
/// </summary>
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.