diff --git a/.vs/WebSCR/v14/.suo b/.vs/WebSCR/v14/.suo index 6c4e230..30faf4f 100644 Binary files a/.vs/WebSCR/v14/.suo and b/.vs/WebSCR/v14/.suo differ diff --git a/DataUploader/DataUploader.csproj b/DataUploader/DataUploader.csproj index 5ac1735..ef988cb 100644 --- a/DataUploader/DataUploader.csproj +++ b/DataUploader/DataUploader.csproj @@ -71,6 +71,7 @@ + Designer @@ -100,6 +101,13 @@ + + ResyncLastDocs.aspx + ASPXCodeBehind + + + ResyncLastDocs.aspx + SyncDoc.aspx ASPXCodeBehind diff --git a/DataUploader/GestData.cs b/DataUploader/GestData.cs index c13bff0..62f87e3 100644 --- a/DataUploader/GestData.cs +++ b/DataUploader/GestData.cs @@ -37,6 +37,7 @@ namespace DataUploader public static GestData proc = new GestData(); + /// /// restituisce un array di stringhe URL da chiamare per caricare i dati documento / cliente /// @@ -57,7 +58,7 @@ namespace DataUploader string[] rCli = new string[12]; string comandoDoc; - // qui va fatto ciclo x spazzare 1 ad 1 i docuemnti ed i relativi clienti + // qui va fatto ciclo x spazzare 1 ad 1 i documenti ed i relativi clienti if (false) { // query in formato ACCESS 2010 comandoDoc = string.Format(@"SELECT TOP {0} @@ -201,6 +202,172 @@ namespace DataUploader // end ciclo, resituisco tutti i records return answ; } + + /// + /// restituisce un array di stringhe URL da chiamare per caricare i dati documento / cliente + /// + /// numero ultimo doc caricato (restituirà docs successivi) + /// numero di doc da ricaricare (prima dell'ultimo caricato...) + /// + public string[] reloadLastDocs(int numeroFrom, int num2reload) + { + + if (ConfigurationManager.AppSettings["debugMode"] == "true") + { + logger.Info("Inizio getNewDocsUrls"); + } + + // ipotesi: si caricano maxDocsToUpload documenti alal volta (e quindi altrettanti clienti) + int maxDocsToUpload = num2reload + 1; + string[] answ = new string[maxDocsToUpload * 2]; // 2 stringhe, una x doc e 1 x cliente x ogni invio... + string[] rDoc = new string[20]; + string[] rCli = new string[12]; + string comandoDoc; + + // qui va fatto ciclo x spazzare 1 ad 1 i documenti ed i relativi clienti + if (false) + { // query in formato ACCESS 2010 + comandoDoc = string.Format(@"SELECT TOP {0} + TESDOCUM.TIPOPROTOC, TESDOCUM.NUMERO, TESDOCUM.ESERPROTOC, + TESDOCUM.NUMEPROTOC, TESDOCUM.DATAPROTOC, TESDOCUM.ESERRIFERI, + TESDOCUM.NUMERIFERI, TESDOCUM.TIPORIFERI, TESDOCUM.DATARIFERI, + TESDOCUM.NUMEDOCRIF, TESDOCUM.DATADOCRIF, TESDOCUM.ESERCOLLEG, + TESDOCUM.CLI_FOR, TESDOCUM.DESTINATAR, TESDOCUM.RGSOC_DEST, + TESDOCUM.INDIR_DEST, TESDOCUM.LOCAL_DEST, TESDOCUM.CAP_DEST, + TESDOCUM.ULT_AGG, TESDOCUM.ANNOTAZION + FROM TESDOCUM + WHERE (CLng(TESDOCUM.NUMERO) > ({1})) + AND (TESDOCUM.TIPOPROTOC IN ('OC', 'DC')) + ORDER BY TESDOCUM.NUMERO + ", + maxDocsToUpload, numeroFrom); + } + else + { // query in formato DB2 + comandoDoc = string.Format(@"SELECT + TESDOCUM.TIPOPROTOC, TESDOCUM.NUMERO, TESDOCUM.ESERPROTOC, + TESDOCUM.NUMEPROTOC, TESDOCUM.DATAPROTOC, TESDOCUM.ESERRIFERI, + TESDOCUM.NUMERIFERI, TESDOCUM.TIPORIFERI, TESDOCUM.DATARIFERI, + TESDOCUM.NUMEDOCRIF, TESDOCUM.DATADOCRIF, TESDOCUM.ESERCOLLEG, + TESDOCUM.CLI_FOR, TESDOCUM.DESTINATAR, TESDOCUM.RGSOC_DEST, + TESDOCUM.INDIR_DEST, TESDOCUM.LOCAL_DEST, TESDOCUM.CAP_DEST, + TESDOCUM.ULT_AGG, TESDOCUM.ANNOTAZION + FROM TESDOCUM + WHERE (INT(TESDOCUM.NUMERO) > ({1})) + AND (TESDOCUM.TIPOPROTOC IN ('OC', 'DC')) + ORDER BY TESDOCUM.NUMERO + FETCH FIRST {0} ROWS ONLY + ", + maxDocsToUpload, numeroFrom - num2reload); + } + // try/catch x db e ciclo su dati... + try + { + conn.Open(); + if (ConfigurationManager.AppSettings["debugMode"] == "true") + { + logger.Info("Aperta connessione ODBC"); + } + + // dati documento + int num = 0; + using (OdbcCommand com = new OdbcCommand(comandoDoc, conn)) + { + using (OdbcDataReader reader = com.ExecuteReader()) + { + while (reader.Read()) + { + for (int i = 0; i < 20; i++) + { + try + { + rDoc[i] = reader.GetString(i).Trim().Replace(" ", "+"); + } + catch + { + rDoc[i] = ""; + } + } + + //if (ConfigurationManager.AppSettings["debugMode"] == "true") + //{ + // logger.Info("Completata lettura ODBC x DOC"); + //} + + // il campo 12 è il cod cliente! + rCli[0] = rDoc[12]; + + // cellulare e email trovati in USRCLIFO, relazionato su CODSIGLA + string comandoCli = string.Format(@"SELECT CLIFO.CODICE, CLIFO.RAGIONESOC, CLIFO.COFI, + CLIFO.TEL, USRCLIFO.CELNM AS CELL, + CASE WHEN USRCLIFO.CELNM <> ' ' THEN 1 ELSE 0 END AS ENABLE_SMS, + USRCLIFO.E_MAILL AS EMAIL, + CLIFO.INDIR1, CLIFO.CAP, CLIFO.LOCALITA, + CLIFO.PROVINCIA, '' AS NoteCli + FROM CLIFO INNER JOIN USRCLIFO + ON CLIFO.CODICE = USRCLIFO.CODSIGLA + WHERE CLIFO.TIPO='C' + AND CLIFO.CODICE = '{0}'", + rCli[0]); + + try + { + using (OdbcCommand comCli = new OdbcCommand(comandoCli, conn)) + { + using (OdbcDataReader readerCli = comCli.ExecuteReader()) + { + while (readerCli.Read()) + { + for (int j = 0; j < 12; j++) + { + try + { + rCli[j] = readerCli.GetString(j).Trim().Replace(" ", "+"); + } + catch + { + rCli[j] = ""; + } + } + } + } + } + + //if (ConfigurationManager.AppSettings["debugMode"] == "true") + //{ + // logger.Info("Completata lettura ODBC x CLI"); + //} + + // formatto answ... prima CLI poi DOCS... + answ[num++] = createUrlCli(rCli); + answ[num++] = createUrlDoc(rDoc); + } + catch (Exception ex) + { + logger.Error("Eccezione in comandoCli{0}Comando: {1}{0}{2}", Environment.NewLine, comandoCli, ex); + } + } + } + } + } + catch (Exception ex) + { + logger.Error("Eccezione{0}Comando: {1}{0}{2}", Environment.NewLine, comandoDoc, ex); + } + + finally + { + conn.Close(); + } + + if (ConfigurationManager.AppSettings["debugMode"] == "true") + { + logger.Info("Chiusura connessione ODBC"); + } + + // end ciclo, resituisco tutti i records + return answ; + } /// /// restituisce un array di stringhe URL da chiamare per caricare i dati documento / cliente /// diff --git a/DataUploader/Properties/PublishProfiles/Zip.pubxml.user b/DataUploader/Properties/PublishProfiles/Zip.pubxml.user index b4ea48d..46585fb 100644 --- a/DataUploader/Properties/PublishProfiles/Zip.pubxml.user +++ b/DataUploader/Properties/PublishProfiles/Zip.pubxml.user @@ -10,7 +10,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt - 10/01/2015 19:37:03 + 02/03/2016 15:59:04 09/03/2015 11:38:11 @@ -43,13 +43,16 @@ by editing this MSBuild file. In order to learn more about this please visit htt 09/03/2015 11:38:11 - 10/01/2015 19:37:04 + 02/03/2016 15:59:05 + + + 02/03/2016 15:13:36 09/18/2015 10:37:41 - 10/01/2015 19:37:03 + 02/03/2016 15:33:45 \ No newline at end of file diff --git a/DataUploader/ResyncLastDocs.aspx b/DataUploader/ResyncLastDocs.aspx new file mode 100644 index 0000000..a4ad5dc --- /dev/null +++ b/DataUploader/ResyncLastDocs.aspx @@ -0,0 +1,25 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResyncLastDocs.aspx.cs" Inherits="DataUploader.ResyncLastDocs" %> + + + + + + + + +
+
+

