update dataUploader...
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -71,7 +72,9 @@
|
||||
<Content Include="FullSync.aspx" />
|
||||
<Content Include="images\LogoSteamware.png" />
|
||||
<Content Include="SyncDoc.aspx" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.config">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Default.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!<br/>ultimo NUMERO: {0}", lastNum);
|
||||
for (int i = 0; i < urlsUpdate.Length; i++)
|
||||
{
|
||||
lblOut.Text += string.Format("<br/>{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!<br/>{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!<br/>ultimo NUMERO: {0}", lastNum);
|
||||
for (int i = 0; i < urlsUpdate.Length; i++)
|
||||
{
|
||||
lblOut.Text += string.Format("<br/>{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!<br/>{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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// ricezione risposta URL...
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
|
||||
{
|
||||
if (ConfigurationManager.AppSettings["debugMode"] == "true")
|
||||
{
|
||||
logger.Info("Chiamata, esito {0}", e.Result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<File Include="bin/DataUploader.dll">
|
||||
<publishTime>06/15/2015 19:50:01</publishTime>
|
||||
<publishTime>06/16/2015 11:58:10</publishTime>
|
||||
</File>
|
||||
<File Include="bin/NLog.config">
|
||||
<publishTime>06/15/2015 12:03:55</publishTime>
|
||||
@@ -46,7 +46,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt
|
||||
<publishTime>06/15/2015 12:00:13</publishTime>
|
||||
</File>
|
||||
<File Include="Web.config">
|
||||
<publishTime>06/15/2015 19:31:11</publishTime>
|
||||
<publishTime>06/16/2015 11:58:10</publishTime>
|
||||
</File>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -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!<br/>DOC: {0}/{1}", DOC, Anno);
|
||||
for (int i = 0; i < urlsUpdate.Length; i++)
|
||||
{
|
||||
lblOut.Text += string.Format("<br/>{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!<br/>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!<br/>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("<br/>{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!<br/>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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<add key="maxDocsToUpload" value="2" />
|
||||
<add key="remoteDocUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Document" />
|
||||
<add key="remoteCliUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Client" />
|
||||
<add key="debugMode" value="true" />
|
||||
<add key="debugMode" value="false" />
|
||||
<!--connessione su un MDB di cui esiste un DSN-->
|
||||
<!--<add key="connString" value="Dsn=DB_Sigla32;Initial Catalog=TESDOCUM;" />-->
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,20 +1,38 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<!--parametri base-->
|
||||
<add key="maxDocsToUpload" value="50" />
|
||||
<add key="maxDocsToUpload" value="2" />
|
||||
<add key="remoteDocUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Document" />
|
||||
<add key="remoteCliUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Client" />
|
||||
<add key="debugMode" value="false" />
|
||||
<!--connessione su un MDB di cui esiste un DSN-->
|
||||
<!--<add key="connString" value="Dsn=DB_Sigla32;Initial Catalog=TESDOCUM;" />-->
|
||||
|
||||
<!--funziona se esiste un DSN DITTA1-->
|
||||
<!--<add key="connString" value="Dsn=DITTA1;Uid=DB2;Pwd=ccL21x$1wow;Initial Catalog=TESDOCUM;" />-->
|
||||
|
||||
<!--funziona anche senza DSN esistente-->
|
||||
<add key="connString" value="Driver={IBM DB2 ODBC DRIVER};DataBase=DITTA1; HostName=RigaSRV02; Protocol=TCPIP;Port=50000;Uid=DB2;Pwd=ccL21x$1wow" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
<runtime>
|
||||
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
<assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
</assemblyBinding>
|
||||
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
||||
|
||||
Binary file not shown.
@@ -5,7 +5,7 @@
|
||||
<add key="maxDocsToUpload" value="2" />
|
||||
<add key="remoteDocUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Document" />
|
||||
<add key="remoteCliUrl" value="http://webscr.steamware.net/Rigamonti/Upload/Client" />
|
||||
<add key="debugMode" value="true" />
|
||||
<add key="debugMode" value="false" />
|
||||
<!--connessione su un MDB di cui esiste un DSN-->
|
||||
<!--<add key="connString" value="Dsn=DB_Sigla32;Initial Catalog=TESDOCUM;" />-->
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user