update x gestione ulteriore trim directory

This commit is contained in:
Samuele Locatelli
2013-03-22 11:19:07 +01:00
parent a9b8a3e114
commit 48db3e913e
28 changed files with 960 additions and 14 deletions
+4
View File
@@ -15,6 +15,10 @@
</connectionStrings>
-->
<appSettings>
<add key="maxFullPathLenght" value="200"
xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="maxPathLenght" value="190"
xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="ETS_WSConnectionString" value="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16"
xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="ETS_AnagraficaConnectionString" value="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16"
+2 -2
View File
@@ -47,8 +47,8 @@
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<!--gestione trim caratteri-->
<add key="maxFullPathLenght" value="220" />
<add key="maxPathLenght" value="200" />
<add key="maxFullPathLenght" value="120" />
<add key="maxPathLenght" value="110" />
<add key="separatoreTrim" value="..." />
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
+31 -7
View File
@@ -38,14 +38,15 @@ namespace ETS_WS
{
// calcolo valori data e maxPathLenght
string aammgg = metaDati.dataDoc.ToString("yyMMdd");
int maxFullPathLenght = utils.obj.confReadInt("maxFullPathLenght");
int maxPathLenght = utils.obj.confReadInt("maxPathLenght");
// calcolo il path, ipotizzando di lasciare ad oggetto max 200 char - con pulizia eventuali doppie barre
answ = string.Format("/{0}/{1}/{2}/{3}/{4}_{5}/", utils.cleanPathName(metaDati.commessa), utils.cleanPathName(metaDati.fase), metaDati.InOut, utils.cleanPathName(metaDati.fonte), aammgg, utils.shrinkString(utils.cleanPathName(metaDati.oggetto), maxPathLenght)).Replace("//", "/").Replace("//", "/").Replace("//", "/");
// se la lungh totale è > maxPathLenght (restano 260-maxPathLenght char x nome file...) trimmo oggetto!
if (answ.Length > maxPathLenght)
if (answ.Length > maxFullPathLenght)
{
// ricalcolo riducendo oggetto: maxPathLenght - (answ.Length - maxPathLenght) - con pulizia eventuali doppie barre
answ = string.Format("/{0}/{1}/{2}/{3}/{4}_{5}/", utils.cleanPathName(metaDati.commessa), utils.cleanPathName(metaDati.fase), metaDati.InOut, utils.cleanPathName(metaDati.fonte), aammgg, utils.shrinkString(utils.cleanPathName(metaDati.oggetto), maxPathLenght - (answ.Length - maxPathLenght))).Replace("//", "/").Replace("//", "/").Replace("//", "/");
answ = string.Format("/{0}/{1}/{2}/{3}/{4}_{5}/", utils.cleanPathName(metaDati.commessa), utils.cleanPathName(metaDati.fase), metaDati.InOut, utils.cleanPathName(metaDati.fonte), aammgg, utils.shrinkString(utils.cleanPathName(metaDati.oggetto), maxPathLenght - (answ.Length - maxFullPathLenght))).Replace("//", "/").Replace("//", "/").Replace("//", "/");
}
}
catch
@@ -122,7 +123,7 @@ namespace ETS_WS
currMeta.InOut = rigaDoc.InOut;
currMeta.isRed = rigaDoc.isRed;
currMeta.oggetto = rigaDoc.Oggetto;
currMeta.path = rigaDoc.fullPath.Replace(utils.obj.confReadString("archiveDir"), "");
currMeta.path = rigaDoc.fullPath.Replace(utils.obj.confReadString("archiveDirRed"), "").Replace(utils.obj.confReadString("archiveDir"), "");
currMeta.reqProto = (rigaDoc.Numero > 0);
// recupero tags!
DS_WebScip.Tags2DocDataTable tabTags = utils.obj.taTags2Doc.getByIdxFile(idxFile);
@@ -429,6 +430,7 @@ namespace ETS_WS
/// <returns>restituisce valore INT del nuovo file archiviato</returns>
public static int archiviaFile(docMetaDataSet docsData, string pathOrig, string pathDest, string nomeFile, string redattore)
{
Logger lg = LogManager.GetCurrentClassLogger();
int answ = 0;
string autore = ""; // tolto!
string numComm = "";
@@ -464,8 +466,24 @@ namespace ETS_WS
}
// ricalcolo nome file
string newFileName = WebShipUtils.nomeFileFullFromIdxFile((int)newIdxFile);
// sposto file
fileMover.obj.muoviFile(pathOrig, pathDest, nomeFile, newFileName, true);
// verifico riesca a creare folder
DirectoryInfo _di = fileMover.checkDir(pathDest);
// controllo buon fine!
bool fatto = false;
if (_di != null)
{
string fullNameDest = string.Format("{0}/{1}", pathDest, newFileName).Replace("//", "/");
// controllo possa creare file...
if (fileMover.fileCouldExist(fullNameDest))
{
// sposto file
fatto = fileMover.obj.muoviFile(pathOrig, pathDest, nomeFile, newFileName, true);
}
else
{
lg.Error(string.Format("Impossibile creare file con questo nome: {0}", fullNameDest));
}
}
// restituisco idxFile...
return answ;
}
@@ -718,6 +736,12 @@ namespace ETS_WS
string pathDest = docsData.path;
if (pathDest != "")
{
// ulteriore verifica del path sotto dimensione massima...
if (pathDest.Length > utils.obj.confReadInt("maxFullPathLenght"))
{
// loggo!
lg.Error("Errore: trovato path troppo lungo ({0} char): {1}", pathDest.Length, pathDest);
}
// verifico se è comunicazione red = riservata
string comPath = "";
if (!docsData.isRed)
@@ -771,7 +795,7 @@ namespace ETS_WS
officeXmlMan.replaceDocxText(fullPath, "FaxNum", FaxNum);
officeXmlMan.replaceDocxText(fullPath, "FonteDoc", FonteDoc);
}
catch(Exception exc)
catch (Exception exc)
{
lg.Error("Errore replace testo: {0}", exc);
}
@@ -803,7 +827,7 @@ namespace ETS_WS
* {6} = mittente
* *************************************************************/
string subject = string.Format(utils.obj.confReadString("mailSubject"), Environment.NewLine, docsData.oggetto, NumProt, docsData.dataDoc, docsData.commessa, redattore, mittente);
string body = "";
body += string.Format(utils.obj.confReadString("mailBody01"), Environment.NewLine, docsData.oggetto, NumProt, docsData.dataDoc, docsData.commessa, redattore, mittente);
body += string.Format(utils.obj.confReadString("mailBody02"), Environment.NewLine, docsData.oggetto, NumProt, docsData.dataDoc, docsData.commessa, redattore, mittente);
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<parameter name="ETS_Data.Properties.Settings.ETS_WSConnectionString-Web.config Connection String" description="ETS_Data.Properties.Settings.ETS_WSConnectionString Connection String used in web.config by the application to access the database." defaultvalue="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" tags="SqlConnectionString">
<parameterEntry kind="XmlFile" scope="C:\\Users\\samuele\.STEAMWAREWIN\\Documents\\Visual\ Studio\ 2010\\Projects\\ETS\\ETS-WS\\ETS-WS\\obj\\ETS\\Package\\PackageTmp\\Web\.config$" match="/configuration/connectionStrings/add[@name='ETS_Data.Properties.Settings.ETS_WSConnectionString']/@connectionString" />
</parameter>
<parameter name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString-Web.config Connection String" description="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString Connection String used in web.config by the application to access the database." defaultvalue="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" tags="SqlConnectionString">
<parameterEntry kind="XmlFile" scope="C:\\Users\\samuele\.STEAMWAREWIN\\Documents\\Visual\ Studio\ 2010\\Projects\\ETS\\ETS-WS\\ETS-WS\\obj\\ETS\\Package\\PackageTmp\\Web\.config$" match="/configuration/connectionStrings/add[@name='ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString']/@connectionString" />
</parameter>
</parameters>
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<authentication mode="Windows" />
<globalization culture="it-IT" enableClientBasedCulture="true" uiCulture="it" />
</system.web>
<appSettings>
<!--config base applicazione-->
<add key="CodModulo" value="WebScip" />
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
<add key="titleApp" value="ETS-WS_titleApp" />
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
<add key="appName" value="ETS-WS" />
<add key="SiteName" value="ETS" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="130" />
<add key="copyRight" value="SteamWare, ETS © 2012-2013" />
<add key="tempUplDir" value="~/TempUploads" />
<add key="archiveDir" value="~/ArchivioDocs" />
<add key="archiveDirRed" value="~/ArchivioDocsRed" />
<add key="stdEmail" value="info@etseng.it" />
<!--area gestione auth cookie-->
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="6" />
<!--area date-->
<add key="defDayFrom" value="-3650" />
<!--area controlli grid-->
<add key="srcPageSize" value="15" />
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<!--gestione trim caratteri-->
<add key="maxFullPathLenght" value="200" />
<add key="maxPathLenght" value="190" />
<add key="separatoreTrim" value="..." />
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
<add key="MaxRowToDisplay" value="20" />
<!--gestione modalità update richiesta-->
<add key="instantUpdate" value="true" />
<!--conf stringhe email-->
<add key="mailSubject" value="{4} - {1}" />
<add key="mailBody01" value="Villa D'Almè, {3:dd/MM/yyyy}{0}" />
<add key="mailBody02" value="Rif.Comm. N.: {4}{0}" />
<add key="mailBody03" value="Prot. N.: {2}{0}{0}{0}{0}" />
<add key="mailBody04" value="Distinti Saluti.{0}{5}{0}{0}ETS S.p.A.{0}---------------------------------{0}Via A.Mazzi, 32{0}24018 Villa D'Almè{0}Bergamo" />
<add key="mailBody05" value="" />
<!--area conf dataset classi esterne-->
<add key="ETS_WSConnectionString" value="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" />
<add key="ETS_AnagraficaConnectionString" value="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" />
</appSettings>
<connectionStrings>
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" providerName="System.Data.SqlClient" />
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="4.1.60919.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<authentication mode="Windows" />
<globalization culture="it-IT" enableClientBasedCulture="true" uiCulture="it" />
</system.web>
<appSettings>
<!--config base applicazione-->
<add key="CodModulo" value="WebScip" />
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
<add key="titleApp" value="ETS-WS_titleApp" />
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
<add key="appName" value="ETS-WS" />
<add key="SiteName" value="ETS" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="130" />
<add key="copyRight" value="SteamWare, ETS © 2012-2013" />
<add key="tempUplDir" value="~/TempUploads" />
<add key="archiveDir" value="~/ArchivioDocs" />
<add key="archiveDirRed" value="~/ArchivioDocsRed" />
<add key="stdEmail" value="info@etseng.it" />
<!--area gestione auth cookie-->
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="6" />
<!--area date-->
<add key="defDayFrom" value="-3650" />
<!--area controlli grid-->
<add key="srcPageSize" value="15" />
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<!--gestione trim caratteri-->
<add key="maxFullPathLenght" value="200" />
<add key="maxPathLenght" value="190" />
<add key="separatoreTrim" value="..." />
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
<add key="MaxRowToDisplay" value="20" />
<!--gestione modalità update richiesta-->
<add key="instantUpdate" value="true" />
<!--conf stringhe email-->
<add key="mailSubject" value="{4} - {1}" />
<add key="mailBody01" value="Villa D'Almè, {3:dd/MM/yyyy}{0}" />
<add key="mailBody02" value="Rif.Comm. N.: {4}{0}" />
<add key="mailBody03" value="Prot. N.: {2}{0}{0}{0}{0}" />
<add key="mailBody04" value="Distinti Saluti.{0}{5}{0}{0}ETS S.p.A.{0}---------------------------------{0}Via A.Mazzi, 32{0}24018 Villa D'Almè{0}Bergamo" />
<add key="mailBody05" value="" />
<!--area conf dataset classi esterne-->
<add key="ETS_WSConnectionString" value="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" />
<add key="ETS_AnagraficaConnectionString" value="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" />
</appSettings>
<connectionStrings>
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="$(ReplacableToken_ETS_Data.Properties.Settings.ETS_WSConnectionString-Web.config Connection String_0)" providerName="System.Data.SqlClient" />
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="$(ReplacableToken_ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString-Web.config Connection String_0)" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="4.1.60919.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file not shown.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/ETS-WS" />
<setParameter name="ETS_Data.Properties.Settings.ETS_WSConnectionString-Web.config Connection String" value="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" />
<setParameter name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString-Web.config Connection String" value="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" />
</parameters>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
<IisApp path="C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" managedRuntimeVersion="v4.0" />
<setAcl path="C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" setAclResourceType="Directory" />
<setAcl path="C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>
@@ -0,0 +1,63 @@
===========================
Prerequisites :
--------------------------
To deploy this Web package, Web Deploy (msdeploy.exe) must be installed on the computer that runs the .cmd file. For information about how to install Web Deploy, see the following URL:
http://go.microsoft.com/?linkid=9278654
This batch file requires that the package file "ETS-WS.zip" and optionally provided the parameters file "ETS-WS.SetParameters.xml" in the same folder or destination folder by environment variable.
===========================
Usage:
--------------------------
{0} [/T|/Y] [/M:ComputerName] [/U:UserName] [/P:Password] [/G:UseTempAgent] [Additional msdeploy.exe flags ...]
===========================
Required Flags:
--------------------------
/T:
Calls msdeploy.exe with the "-whatif" flag, which simulates deployment. This does not deploy the package. Instead, it creates a report of what will happen when you actually deploy the package.
/Y:
Calls msdeploy.exe without the "-whatif" flag, which deploys the package to the current machine or a destination server. Use /Y after you have verified the output that was generated by using the /T flag.
Note: Do not use /T and /Y in the same command.
===========================
Optional Flags:
--------------------------
By Default, this script deploy on the current machine where this script is called with current user credential without agent service. Only pass the following value for advance scenario.
/M:<Destination server name or Service URL>
If this flag is not specified, the package is installed on the computer where the command is run. The Service URL can be in the following format:
https://<DestinationServer>:8172/MSDeploy.axd
This format requires that IIS 7 be installed on the destination server and that IIS 7 Web Management Service(WMSvc) and Web Deployment Handler be set up.
The service URL can also be in the following format:
http://<DestinationServer>/MSDeployAgentService
This format requires administrative rights on the destination server, and it requires that Web Deploy Remote Service (MsDepSvc) be installed on the destination server. IIS 7 does not have to be installed on the destination server.
/U:<UserName>
/P:<Password>
/G:<True | False>
Specifies that the package is deployed by creating a temporary listener on the destination server. This requires no special installation on the destination server, but it requires you to be an administrator on that server. The default value of this flag is False.
/A:<Basic | NTLM>
Specifies the type of authentication to be used. The possible values are NTLM and Basic. If the wmsvc provider setting is specified, the default authentication type is Basic; otherwise, the default authentication type is NTLM.
/L
Specifies that the package is deployed to local IISExpress user instance.
[Additional msdeploy.exe flags]
The msdeploy.exe command supports additional flags. You can include any of these additional flags in the "$(ProjectName).Deploy.cmd" file, and the flags are passed through to msdeploy.exe during execution.
Alternatively, you can specify additional flags by setting the "_MsDeployAdditionalFlags" environment variable. These settings are used by this batch file.
Note: Any flag value that includes an equal sign (=) must be enclosed in double quotation marks, as shown in the following example, which will skip deploying the databases that are included in the package:
"-skip:objectName=dbFullSql"
===========================
Environment-Specific Settings:
--------------------------
To customize application-specific settings for each deployment environment (for example, the IIS application name, the physical path, and any connection strings), edit the settings in the following file:
"ETS-WS.SetParameters.xml"
===========================
For more information on this deploy script visit: http://go.microsoft.com/fwlink/?LinkID=183544
@@ -0,0 +1,256 @@
@rem ---------------------------------------------------------------------------------
@rem Copyright 2008 Microsoft Corporation. All rights reserved.
@rem This is provided as sample to deploy the package using msdeploy.exe
@rem For information about IIS Web Deploy technology,
@rem please visit http://go.microsoft.com/?linkid=9278654
@rem Note: This batch file assumes the package and setparametsrs.xml are in the same folder with this file
@rem ---------------------------------------------------------------------------------
@if %_echo%!==! echo off
setlocal
@rem ---------------------------------------------------------------------------------
@rem Please Make sure you have Web Deploy install in your machine.
@rem Alternatively, you can explicit set the MsDeployPath to the location it is on your machine
@rem set MSDeployPath="C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\"
@rem ---------------------------------------------------------------------------------
@rem ---------------------------------------------------------------------------------
@rem if user does not set MsDeployPath environment variable, we will try to retrieve it from registry.
@rem ---------------------------------------------------------------------------------
if "%MSDeployPath%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" /s ^| findstr -i "InstallPath"`) do (
if /I "%%h" == "InstallPath" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
if "%%~dpj" == "%%j" (
set MSDeployPath=%%j
))))))
if not exist "%MSDeployPath%\msdeploy.exe" (
echo. msdeploy.exe is not found on this machine. Please install Web Deploy before execute the script.
echo. Please visit http://go.microsoft.com/?linkid=9278654
goto :usage
)
set RootPath=%~dp0
if /I "%_DeploySetParametersFile%" == "" (
set _DeploySetParametersFile=%RootPath%ETS-WS.SetParameters.xml
)
set _ArgTestDeploy=
set _ArgDestinationType=auto
set _ArgComputerName=
set _ArgUserName=
set _ArgPassword=
set _ArgEncryptPassword=
set _ArgIncludeAcls=False
set _ArgAuthType=
set _ArgtempAgent=
set _ArgLocalIIS=
set _ArgLocalIISVersion=
@rem ---------------------------------------------------------------------------------
@rem Simple Parse the arguments
@rem ---------------------------------------------------------------------------------
:NextArgument
set _ArgCurrentOriginal=%1
set _ArgCurrent=%~1
if /I "%_ArgCurrent%" == "" goto :GetStarted
if /I "%_ArgCurrent%" == "/T" set _ArgTestDeploy=true&goto :ArgumentOK
if /I "%_ArgCurrent%" == "/Y" set _ArgTestDeploy=false&goto :ArgumentOK
if /I "%_ArgCurrent%" == "/L" set _ArgLocalIIS=true&goto :ArgumentOK
set _ArgFlag=%_ArgCurrent:~0,3%
set _ArgValue=%_ArgCurrent:~3%
if /I "%_ArgFlag%" == "/M:" set _ArgComputerName=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/U:" set _ArgUserName=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/P:" set _ArgPassword=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/E:" set _ArgEncryptPassword=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/I:" set _ArgIncludeAcls=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/A:" set _ArgAuthType=%_ArgValue%&goto :ArgumentOK
if /I "%_ArgFlag%" == "/G:" set _ArgtempAgent=%_ArgValue%&goto :ArgumentOK
@rem Any addition flags, pass through to the msdeploy
set _ArgMsDeployAdditionalFlags=%_ArgMsDeployAdditionalFlags% %_ArgCurrentOriginal%
:ArgumentOK
shift
goto :NextArgument
:GetStarted
if /I "%_ArgTestDeploy%" == "" goto :usage
if /I "%_ArgDestinationType%" == "" goto :usage
set _Destination=%_ArgDestinationType%
if not "%_ArgComputerName%" == "" set _Destination=%_Destination%,computerName='%_ArgComputerName%'
if not "%_ArgUserName%" == "" set _Destination=%_Destination%,userName='%_ArgUserName%'
if not "%_ArgPassword%" == "" set _Destination=%_Destination%,password='%_ArgPassword%'
if not "%_ArgAuthType%" == "" set _Destination=%_Destination%,authtype='%_ArgAuthType%'
if not "%_ArgEncryptPassword%" == "" set _Destination=%_Destination%,encryptPassword='%_ArgEncryptPassword%'
if not "%_ArgIncludeAcls%" == "" set _Destination=%_Destination%,includeAcls='%_ArgIncludeAcls%'
if not "%_ArgtempAgent%" == "" set _Destination=%_Destination%,tempAgent='%_ArgtempAgent%'
@rem ---------------------------------------------------------------------------------
@rem add -whatif when -T is specified
@rem ---------------------------------------------------------------------------------
if /I "%_ArgTestDeploy%" NEQ "false" (
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -whatif
)
@rem ---------------------------------------------------------------------------------
@rem add flags for IISExpress when -L is specified
@rem ---------------------------------------------------------------------------------
if /I "%_ArgLocalIIS%" == "true" (
call :SetIISExpressArguments
)
if /I "%_ArgLocalIIS%" == "true" (
if not exist "%IISExpressPath%%IISExpressManifest%" (
echo. IISExpress is not found on this machine. Please install through Web Platform Installer before execute the script.
echo. or remove /L flag
echo. Please visit http://go.microsoft.com/?linkid=9278654
goto :usage
)
if not exist "%IISExpressUserProfileDirectory%" (
echo. %IISExpressUserProfileDirectory% is not exists
echo. IISExpress is found on the machine. But the user have run IISExpress at least once.
echo. Please visit http://go.microsoft.com/?linkid=9278654 for detail
goto :usage
)
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% -appHostConfigDir:%IISExpressUserProfileDirectory% -WebServerDir:"%IISExpressPath%" -webServerManifest:"%IISExpressManifest%"
)
@rem ---------------------------------------------------------------------------------
@rem pass through the addition msdeploy.exe Flags
@rem ---------------------------------------------------------------------------------
set _MsDeployAdditionalFlags=%_MsDeployAdditionalFlags% %_ArgMsDeployAdditionalFlags%
@rem ---------------------------------------------------------------------------------
@rem check the existence of the package file
@rem ---------------------------------------------------------------------------------
if not exist "%RootPath%ETS-WS.zip" (
echo "%RootPath%ETS-WS.zip" does not exist.
echo This batch file relies on this deploy source file^(s^) in the same folder.
goto :usage
)
@rem ---------------------------------------------------------------------------------
@rem Execute msdeploy.exe command line
@rem ---------------------------------------------------------------------------------
call :CheckParameterFile
echo. Start executing msdeploy.exe
echo -------------------------------------------------------
if not exist "%_DeploySetParametersFile%" (
echo. "%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%ETS-WS.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -skip:objectname='dirPath',absolutepath='obj\\ETS\\Package\\PackageTmp\\App_Data$' %_MsDeployAdditionalFlags%
"%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%ETS-WS.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -skip:objectname='dirPath',absolutepath='obj\\ETS\\Package\\PackageTmp\\App_Data$' %_MsDeployAdditionalFlags%
) else (
echo. "%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%ETS-WS.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -skip:objectname='dirPath',absolutepath='obj\\ETS\\Package\\PackageTmp\\App_Data$' -setParamFile:"%RootPath%ETS-WS.SetParameters.xml" %_MsDeployAdditionalFlags%
"%MSDeployPath%\msdeploy.exe" -source:package='%RootPath%ETS-WS.zip' -dest:%_Destination% -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -skip:objectname='dirPath',absolutepath='obj\\ETS\\Package\\PackageTmp\\App_Data$' -setParamFile:"%RootPath%ETS-WS.SetParameters.xml" %_MsDeployAdditionalFlags%
)
goto :eof
@rem ---------------------------------------------------------------------------------
@rem Find and set IISExpress argument.
@rem ---------------------------------------------------------------------------------
:SetIISExpressArguments
if "%IISExpressPath%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IISExpress" /s ^| findstr -i "InstallPath"`) do (
if /I "%%h" == "InstallPath" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
if "%%~dpj" == "%%j" (
set IISExpressPath=%%j
))))))
if "%IISExpressPath%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress" /s ^| findstr -i "InstallPath"`) do (
if /I "%%h" == "InstallPath" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
if "%%~dpj" == "%%j" (
set IISExpressPath=%%j
))))))
if "%PersonalDocumentFolder%" == "" (
for /F "usebackq tokens=2*" %%i in (`reg query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`) do (
set PersonalDocumentFolder=%%j
))
if "%IISExpressManifest%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Microsoft\IISExpress" /s ^| findstr -i "Manifest"`) do (
if /I "%%h" == "Manifest" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
set IISExpressManifest=%%j
)))))
if "%IISExpressManifest%" == "" (
for /F "usebackq tokens=1,2,*" %%h in (`reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\IISExpress" /s ^| findstr -i "Manifest"`) do (
if /I "%%h" == "Manifest" (
if /I "%%i" == "REG_SZ" (
if not "%%j" == "" (
set IISExpressManifest=%%j
)))))
set IISExpressUserProfileDirectory="%PersonalDocumentFolder%\IISExpress\config"
goto :eof
@rem ---------------------------------------------------------------------------------
@rem CheckParameterFile -- check if the package's setparamters.xml exists or not
@rem ---------------------------------------------------------------------------------
:CheckParameterFile
echo =========================================================
if exist "%_DeploySetParametersFile%" (
echo SetParameters from:
echo "%_DeploySetParametersFile%"
echo You can change IIS Application Name, Physical path, connectionString
echo or other deploy parameters in the above file.
) else (
echo SetParamterFiles does not exist in package location.
echo Use package embedded defaultValue to deploy.
)
echo -------------------------------------------------------
goto :eof
@rem ---------------------------------------------------------------------------------
@rem Usage
@rem ---------------------------------------------------------------------------------
:usage
echo =========================================================
if not exist "%RootPath%ETS-WS.deploy-readme.txt" (
echo Usage:%~nx0 [/T^|/Y] [/M:ComputerName] [/U:userName] [/P:password] [/G:tempAgent] [additional msdeploy flags ...]
echo Required flags:
echo /T Calls msdeploy.exe with the "-whatif" flag, which simulates deployment.
echo /Y Calls msdeploy.exe without the "-whatif" flag, which deploys the package to the current machine or destination server
echo Optional flags:
echo. By Default, this script deploy to the current machine where this script is invoked which will use current user credential without tempAgent.
echo. Only pass these arguments when in advance scenario.
echo /M: Msdeploy destination name of remote computer or proxy-URL. Default is local.
echo /U: Msdeploy destination user name.
echo /P: Msdeploy destination password.
echo /G: Msdeploy destination tempAgent. True or False. Default is false.
echo /A: specifies the type of authentication to be used. The possible values are NTLM and Basic. If the wmsvc provider setting is specified, the default authentication type is Basic
otherwise, the default authentication type is NTLM.
echo /L: Deploy to Local IISExpress User Instance.
echo.[additional msdeploy flags]: note: " is required for passing = through command line.
echo "-skip:objectName=setAcl" "-skip:objectName=dbFullSql"
echo.Alternative environment variable _MsDeployAdditionalFlags is also honored.
echo.
echo. Please make sure MSDeploy is installed in the box http://go.microsoft.com/?linkid=9278654
echo.
echo In addition, you can change IIS Application Name, Physical path,
echo connectionString and other deploy parameters in the following file:
echo "%_DeploySetParametersFile%"
echo.
echo For more information about this batch file, visit http://go.microsoft.com/fwlink/?LinkID=183544
) else (
start notepad "%RootPath%ETS-WS.deploy-readme.txt"
)
echo =========================================================
goto :eof
Binary file not shown.
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<authentication mode="Windows" />
<globalization culture="it-IT" enableClientBasedCulture="true" uiCulture="it" />
</system.web>
<appSettings>
<!--config base applicazione-->
<add key="CodModulo" value="WebScip" />
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
<add key="titleApp" value="ETS-WS_titleApp" />
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
<add key="appName" value="ETS-WS" />
<add key="SiteName" value="ETS" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="130" />
<add key="copyRight" value="SteamWare, ETS © 2012-2013" />
<add key="tempUplDir" value="~/TempUploads" />
<add key="archiveDir" value="~/ArchivioDocs" />
<add key="archiveDirRed" value="~/ArchivioDocsRed" />
<add key="stdEmail" value="info@etseng.it" />
<!--area gestione auth cookie-->
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="6" />
<!--area date-->
<add key="defDayFrom" value="-3650" />
<!--area controlli grid-->
<add key="srcPageSize" value="15" />
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<!--gestione trim caratteri-->
<add key="maxFullPathLenght" value="120" />
<add key="maxPathLenght" value="110" />
<add key="separatoreTrim" value="..." />
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
<add key="MaxRowToDisplay" value="20" />
<!--gestione modalità update richiesta-->
<add key="instantUpdate" value="true" />
<!--conf stringhe email-->
<add key="mailSubject" value="{4} - {1}" />
<add key="mailBody01" value="Villa D'Almè, {3:dd/MM/yyyy}{0}" />
<add key="mailBody02" value="Rif.Comm. N.: {4}{0}" />
<add key="mailBody03" value="Prot. N.: {2}{0}{0}{0}{0}" />
<add key="mailBody04" value="Distinti Saluti.{0}{5}{0}{0}ETS S.p.A.{0}---------------------------------{0}Via A.Mazzi, 32{0}24018 Villa D'Almè{0}Bergamo" />
<add key="mailBody05" value="" />
<!--area conf dataset classi esterne-->
<add key="ETS_WSConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" />
<add key="ETS_AnagraficaConnectionString" value="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" />
</appSettings>
<connectionStrings>
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="4.1.60919.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<httpRuntime executionTimeout="240" maxRequestLength="32768" />
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<authentication mode="Windows" />
<globalization culture="it-IT" enableClientBasedCulture="true" uiCulture="it" />
</system.web>
<appSettings>
<!--config base applicazione-->
<add key="CodModulo" value="WebScip" />
<add key="_titoloPagina" value="ETS, gestione protocollo Web" />
<add key="titleApp" value="ETS-WS_titleApp" />
<add key="welcomeApp" value="ETS-WS_welcomeApp" />
<add key="appName" value="ETS-WS" />
<add key="SiteName" value="ETS" />
<add key="mainRev" value="1.1" />
<add key="minRev" value="130" />
<add key="copyRight" value="SteamWare, ETS © 2012-2013" />
<add key="tempUplDir" value="~/TempUploads" />
<add key="archiveDir" value="~/ArchivioDocs" />
<add key="archiveDirRed" value="~/ArchivioDocsRed" />
<add key="stdEmail" value="info@etseng.it" />
<!--area gestione auth cookie-->
<add key="enableCookie" value="true" />
<add key="cookieDayExp" value="6" />
<!--area date-->
<add key="defDayFrom" value="-3650" />
<!--area controlli grid-->
<add key="srcPageSize" value="15" />
<!--update pagina-->
<add key="intUpdatePagina_ms" value="120000" />
<!--gestione trim caratteri-->
<add key="maxFullPathLenght" value="200" />
<add key="maxPathLenght" value="190" />
<add key="separatoreTrim" value="..." />
<!--config x WebServices autocompletamento-->
<add key="MinCharAutocomplete" value="2" />
<add key="MaxRowToDisplay" value="20" />
<!--gestione modalità update richiesta-->
<add key="instantUpdate" value="true" />
<!--conf stringhe email-->
<add key="mailSubject" value="{4} - {1}" />
<add key="mailBody01" value="Villa D'Almè, {3:dd/MM/yyyy}{0}" />
<add key="mailBody02" value="Rif.Comm. N.: {4}{0}" />
<add key="mailBody03" value="Prot. N.: {2}{0}{0}{0}{0}" />
<add key="mailBody04" value="Distinti Saluti.{0}{5}{0}{0}ETS S.p.A.{0}---------------------------------{0}Via A.Mazzi, 32{0}24018 Villa D'Almè{0}Bergamo" />
<add key="mailBody05" value="" />
<!--area conf dataset classi esterne-->
<add key="ETS_WSConnectionString" value="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" />
<add key="ETS_AnagraficaConnectionString" value="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" />
</appSettings>
<connectionStrings>
<add name="ETS_Data.Properties.Settings.ETS_WSConnectionString" connectionString="Data Source=localhost;Initial Catalog=ETS_WS;Persist Security Info=True;User ID=steamware;Password=viadante16" providerName="System.Data.SqlClient" />
<add name="ETS_Data.Properties.Settings.ETS_AnagraficaConnectionString" connectionString="Data Source=localhost;Initial Catalog=ETS_Anagrafica;Persist Security Info=True;User ID=steamware;Password=viadante16" providerName="System.Data.SqlClient" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="4.1.60919.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+1
View File
@@ -108,6 +108,7 @@
<Compile Include="utils.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="SQL\ETS_WS\ETS_WS_00131.sql" />
<Content Include="SQL\ETS_WS\ETS_WS_00126.sql" />
<Content Include="SQL\ETS_WS\ETS_WS_00125.sql" />
<Content Include="SQL\ETS_WS\ETS_WS_00121.sql" />
+214
View File
@@ -0,0 +1,214 @@
set xact_abort on;
go
begin transaction;
go
alter table tbDocumenti drop
column Nome;
go
alter table tbDocumenti add
Nome as ((12));
go
exec sp_addextendedproperty 'MS_Description', 'dbo.f_shortFileName([Numero],[Anno],[DataDoc],[InOut],[Oggetto],substring([NomeFile],(0),len([NomeFile])-(3)),substring([NomeFile],len([NomeFile])-(3),(4)),fullPath)', 'SCHEMA', 'dbo', 'TABLE', 'tbDocumenti', 'COLUMN', 'Nome';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/***************************************
* FUNCTION f_shortFileName
*
* calcola nome breve del file da regola
* nnnn-aaaa_BB_Descrizione breve troncata_nomefile.estensione
*
* Steamware, S.E.L.
* mod: 2013.02.22
*
****************************************/
alter FUNCTION f_shortFileName(@numero INT, @anno INT, @dataDoc DATETIME, @inOut NVARCHAR(3), @oggetto NVARCHAR(250), @nome NVARCHAR(250), @tipoDoc NVARCHAR(4), @fullPath NVARCHAR(250))
RETURNS NVARCHAR(250) AS
BEGIN
----------------------------------------
-- dichiaro le componenti del nome
----------------------------------------
DECLARE @AA NVARCHAR(10), @BB NVARCHAR(2), @CC NVARCHAR(150), @DD NVARCHAR(130), @nomeFin NVARCHAR(MAX);
----------------------------------------
-- dichiaro variabili x gestione limite LEN
----------------------------------------
DECLARE @maxFullPathLenght INT = 200 -- 240 -25 (margine) - @aa(14) - 4 (.txt) x la parte finale del nome ".xxx"
DECLARE @fullPathLenght INT
DECLARE @nomeLen INT = 0
DECLARE @extraLen INT = 0
DECLARE @sxPart INT = 15 -- lungh minima a sx...
----------------------------------------
-- calcolo le varie componenti
----------------------------------------
-- protocollo!
SET @AA = dbo.f_padLeft(CAST(CAST(@numero AS INT) AS NVARCHAR(10)), 5,'0') + '-' + CAST(@Anno AS NVARCHAR(4));
-- check digit
SET @BB = dbo.f_checkDigit(@numero, @anno, @dataDoc, @inOut, @nome);
-- nome trimmato @fullPath + @nome <= @maxFullPathLenght, trimmo nome prendendo left/right)
SET @fullPathLenght = LEN(@fullPath + @nome)
IF (@fullPathLenght > @maxFullPathLenght)
BEGIN
-- calcolo LEN del nome, es 202
SET @nomeLen = LEN(@nome)
-- calcolo "sforamento", es 301-225=76
SET @extraLen = @fullPathLenght - @maxFullPathLenght
-- 4 char "bloccati" a dx
SET @sxPart = (@nomeLen - @extraLen)
SET @DD = LEFT(@nome, @sxPart)
END
ELSE
BEGIN
SET @DD = @nome;
END
----------------------------------------
-- nome completo finale
----------------------------------------
--SET @nomeFin = @AA + '_' + @BB + '_' + @CC + '_' + @DD -- versione vecchia: oggetto eliminato perchè in path! 2012.10.22
SET @nomeFin = @AA + '_' + @BB + '_' + @DD
-- ulteriore pulizia...
SET @nomeFin = REPLACE(REPLACE(@nomeFin,'/','-'),'\','-')
RETURN REPLACE(@nomeFin + '.','..','.') + REPLACE(@tipoDoc,'.','')
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table Tags2Doc drop
constraint FK_Tags2Doc_tbDocumenti ;
go
alter table tbDocumenti drop
constraint DF_tbDocumenti_isRed ,
constraint DF_tbDocumenti_Autore ,
constraint DF_tbDocumenti_Spunta ,
constraint DF_tbDocumenti_SR ,
constraint DF_tbDocumenti_Redattore ,
constraint DF_tbDocumenti_SA ;
go
exec sp_rename 'PK_tbDocumenti', 'tmp__PK_tbDocumenti', 'OBJECT';
go
exec sp_rename 'tbDocumenti', 'tmp__tbDocumenti_1', 'OBJECT';
go
create table tbDocumenti(
idxFile int not null identity constraint PK_tbDocumenti primary key,
NomeFile nvarchar(250) not null,
Nome as ([dbo].[f_shortFileName]([Numero],[Anno],[DataDoc],[InOut],[Oggetto],substring([NomeFile],(0),len([NomeFile])-(3)),substring([NomeFile],len([NomeFile])-(3),(4)),[fullPath])),
fullPath nvarchar(500) not null,
userId nvarchar(50) not null,
isRed bit constraint DF_tbDocumenti_isRed default ((0)),
NrProtocollo int,
Numero int,
Anno int,
DataRic datetime,
DataDoc datetime,
Commessa as ((right(replicate('0',(4))+[NumeroCommessa],(4))+'-')+right(replicate('0',(4))+[AnnoCommessa],(4))),
NumeroCommessa nvarchar(4),
AnnoCommessa nvarchar(4),
Fase nvarchar(250),
Fonte nvarchar(100),
Oggetto nvarchar(250),
InOut nvarchar(3),
Tipologia nvarchar(100),
Riferimenti nvarchar(100),
Attivita nvarchar(100),
Autore nvarchar(50) constraint DF_tbDocumenti_Autore default ('-'),
SA nvarchar(4) constraint DF_tbDocumenti_SA default ('-'),
Redattore nvarchar(50) constraint DF_tbDocumenti_Redattore default ('-'),
SR nvarchar(4) constraint DF_tbDocumenti_SR default ('-'),
Annotazioni ntext,
LegUtente nvarchar(25),
NoteSystemManager ntext,
Spunta int constraint DF_tbDocumenti_Spunta default ((0)),
Num_Fattura nvarchar(50)
);
go
set NUMERIC_ROUNDABORT off
set ANSI_NULLS on
set ANSI_PADDING on
set ANSI_WARNINGS on
set CONCAT_NULL_YIELDS_NULL on
set QUOTED_IDENTIFIER on
set ARITHABORT on;
go
create index ix_tbDocumenti_Commessa on tbDocumenti(Commessa desc);
go
create index i_commessa on tbDocumenti(Commessa);
go
create index i_fase on tbDocumenti(Fase);
go
create index i_fonte on tbDocumenti(Fonte);
go
create index i_InOut on tbDocumenti(InOut);
go
create index ix_dataRic on tbDocumenti(DataRic);
go
exec sp_addextendedproperty 'MS_Description', 'dbo.f_shortFileName([Numero],[Anno],[DataDoc],[InOut],[Oggetto],substring([NomeFile],(0),len([NomeFile])-(3)),substring([NomeFile],len([NomeFile])-(3),(4)),fullPath)', 'SCHEMA', 'dbo', 'TABLE', 'tbDocumenti', 'COLUMN', 'Nome';
go
set identity_insert tbDocumenti on;
go
insert into tbDocumenti(idxFile,NomeFile,fullPath,userId,isRed,NrProtocollo,Numero,Anno,DataRic,DataDoc,NumeroCommessa,AnnoCommessa,Fase,Fonte,Oggetto,InOut,Tipologia,Riferimenti,Attivita,Autore,SA,Redattore,SR,Annotazioni,LegUtente,NoteSystemManager,Spunta,Num_Fattura) select idxFile,NomeFile,fullPath,userId,isRed,NrProtocollo,Numero,Anno,DataRic,DataDoc,NumeroCommessa,AnnoCommessa,Fase,Fonte,Oggetto,InOut,Tipologia,Riferimenti,Attivita,Autore,SA,Redattore,SR,Annotazioni,LegUtente,NoteSystemManager,Spunta,Num_Fattura from tmp__tbDocumenti_1;
go
set identity_insert tbDocumenti off;
go
drop table tmp__tbDocumenti_1;
go
alter table Tags2Doc add
constraint FK_Tags2Doc_tbDocumenti foreign key(idxFile) references tbDocumenti(idxFile) on update cascade;
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(131, GETDATE())
GO
SELECT TOP 10 * FROM LogUpdateDb ORDER BY Versione DESC
GO
Binary file not shown.
+43 -3
View File
@@ -78,12 +78,52 @@ namespace ETS_Data
/// <returns></returns>
public static DirectoryInfo checkDir(string dirPath)
{
DirectoryInfo _di = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath(dirPath));
if (!_di.Exists)
Logger lg = LogManager.GetCurrentClassLogger();
DirectoryInfo _di = null;
try
{
_di.Create();
_di = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath(dirPath));
if (!_di.Exists)
{
_di.Create();
}
}
catch (Exception exc)
{
lg.ErrorException("Errore in determinazione mapPath: {0}", exc);
}
return _di;
}/// <summary>
/// verifica possibilità di creazione file (se non c'è lo crea e lo distrugge)
/// </summary>
/// <param name="dirPath"></param>
/// <returns></returns>
public static bool fileCouldExist(string filePath)
{
bool answ = false;
Logger lg = LogManager.GetCurrentClassLogger();
FileInfo _fi = null;
try
{
_fi = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(filePath));
if (_fi.Exists)
{
answ = true;
}
else
{
// creo
_fi.Create();
// cancello
_fi.Delete();
answ = true;
}
}
catch (Exception exc)
{
lg.ErrorException("Errore in determinazione possibilità esistenza file: {0}", exc);
}
return answ;
}
/// <summary>
/// elimina un file dato path e nomefile
@@ -17,4 +17,3 @@ C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS_Data
C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS_Data\bin\Debug\NLog.xml
C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS_Data\obj\Debug\ETS_Data.dll
C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS_Data\obj\Debug\ETS_Data.pdb
C:\Users\samuele.STEAMWAREWIN\Documents\Visual Studio 2010\Projects\ETS\ETS_Data\obj\Debug\ETS_Data.csprojResolveAssemblyReference.cache
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -475,7 +475,7 @@ namespace ETS_Data
/// <returns></returns>
public static string cleanPathName(string originalName)
{
return originalName.Trim().Replace("&", "e").Replace(".", "").Replace(",", "").Replace(";", "").Replace(":", "").Replace("/", "-").Replace(@"\", "-").Replace(@"'", "_").Replace("\"", "_").Replace("#", "_").Replace("?", "_").Replace("*", "_");
return originalName.Trim().Replace("&", "e").Replace(".", "").Replace(",", "").Replace(";", "").Replace(":", "").Replace("/", "-").Replace(@"\", "-").Replace(@"'", "_").Replace("\"", "_").Replace("#", "_").Replace("?", "_").Replace("*", "_").Replace(" ", "_").Replace("__", "_").Replace("__", "_");
}
/// <summary>
/// restituisce, in caso di null o stringa vuota, il carattere "*"