ulteriore modifica x spostare file con nome from e nome to...

This commit is contained in:
samuele
2012-10-09 18:51:47 +02:00
parent ff41909f25
commit 68fb656190
4 changed files with 34 additions and 1 deletions
@@ -196,7 +196,7 @@ namespace ETS_WS.WebUserControls
// svuoto area di temp!
fileMover.obj.svuotaDirTemp(WebShipUtils.mng.UserTempPath);
// copio file corrente in temp!
fileMover.obj.muoviFile(WebShipUtils.mng.UserTempPath, rigaDoc.fullPath, rigaDoc.NomeFile, false);
fileMover.obj.muoviFile(WebShipUtils.mng.UserTempPath, rigaDoc.fullPath,rigaDoc.Nome, rigaDoc.NomeFile, false);
// evento segnalazione richeista editing!
Response.Redirect("~/MyDocs.aspx");
}
Binary file not shown.
Binary file not shown.
+33
View File
@@ -175,6 +175,39 @@ namespace ETS_Data
/// </summary>
/// <param name="_pathFrom"></param>
/// <param name="_pathTo"></param>
/// <param name="_nomeFileFrom"></param>
/// <param name="_nomeFileTo"></param>
/// <param name="deleteOrig">determina se fare DAVVERO MOVE (cancella file origine) o solo copy (niente cancellazione file origine)</param>
/// <returns></returns>
public bool muoviFile(string _pathFrom, string _pathTo, string _nomeFileFrom, string _nomeFileTo, bool deleteOrig)
{
bool fatto = false;
// verifica directory
checkDir(_pathFrom);
checkDir(_pathTo);
string filePathFrom = string.Format("{0}/{1}", _pathFrom, _nomeFileFrom).Replace("//", "/");
string filePathTo = string.Format("{0}/{1}", _pathTo, _nomeFileTo).Replace("//", "/");
FileInfo _fi = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(filePathFrom));
try
{
_fi.CopyTo(System.Web.HttpContext.Current.Server.MapPath(filePathTo), true);
if (deleteOrig)
{
_fi.Delete();
}
fatto = true;
}
catch (Exception e)
{
lg.ErrorException("Eccezione in spostamento file!", e);
}
return fatto;
}
/// <summary>
/// sposta il file da From a To...
/// </summary>
/// <param name="_pathFrom"></param>
/// <param name="_pathTo"></param>
/// <param name="_nomeFile"></param>
/// <returns></returns>
public bool muoviFile(string _pathFrom, string _pathTo, string _nomeFile)