ResyncLastDocs

+ Modalità chiamata: +
    +
  • Senza parametri: effettua il caricamento forzato degli ultimi doc (numero impostato in web.config) arrivando all'ultimo che risulta caricato online
  • +
  • Specificando parametro Num2Reload: effettua il caricamento forzato degli ultimi Num2Reload doc arrivando all'ultimo che risulta caricato online
  • +
  • Con aggiunto il parametro "?DemoMode=true" nell'url --> NON viene chiamata (per ogni record) la pagina remota ma viene mostrato l'elenco delle chiamate che SI SAREBBERO EFFETTUATE
  • +
+
+

OUTPUT

+ +
+
+ + diff --git a/DataUploader/ResyncLastDocs.aspx.cs b/DataUploader/ResyncLastDocs.aspx.cs new file mode 100644 index 0000000..e0c7211 --- /dev/null +++ b/DataUploader/ResyncLastDocs.aspx.cs @@ -0,0 +1,112 @@ +using NLog; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Linq; +using System.Net; +using System.Threading; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace DataUploader +{ + public partial class ResyncLastDocs : System.Web.UI.Page + { + private static Logger logger = LogManager.GetCurrentClassLogger(); + + protected void Page_Load(object sender, EventArgs e) + { + logger.Info(">>>------ Inizio ResyncLastDoc ------<<<"); + DateTime tick = DateTime.Now; + int numDocCaricati = 0; + using (var client = new WebClient()) + { + + client.Proxy = null; + ServicePointManager.DefaultConnectionLimit = int.MaxValue; + // verifico se vado in modalità demo o meno... + bool demoMode = false; + int Num2Reload = 0; + try + { + Num2Reload = Convert.ToInt32(Request.QueryString["Num2Reload"]); + } + catch + { } + if (Num2Reload == 0) + { + Num2Reload = Convert.ToInt32(ConfigurationManager.AppSettings["numDocDaRicaricare"]); + } + try + { + demoMode = Convert.ToBoolean(Request.QueryString["DemoMode"]); + } + catch + { } + // recupero ultimo numero doc caricato... + int lastNum = 0; + try + { + var content = client.DownloadString(ConfigurationManager.AppSettings["remoteDocUrl"]); // http://webscr.steamware.net/Rigamonti/Upload/Document + // converto a int! + lastNum = Convert.ToInt32(content); + logger.Info("Recuperato last num: {0}", lastNum); + } + catch + { } + // recupero i dati da caricare... + string[] urlsUpdate = GestData.proc.reloadLastDocs(lastNum, Num2Reload); + if (demoMode) + { + lblOut.Text = string.Format("DEMO MODE!
ultimo NUMERO: {0}", lastNum); + for (int i = 0; i < urlsUpdate.Length; i++) + { + lblOut.Text += string.Format("
{0:000}) {1}", i + 1, urlsUpdate[i]); + } + logger.Info("Effettuato DEMO upload FULL SYNC: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); + } + else + { + if (ConfigurationManager.AppSettings["debugMode"] == "true") + { + logger.Info("Inizio chiamate URL"); + } + lblOut.Text = string.Format("Normal MODE!
{0}", lastNum); + string content = ""; + for (int i = 0; i < urlsUpdate.Length; i++) + { + try + { + if (ConfigurationManager.AppSettings["logFull"] == "true") + { + logger.Info("Chiamata [{0}]", i); + } + // se ho qualcosa da scaricare... + if (urlsUpdate[i] != "") + { + // versione SYNC + content = client.DownloadString(urlsUpdate[i]); + numDocCaricati++; + } + if (ConfigurationManager.AppSettings["logFull"] == "true") + { + logger.Info("Risposta [{0}] - {1}", content, urlsUpdate[i]); + } + } + catch + { } + } + try + { + logger.Info(">>>------ Effettuato upload RESYNC: durata {0} msec, {1} chiamate! ------<<<", DateTime.Now.Subtract(tick).TotalMilliseconds, numDocCaricati); + } + catch + { + logger.Info(">>>------ Effettuato upload RESYNC: durata {0} sec, {1} chiamate! ------<<<", DateTime.Now.Subtract(tick).Seconds, numDocCaricati); + } + } + } + } + } +} \ No newline at end of file diff --git a/DataUploader/ResyncLastDocs.aspx.designer.cs b/DataUploader/ResyncLastDocs.aspx.designer.cs new file mode 100644 index 0000000..5797929 --- /dev/null +++ b/DataUploader/ResyncLastDocs.aspx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace DataUploader { + + + public partial class ResyncLastDocs { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// lblOut control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblOut; + } +} diff --git a/DataUploader/Web.config b/DataUploader/Web.config index 9c93831..baff446 100644 --- a/DataUploader/Web.config +++ b/DataUploader/Web.config @@ -2,8 +2,8 @@ - - + + diff --git a/DataUploader/bin/DataUploader.dll b/DataUploader/bin/DataUploader.dll index 02c7366..c577188 100644 Binary files a/DataUploader/bin/DataUploader.dll and b/DataUploader/bin/DataUploader.dll differ diff --git a/DataUploader/bin/DataUploader.dll.config b/DataUploader/bin/DataUploader.dll.config index 9c93831..baff446 100644 --- a/DataUploader/bin/DataUploader.dll.config +++ b/DataUploader/bin/DataUploader.dll.config @@ -2,8 +2,8 @@ - - + + diff --git a/ReleaseClienti/DataUploader.zip b/ReleaseClienti/DataUploader.zip index 3f6c3c4..dceb211 100644 Binary files a/ReleaseClienti/DataUploader.zip and b/ReleaseClienti/DataUploader.zip differ diff --git a/ReleaseClienti/DataUploader/ResyncLastDocs.aspx b/ReleaseClienti/DataUploader/ResyncLastDocs.aspx new file mode 100644 index 0000000..a4ad5dc --- /dev/null +++ b/ReleaseClienti/DataUploader/ResyncLastDocs.aspx @@ -0,0 +1,25 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ResyncLastDocs.aspx.cs" Inherits="DataUploader.ResyncLastDocs" %> + + + + + + + + +
+
+

ResyncLastDocs

+ Modalità chiamata: +
    +
  • Senza parametri: effettua il caricamento forzato degli ultimi doc (numero impostato in web.config) arrivando all'ultimo che risulta caricato online
  • +
  • Specificando parametro Num2Reload: effettua il caricamento forzato degli ultimi Num2Reload doc arrivando all'ultimo che risulta caricato online
  • +
  • Con aggiunto il parametro "?DemoMode=true" nell'url --> NON viene chiamata (per ogni record) la pagina remota ma viene mostrato l'elenco delle chiamate che SI SAREBBERO EFFETTUATE
  • +
+
+

OUTPUT

+ +
+
+ + diff --git a/ReleaseClienti/DataUploader/Web.config b/ReleaseClienti/DataUploader/Web.config index d1b2529..edbfd46 100644 --- a/ReleaseClienti/DataUploader/Web.config +++ b/ReleaseClienti/DataUploader/Web.config @@ -2,7 +2,8 @@ - + + diff --git a/ReleaseClienti/DataUploader/bin/DataUploader.dll b/ReleaseClienti/DataUploader/bin/DataUploader.dll index 9e73dce..c577188 100644 Binary files a/ReleaseClienti/DataUploader/bin/DataUploader.dll and b/ReleaseClienti/DataUploader/bin/DataUploader.dll differ diff --git a/VersGen/bin/Release/VersGen.dll b/VersGen/bin/Release/VersGen.dll index 73ca49a..337844f 100644 Binary files a/VersGen/bin/Release/VersGen.dll and b/VersGen/bin/Release/VersGen.dll differ diff --git a/VersGen/obj/Release/VersGen.dll b/VersGen/obj/Release/VersGen.dll index 73ca49a..337844f 100644 Binary files a/VersGen/obj/Release/VersGen.dll and b/VersGen/obj/Release/VersGen.dll differ diff --git a/WebSCR/bin/WebSCR.dll b/WebSCR/bin/WebSCR.dll index 8a6c961..8bd1c52 100644 Binary files a/WebSCR/bin/WebSCR.dll and b/WebSCR/bin/WebSCR.dll differ diff --git a/WebSCR/bin/WebSCR_data.dll b/WebSCR/bin/WebSCR_data.dll index b0d0a6b..648cecf 100644 Binary files a/WebSCR/bin/WebSCR_data.dll and b/WebSCR/bin/WebSCR_data.dll differ diff --git a/WebSCR_data/bin/Release/WebSCR_data.dll b/WebSCR_data/bin/Release/WebSCR_data.dll index b0d0a6b..648cecf 100644 Binary files a/WebSCR_data/bin/Release/WebSCR_data.dll and b/WebSCR_data/bin/Release/WebSCR_data.dll differ diff --git a/WebSCR_data/obj/Release/WebSCR_data.dll b/WebSCR_data/obj/Release/WebSCR_data.dll index b0d0a6b..648cecf 100644 Binary files a/WebSCR_data/obj/Release/WebSCR_data.dll and b/WebSCR_data/obj/Release/WebSCR_data.dll differ