diff --git a/ETS-WS/ETS-WS/Web.ETS.config b/ETS-WS/ETS-WS/Web.ETS.config index 711d271..49adc27 100644 --- a/ETS-WS/ETS-WS/Web.ETS.config +++ b/ETS-WS/ETS-WS/Web.ETS.config @@ -15,6 +15,10 @@ --> + + - - + + diff --git a/ETS-WS/ETS-WS/WebShipUtils.cs b/ETS-WS/ETS-WS/WebShipUtils.cs index 2ebd575..16a1a98 100644 --- a/ETS-WS/ETS-WS/WebShipUtils.cs +++ b/ETS-WS/ETS-WS/WebShipUtils.cs @@ -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 /// restituisce valore INT del nuovo file archiviato 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); diff --git a/ETS-WS/ETS-WS/bin/ETS-WS.dll b/ETS-WS/ETS-WS/bin/ETS-WS.dll index 1f3b362..7861a72 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS-WS.dll and b/ETS-WS/ETS-WS/bin/ETS-WS.dll differ diff --git a/ETS-WS/ETS-WS/bin/ETS_Data.dll b/ETS-WS/ETS-WS/bin/ETS_Data.dll index bad6bdf..c9d80e6 100644 Binary files a/ETS-WS/ETS-WS/bin/ETS_Data.dll and b/ETS-WS/ETS-WS/bin/ETS_Data.dll differ diff --git a/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize.parameters.xml b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize.parameters.xml new file mode 100644 index 0000000..cc6b488 --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize.parameters.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/original/Web.config b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/original/Web.config new file mode 100644 index 0000000..6f436ce --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/original/Web.config @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/transformed/Web.config b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/transformed/Web.config new file mode 100644 index 0000000..eb8a3fa --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/CSAutoParameterize/transformed/Web.config @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/ETS-WS.csprojResolveAssemblyReference.cache b/ETS-WS/ETS-WS/obj/ETS/ETS-WS.csprojResolveAssemblyReference.cache index ae0e769..d934e74 100644 Binary files a/ETS-WS/ETS-WS/obj/ETS/ETS-WS.csprojResolveAssemblyReference.cache and b/ETS-WS/ETS-WS/obj/ETS/ETS-WS.csprojResolveAssemblyReference.cache differ diff --git a/ETS-WS/ETS-WS/obj/ETS/ETS-WS.dll b/ETS-WS/ETS-WS/obj/ETS/ETS-WS.dll index 1f3b362..7861a72 100644 Binary files a/ETS-WS/ETS-WS/obj/ETS/ETS-WS.dll and b/ETS-WS/ETS-WS/obj/ETS/ETS-WS.dll differ diff --git a/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SetParameters.xml b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SetParameters.xml new file mode 100644 index 0000000..1eb58a3 --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SetParameters.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SourceManifest.xml b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SourceManifest.xml new file mode 100644 index 0000000..7c40556 --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.SourceManifest.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy-readme.txt b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy-readme.txt new file mode 100644 index 0000000..903a8bc --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy-readme.txt @@ -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: + 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://: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:///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: +/P: +/G: + 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: + 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 + diff --git a/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy.cmd b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy.cmd new file mode 100644 index 0000000..3e394e1 --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.deploy.cmd @@ -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 diff --git a/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.zip b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.zip new file mode 100644 index 0000000..57fc361 Binary files /dev/null and b/ETS-WS/ETS-WS/obj/ETS/Package/ETS-WS.zip differ diff --git a/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/original/Web.config b/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/original/Web.config new file mode 100644 index 0000000..813167f --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/original/Web.config @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/transformed/Web.config b/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/transformed/Web.config new file mode 100644 index 0000000..6f436ce --- /dev/null +++ b/ETS-WS/ETS-WS/obj/ETS/TransformWebConfig/transformed/Web.config @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ETS_Data/ETS_Data.csproj b/ETS_Data/ETS_Data.csproj index 0a2dba1..10d3082 100644 --- a/ETS_Data/ETS_Data.csproj +++ b/ETS_Data/ETS_Data.csproj @@ -108,6 +108,7 @@ + diff --git a/ETS_Data/SQL/ETS_WS/ETS_WS_00131.sql b/ETS_Data/SQL/ETS_WS/ETS_WS_00131.sql new file mode 100644 index 0000000..c3cba15 --- /dev/null +++ b/ETS_Data/SQL/ETS_WS/ETS_WS_00131.sql @@ -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 diff --git a/ETS_Data/bin/ETS/ETS_Data.dll b/ETS_Data/bin/ETS/ETS_Data.dll index bad6bdf..c9d80e6 100644 Binary files a/ETS_Data/bin/ETS/ETS_Data.dll and b/ETS_Data/bin/ETS/ETS_Data.dll differ diff --git a/ETS_Data/fileMover.cs b/ETS_Data/fileMover.cs index 48a0623..4a39f3e 100644 --- a/ETS_Data/fileMover.cs +++ b/ETS_Data/fileMover.cs @@ -78,12 +78,52 @@ namespace ETS_Data /// 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; + }/// + /// verifica possibilità di creazione file (se non c'è lo crea e lo distrugge) + /// + /// + /// + 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; } /// /// elimina un file dato path e nomefile diff --git a/ETS_Data/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/ETS_Data/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index a5daf82..f9059ce 100644 Binary files a/ETS_Data/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/ETS_Data/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/ETS_Data/obj/Debug/ETS_Data.csproj.FileListAbsolute.txt b/ETS_Data/obj/Debug/ETS_Data.csproj.FileListAbsolute.txt index fbd032c..7c7f2b9 100644 --- a/ETS_Data/obj/Debug/ETS_Data.csproj.FileListAbsolute.txt +++ b/ETS_Data/obj/Debug/ETS_Data.csproj.FileListAbsolute.txt @@ -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 diff --git a/ETS_Data/obj/Debug/ETS_Data.csprojResolveAssemblyReference.cache b/ETS_Data/obj/Debug/ETS_Data.csprojResolveAssemblyReference.cache deleted file mode 100644 index 9b27ce9..0000000 Binary files a/ETS_Data/obj/Debug/ETS_Data.csprojResolveAssemblyReference.cache and /dev/null differ diff --git a/ETS_Data/obj/Debug/ETS_Data.dll b/ETS_Data/obj/Debug/ETS_Data.dll index 0ef5ada..9aa986c 100644 Binary files a/ETS_Data/obj/Debug/ETS_Data.dll and b/ETS_Data/obj/Debug/ETS_Data.dll differ diff --git a/ETS_Data/obj/ETS/DesignTimeResolveAssemblyReferencesInput.cache b/ETS_Data/obj/ETS/DesignTimeResolveAssemblyReferencesInput.cache index 88f4677..a687d31 100644 Binary files a/ETS_Data/obj/ETS/DesignTimeResolveAssemblyReferencesInput.cache and b/ETS_Data/obj/ETS/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/ETS_Data/obj/ETS/ETS_Data.dll b/ETS_Data/obj/ETS/ETS_Data.dll index bad6bdf..c9d80e6 100644 Binary files a/ETS_Data/obj/ETS/ETS_Data.dll and b/ETS_Data/obj/ETS/ETS_Data.dll differ diff --git a/ETS_Data/utils.cs b/ETS_Data/utils.cs index fe2ba10..d0ed9f9 100644 --- a/ETS_Data/utils.cs +++ b/ETS_Data/utils.cs @@ -475,7 +475,7 @@ namespace ETS_Data /// 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("__", "_"); } /// /// restituisce, in caso di null o stringa vuota, il carattere "*"