diff --git a/DataUploader/DataUploader.csproj b/DataUploader/DataUploader.csproj index 290974d..5ac1735 100644 --- a/DataUploader/DataUploader.csproj +++ b/DataUploader/DataUploader.csproj @@ -19,6 +19,7 @@ + true @@ -71,7 +72,9 @@ - + + Designer + diff --git a/DataUploader/FullSync.aspx.cs b/DataUploader/FullSync.aspx.cs index 49e0228..3a9d9f3 100644 --- a/DataUploader/FullSync.aspx.cs +++ b/DataUploader/FullSync.aspx.cs @@ -4,6 +4,7 @@ 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; @@ -16,84 +17,72 @@ namespace DataUploader protected void Page_Load(object sender, EventArgs e) { + logger.Info("Inizio FullSync"); DateTime tick = DateTime.Now; - var client = new WebClient(); - client.Headers[HttpRequestHeader.Accept] = "text/html, image/png, image/jpeg, image/gif, */*;q=0.1"; - client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"; - client.Proxy = null; - ServicePointManager.DefaultConnectionLimit = int.MaxValue; - // verifico se vado in modalità demo o meno... - bool demoMode = false; - try + using (var client = new WebClient()) { - 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.getNewDocsUrls(lastNum); - 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 - { - // versione SYNC - content = client.DownloadString(urlsUpdate[i]); - if (ConfigurationManager.AppSettings["debugMode"] == "true") - { - logger.Info("Chiamata, esito {0}{1}{2}, esito {1}", content, Environment.NewLine, urlsUpdate[i]); - } - } - catch - { } - } + + client.Proxy = null; + ServicePointManager.DefaultConnectionLimit = int.MaxValue; + // verifico se vado in modalità demo o meno... + bool demoMode = false; try { - logger.Info("Effettuato upload FULL SYNC: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); + demoMode = Convert.ToBoolean(Request.QueryString["DemoMode"]); } catch + { } + // recupero ultimo numero doc caricato... + int lastNum = 0; + try { - logger.Info("Effettuato upload FULL SYNC: durata {0} sec", DateTime.Now.Subtract(tick).Seconds); + 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.getNewDocsUrls(lastNum); + 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 + { + logger.Info("Chiamata [{0}]", i); + // versione SYNC + content = client.DownloadString(urlsUpdate[i]); + logger.Info("Risposta [{0}] - {1}", content, urlsUpdate[i]); + } + catch + { } + } + try + { + logger.Info("Effettuato upload FULL SYNC: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); + } + catch + { + logger.Info("Effettuato upload FULL SYNC: durata {0} sec", DateTime.Now.Subtract(tick).Seconds); + } } - } - } - /// - /// ricezione risposta URL... - /// - /// - /// - protected void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) - { - if (ConfigurationManager.AppSettings["debugMode"] == "true") - { - logger.Info("Chiamata, esito {0}", e.Result); } } } diff --git a/DataUploader/Properties/PublishProfiles/Zip.pubxml.user b/DataUploader/Properties/PublishProfiles/Zip.pubxml.user index c90e42b..e755050 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
- 06/15/2015 19:50:01 + 06/16/2015 11:58:10 06/15/2015 12:03:55 @@ -46,7 +46,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt 06/15/2015 12:00:13 - 06/15/2015 19:31:11 + 06/16/2015 11:58:10 \ No newline at end of file diff --git a/DataUploader/SyncDoc.aspx.cs b/DataUploader/SyncDoc.aspx.cs index 929cfc6..9deaf7c 100644 --- a/DataUploader/SyncDoc.aspx.cs +++ b/DataUploader/SyncDoc.aspx.cs @@ -18,52 +18,55 @@ namespace DataUploader protected void Page_Load(object sender, EventArgs e) { DateTime tick = DateTime.Now; - // verifico se vado in modalità demo o meno... - bool demoMode = false; - string DOC = ""; - string Anno = ""; - try + using (var client = new WebClient()) { - demoMode = Convert.ToBoolean(Request.QueryString["DemoMode"]); - DOC = Request.QueryString["DOC"]; - Anno = Request.QueryString["Anno"]; - } - catch - { } - // recupero numero doc da cod documento + anno... - if (DOC != "" && Anno != "") - { - // recupero i dati da caricare... - string[] urlsUpdate = GestData.proc.getDocsUrls(DOC, Anno); - if (demoMode) + client.Proxy = null; + ServicePointManager.DefaultConnectionLimit = int.MaxValue; + // verifico se vado in modalità demo o meno... + bool demoMode = false; + string DOC = ""; + string Anno = ""; + try { - lblOut.Text = string.Format("DEMO MODE!
DOC: {0}/{1}", DOC, Anno); - for (int i = 0; i < urlsUpdate.Length; i++) - { - lblOut.Text += string.Format("
{0:000}) {1}", i + 1, urlsUpdate[i]); - } - logger.Info("Effettuato DEMO upload singolo documento: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); + demoMode = Convert.ToBoolean(Request.QueryString["DemoMode"]); + DOC = Request.QueryString["DOC"]; + Anno = Request.QueryString["Anno"]; } - else + catch + { } + // recupero numero doc da cod documento + anno... + if (DOC != "" && Anno != "") { - lblOut.Text = string.Format("Dati caricati!
DOC: {0}/{1}", DOC, Anno); - var client = new WebClient(); - client.Headers[HttpRequestHeader.Accept] = "text/html, image/png, image/jpeg, image/gif, */*;q=0.1"; - client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12"; - for (int i = 0; i < urlsUpdate.Length; i++) + // recupero i dati da caricare... + string[] urlsUpdate = GestData.proc.getDocsUrls(DOC, Anno); + if (demoMode) { - try + lblOut.Text = string.Format("DEMO MODE!
DOC: {0}/{1}", DOC, Anno); + for (int i = 0; i < urlsUpdate.Length; i++) { - var content = client.DownloadString(urlsUpdate[i]); - if (ConfigurationManager.AppSettings["debugMode"] == "true") - { - logger.Info("Chiamata, esito {0}{1}{2}{1}", content, Environment.NewLine, urlsUpdate[i]); - } + lblOut.Text += string.Format("
{0:000}) {1}", i + 1, urlsUpdate[i]); } - catch - { } + logger.Info("Effettuato DEMO upload singolo documento: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); + } + else + { + lblOut.Text = string.Format("Dati caricati!
DOC: {0}/{1}", DOC, Anno); + + for (int i = 0; i < urlsUpdate.Length; i++) + { + try + { + var content = client.DownloadString(urlsUpdate[i]); + if (ConfigurationManager.AppSettings["debugMode"] == "true") + { + logger.Info("Chiamata, esito {0}{1}{2}{1}", content, Environment.NewLine, urlsUpdate[i]); + } + } + catch + { } + } + logger.Info("Effettuato upload singolo documento: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); } - logger.Info("Effettuato upload singolo documento: durata {0} msec", DateTime.Now.Subtract(tick).TotalMilliseconds); } } } diff --git a/DataUploader/Web.config b/DataUploader/Web.config index 0ac228c..38734b9 100644 --- a/DataUploader/Web.config +++ b/DataUploader/Web.config @@ -5,7 +5,7 @@ - + diff --git a/DataUploader/bin/DataUploader.dll b/DataUploader/bin/DataUploader.dll index 170c96b..8f37073 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 dc37b62..38734b9 100644 --- a/DataUploader/bin/DataUploader.dll.config +++ b/DataUploader/bin/DataUploader.dll.config @@ -1,20 +1,38 @@ - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ReleaseClienti/DataUploader.zip b/ReleaseClienti/DataUploader.zip index 7e2cd7f..eb4cbe8 100644 Binary files a/ReleaseClienti/DataUploader.zip and b/ReleaseClienti/DataUploader.zip differ diff --git a/ReleaseClienti/DataUploader/Web.config b/ReleaseClienti/DataUploader/Web.config index 9e0f8fe..7cead59 100644 --- a/ReleaseClienti/DataUploader/Web.config +++ b/ReleaseClienti/DataUploader/Web.config @@ -5,7 +5,7 @@ - + diff --git a/ReleaseClienti/DataUploader/bin/DataUploader.dll b/ReleaseClienti/DataUploader/bin/DataUploader.dll index 170c96b..bb02eff 100644 Binary files a/ReleaseClienti/DataUploader/bin/DataUploader.dll and b/ReleaseClienti/DataUploader/bin/DataUploader.dll differ