chiusura fix

-email
-gest template
This commit is contained in:
Samuele Locatelli
2013-02-21 13:33:03 +01:00
parent 51bb055151
commit e2d757c14e
16 changed files with 17 additions and 68 deletions
+13 -4
View File
@@ -382,10 +382,19 @@ namespace ETS_WS
DirectoryInfo dir = new DirectoryInfo(destFolder);
FileInfo file = dir.GetFiles("*.eml", SearchOption.TopDirectoryOnly).OrderByDescending(m => m.CreationTimeUtc).First();
// hack: inserisco il campo "non inviato" nel file di testo della email... "X-Unsent: 1"
StreamWriter sw = file.AppendText();
sw.Write(Environment.NewLine);
sw.Write("X-Unsent: 1");
// hack: inserisco il campo "non inviato" nel file di testo della email... "X-Unsent: 1" va messo all'inizio x cui rileggo file e lo riscrivo!
string nomeFile = file.Name;
string contenutoEmail = "X-Unsent: 1";
contenutoEmail += Environment.NewLine;
StreamReader sr = file.OpenText();
contenutoEmail += sr.ReadToEnd();
sr.Close();
// scrivo nuovo testo!
StreamWriter sw = file.CreateText();
sw.Write(contenutoEmail);
//StreamWriter sw = file.AppendText();
//sw.Write(Environment.NewLine);
//sw.Write("X-Unsent: 1");
sw.Flush();
return file.Name;
}
@@ -74,67 +74,6 @@ namespace ETS_WS.WebUserControls
}
Response.Redirect("~/GestioneDocumenti.aspx");
}
#if false
/// <summary>
/// genera un doc da template, tramite
/// - salvataggio
/// - spostamento "dummy file"
/// - enter in modalità editing
/// </summary>
/// <param name="nomeTemplate">file TEMPLATE</param>
private int generaDocDaTemplate(string nomeTemplate)
{
int idxFile = 0;
fileMover.obj.muoviFile("~/DocTemplates/", WebShipUtils.mng.UserTempPath, nomeTemplate, false);
// stacco un nuovo protocollo!
docMetaDataSet docsData = WebShipUtils.mng.currMetaData;
//check del path
string pathDest = docsData.path;
if (pathDest != "")
{
// verifico se è comunicazione red = riservata
string comPath = "";
if (!docsData.isRed)
{
comPath = utils.obj.confReadString("archiveDir");
}
else
{
comPath = utils.obj.confReadString("archiveDirRed");
}
// aggiunto al path cartella archivio corretta...
pathDest = string.Format("{0}{1}", comPath, docsData.path);
// fix redattore
string redattore = utils.obj.currUserNomeCognome; // usa utente corrente
idxFile = WebShipUtils.archiviaFile(docsData, WebShipUtils.mng.UserTempPath, pathDest, nomeTemplate, redattore);
// recupero dati documento
docsData = WebShipUtils.mng.docMetaFromIdxFile(idxFile);
// recupero full path del documento
string fullPath = Server.MapPath(string.Format("{0}{1}", pathDest, WebShipUtils.nomeFileFullFromIdxFile(idxFile)));
string protocollo = WebShipUtils.protocolloFromIdxFile(idxFile);
// se il nome contiene "docx" faccio sostituzioni...
if (nomeTemplate.IndexOf("docx") >= 0)
{
// prendo il nuovo file generato e sostituisco parte del nome con il codice protocollo // link: msdn.microsoft.com/en-us/library/bb508261.aspx
officeXmlMan.replaceDocxText(fullPath, "{{Protocollo}}", protocollo);
officeXmlMan.replaceDocxText(fullPath, "{{DataDoc}}", docsData.dataDoc.ToShortDateString());
officeXmlMan.replaceDocxText(fullPath, "{{Redattore}}", utils.obj.currUserCognomeNome);
}
else if (nomeTemplate.IndexOf("eml") >= 0)
{
// creo un NUOVO file alla destinazione sostituendo l'esistente con apposita classe
string mittente = utils.obj.currUserEmail;
string destinatario = WebShipUtils.emailDaCodForn(docsData.fonte);
string subject = string.Format("{0}, prot. num {1}", docsData.oggetto, protocollo);
string body = string.Format("Commessa: {1}{0}Fase: {2}{0}Oggetto: {3}{0}prot. num: {4}", Environment.NewLine, docsData.commessa, docsData.fase, docsData.oggetto, protocollo);
string newFileName = WebShipUtils.CreaEml(mittente, destinatario, subject, body, null, Server.MapPath(pathDest));
// sostituisco file appena creato con quello nuovo
fileMover.obj.muoviFile(pathDest, pathDest, newFileName, WebShipUtils.nomeFileFullFromIdxFile(idxFile), true);
}
}
return idxFile;
}
#endif
/// <summary>
/// richiede salvataggio del protocollo, tramite
/// - salvataggio
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
<IisApp path="C:\Users\samuele\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" managedRuntimeVersion="v4.0" />
<setAcl path="C:\Users\samuele\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" setAclResourceType="Directory" />
<setAcl path="C:\Users\samuele\Documents\Visual Studio 2010\Projects\ETS\ETS-WS\ETS-WS\obj\ETS\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
<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>
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -237,5 +237,6 @@ namespace ETS_Data
bool fatto = muoviFile(_pathFrom, _pathTo, _nomeFile, true);
return fatto;
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.