added multi language support for doculink attachments

This commit is contained in:
Vijay Uppu 2023-11-30 20:00:09 -05:00
parent 4885311290
commit 48af2f3623
7 changed files with 68 additions and 85 deletions

View File

@ -34,6 +34,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
docName = "", docName = "",
Path = "www.google.com", Path = "www.google.com",
IsAttachments = false, IsAttachments = false,
Language = "en",
CustomOrder = 1 CustomOrder = 1
}); });
list.Add(new DocuLinks.Models.ResDoculink() list.Add(new DocuLinks.Models.ResDoculink()
@ -140,6 +141,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
docName = "", docName = "",
Path = "www.google.com", Path = "www.google.com",
IsAttachments = false, IsAttachments = false,
Language = "en",
CustomOrder = 1 CustomOrder = 1
}); });
return new Models.Doculink return new Models.Doculink
@ -167,6 +169,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
docName = "", docName = "",
Path = "www.google.com", Path = "www.google.com",
IsAttachments = false, IsAttachments = false,
Language="en",
CustomOrder = 1 CustomOrder = 1
}); });
List<DocuLinks.Models.Doculink> DocuLinks = new List<Models.Doculink>(); List<DocuLinks.Models.Doculink> DocuLinks = new List<Models.Doculink>();

View File

@ -15,5 +15,6 @@ namespace DamageAssesment.Api.DocuLinks.Db
public string Path { get; set; } public string Path { get; set; }
public bool IsAttachments { get; set; } public bool IsAttachments { get; set; }
public int CustomOrder { get; set; } public int CustomOrder { get; set; }
public string Language { get; set; }
} }
} }

View File

@ -8,6 +8,7 @@ namespace DamageAssesment.Api.DocuLinks.Models
public string docName { get; set; } public string docName { get; set; }
public string Path { get; set; } public string Path { get; set; }
public bool IsAttachments { get; set; } public bool IsAttachments { get; set; }
public string Language { get; set; }
public int CustomOrder { get; set; } public int CustomOrder { get; set; }
} }
} }

View File

@ -17,6 +17,7 @@ namespace DamageAssesment.Api.DocuLinks.Models
public string? FileExtension { get; set; } public string? FileExtension { get; set; }
public int CustomOrder { get; set; } public int CustomOrder { get; set; }
public string url { get;set; } public string url { get;set; }
public string Language { get; set; }
public bool IsAttachments { get; set; } public bool IsAttachments { get; set; }
} }
} }

View File

@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace DamageAssesment.Api.DocuLinks.Providers namespace DamageAssesment.Api.DocuLinks.Providers
{ {
public class AzureBlobService: IAzureBlobService public class AzureBlobService : IAzureBlobService
{ {
BlobServiceClient _blobClient; BlobServiceClient _blobClient;
BlobContainerClient _containerClient; BlobContainerClient _containerClient;
@ -32,7 +32,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
public async Task<Models.Doculink> UploadDocument(int counter, ReqDoculink documentInfo) public async Task<Models.Doculink> UploadDocument(int counter, ReqDoculink documentInfo)
{ {
Models.Doculink Documents = new Models.Doculink(); Models.Doculink Documents = new Models.Doculink();
List <Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>(); List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
try try
{ {
string path = "", UserfileName = ""; string path = "", UserfileName = "";
@ -55,7 +55,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
} }
else else
path = item.url; path = item.url;
attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder }); attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
} }
} }
Documents = new Models.Doculink() Documents = new Models.Doculink()
@ -84,7 +84,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
{ {
foreach (var item in document.doclinksAttachments) foreach (var item in document.doclinksAttachments)
{ {
Movefile(item.Path); Movefile(item.Path);
} }
string path = "", UserfileName = ""; string path = "", UserfileName = "";
List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>(); List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
@ -104,7 +104,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
} }
else else
path = item.url; path = item.url;
attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder }); attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
} }
Models.Doculink Documents = new Models.Doculink() Models.Doculink Documents = new Models.Doculink()
{ {
@ -148,7 +148,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
{ {
var list = movefilename.Split('.'); var list = movefilename.Split('.');
if (list.Length > 0) if (list.Length > 0)
list[list.Length - 1] = DateTime.Now.ToShortDateString().Replace("/", "_") +"_"+ DateTime.Now.ToShortTimeString().Replace("/", "_")+"." + list[list.Length - 1]; list[list.Length - 1] = DateTime.Now.ToShortDateString().Replace("/", "_") + "_" + DateTime.Now.ToShortTimeString().Replace("/", "_") + "." + list[list.Length - 1];
return string.Join("_", list); return string.Join("_", list);
} }
public void Movefile(string path) public void Movefile(string path)
@ -162,28 +162,28 @@ namespace DamageAssesment.Api.DocuLinks.Providers
BlobClient sourceBlobClient = _containerClient.GetBlobClient(path); BlobClient sourceBlobClient = _containerClient.GetBlobClient(path);
BlobClient destinationBlobClient = _containerClient.GetBlobClient(MovePath); BlobClient destinationBlobClient = _containerClient.GetBlobClient(MovePath);
// Start the copy operation from the source to the destination // Start the copy operation from the source to the destination
destinationBlobClient.StartCopyFromUri(sourceBlobClient.Uri); destinationBlobClient.StartCopyFromUri(sourceBlobClient.Uri);
// Check if the copy operation completed successfully // Check if the copy operation completed successfully
WaitForCopyToComplete(destinationBlobClient); WaitForCopyToComplete(destinationBlobClient);
// Delete the source blob after a successful copy // Delete the source blob after a successful copy
sourceBlobClient.DeleteIfExists(); sourceBlobClient.DeleteIfExists();
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
} }
} }
static void WaitForCopyToComplete(BlobClient blobClient) static void WaitForCopyToComplete(BlobClient blobClient)
{ {
BlobProperties properties = blobClient.GetProperties(); BlobProperties properties = blobClient.GetProperties();
while (properties.CopyStatus == CopyStatus.Pending) while (properties.CopyStatus == CopyStatus.Pending)
{ {
Task.Delay(TimeSpan.FromSeconds(1)); Task.Delay(TimeSpan.FromSeconds(1));
properties = blobClient.GetProperties(); properties = blobClient.GetProperties();
} }
} }
public void DeleteFile(string url) public void DeleteFile(string url)

View File

@ -6,10 +6,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System; using System;
using System.Collections.Immutable;
using System.Diagnostics.Eventing.Reader; using System.Diagnostics.Eventing.Reader;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
namespace DamageAssesment.Api.DocuLinks.Providers namespace DamageAssesment.Api.DocuLinks.Providers
@ -67,20 +65,13 @@ namespace DamageAssesment.Api.DocuLinks.Providers
int counter = 0; int counter = 0;
for (int i = 1; i <= 4; i++) for (int i = 1; i <= 4; i++)
{ {
int linkTypeId = 2; FileModel fileModel = new FileModel() { url = "www.google" + i + ".com", IsAttachments = false, CustomOrder = 1 };
FileModel fileModel = new FileModel();
if (i < 3)
{
linkTypeId = 1;
fileModel = new FileModel() { FileName = "Sample" + i, FileExtension = ".txt", FileContent = "c2FtcGxl", IsAttachments = true, CustomOrder = 1 };
}
else
fileModel = new FileModel() { url = "www.google" + i + ".com", IsAttachments = false, CustomOrder = 1 };
ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = i, CustomOrder = i, Files = new List<FileModel>() { fileModel } }; ReqDoculink documentInfo = new ReqDoculink() { linkTypeId = i, CustomOrder = i, Files = new List<FileModel>() { fileModel } };
Db.DoculinkTranslation documents = new Db.DoculinkTranslation { DocumentId = i, title = "Test" + i, description = "ss" + i, Language = "en" };
Models.Doculink document = await azureBlobService.UploadDocument(counter, documentInfo); Models.Doculink document = await azureBlobService.UploadDocument(counter, documentInfo);
DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document)); DocumentDbContext.Documents.Add(mapper.Map<Models.Doculink, Db.Doculink>(document));
DocumentDbContext.SaveChanges(); DocumentDbContext.SaveChanges();
DocumentDbContext.DocumentsTranslations.AddRange(documents);
var dbattachments = mapper.Map<List<Models.DoculinkAttachments>, List<Db.DoculinkAttachments>>(document.doclinksAttachments); var dbattachments = mapper.Map<List<Models.DoculinkAttachments>, List<Db.DoculinkAttachments>>(document.doclinksAttachments);
dbattachments.ForEach(a => a.DocumentId = i); dbattachments.ForEach(a => a.DocumentId = i);
DocumentDbContext.DoclinksAttachments.AddRange(dbattachments); DocumentDbContext.DoclinksAttachments.AddRange(dbattachments);
@ -88,34 +79,6 @@ namespace DamageAssesment.Api.DocuLinks.Providers
counter++; counter++;
} }
} }
if (!DocumentDbContext.DocumentsTranslations.Any())
{
string[] titles = {
"Mobile App Damage Assessment Instructions",
"PC Damage Assessment Instructions",
"Emergency Evacuation centers",
"Mobile App Damage Assessment Instructions" };
string[] esTranslations = {
"Instrucciones de Evaluación de Daños de la Aplicación Móvil",
"Instrucciones de Evaluación de Daños del PC",
"Centros de Evacuación de Emergencia",
"Instrucciones de Evaluación de Daños de la Aplicación Móvil" };
string[] frTranslations = {
"Instructions d'Évaluation des Dommages de l'Application Mobile",
"Instructions d'Évaluation des Dommages du PC",
"Centres d'Évacuation d'Urgence",
"Instructions d'Évaluation des Dommages de l'Application Mobile" };
List<Db.DoculinkTranslation> documents = new List<Db.DoculinkTranslation>();
for (int i = 0; i < 4; i++)
{
documents.Add(new Db.DoculinkTranslation { DocumentId = i + 1, title = titles[i], description = titles[i], Language = "en" });
documents.Add(new Db.DoculinkTranslation { DocumentId = i + 1, title = esTranslations[i], description = esTranslations[i], Language = "es" });
documents.Add(new Db.DoculinkTranslation { DocumentId = i + 1, title = frTranslations[i], description = frTranslations[i], Language = "fr" });
}
DocumentDbContext.DocumentsTranslations.AddRange(documents);
DocumentDbContext.SaveChanges();
}
} }
public List<Models.DoculinkTranslation> GetDocumentTranslations(int id, string? language) public List<Models.DoculinkTranslation> GetDocumentTranslations(int id, string? language)
{ {
@ -172,7 +135,19 @@ namespace DamageAssesment.Api.DocuLinks.Providers
MultiLanguage = dicttitle; MultiLanguage = dicttitle;
return MultiLanguage; return MultiLanguage;
} }
private List<Models.DoculinkAttachments> GetDocumentAttachment(int id, string? language)
{
if (string.IsNullOrEmpty(language))
{
return mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
}
else
{
return mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id && a.Language == language).ToList());
}
}
public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive) public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive)
{ {
@ -180,7 +155,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
{ {
logger?.LogInformation("Query Question"); logger?.LogInformation("Query Question");
var documents = new List<Db.Doculink>(); var documents = new List<Db.Doculink>();
if (linkTypeId==null) if (linkTypeId == null)
documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value)).ToListAsync(); documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value)).ToListAsync();
else else
documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value) && documents = await DocumentDbContext.Documents.AsNoTracking().Where(q => (isactive == null || q.IsActive == isactive.Value) &&
@ -194,10 +169,9 @@ namespace DamageAssesment.Api.DocuLinks.Providers
item.titles = multilan.titles; item.titles = multilan.titles;
item.description = multilan.description; item.description = multilan.description;
item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language)); item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language));
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>( item.doclinksAttachments = GetDocumentAttachment(item.Id, language);
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
} }
// List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList(); // List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, result, null); return (true, result, null);
} }
return (false, null, "Not found"); return (false, null, "Not found");
@ -230,10 +204,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
item.titles = multilan.titles; item.titles = multilan.titles;
item.description = multilan.description; item.description = multilan.description;
item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language)); item.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(item.linkTypeId, language));
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>( item.doclinksAttachments = GetDocumentAttachment(item.Id, language);
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
} }
//List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, result, null); return (true, result, null);
} }
return (false, null, "Not found"); return (false, null, "Not found");
@ -286,8 +258,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
result.documentsTranslations = mapper.Map<List<Db.DoculinkTranslation>, List<Models.DoculinkTranslation>>( result.documentsTranslations = mapper.Map<List<Db.DoculinkTranslation>, List<Models.DoculinkTranslation>>(
DocumentDbContext.DocumentsTranslations.Where(a => a.DocumentId == result.Id).ToList()); DocumentDbContext.DocumentsTranslations.Where(a => a.DocumentId == result.Id).ToList());
result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>( result.doclinksAttachments = GetDocumentAttachment(id, "");
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
return (true, result, null); return (true, result, null);
} }
return (false, null, "Not found"); return (false, null, "Not found");
@ -319,8 +290,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, language)); result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, language));
result.titles = multilan.titles; result.titles = multilan.titles;
result.description = multilan.description; result.description = multilan.description;
result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>( result.doclinksAttachments = GetDocumentAttachment(id, language);
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
return (true, result, null); return (true, result, null);
} }
return (false, null, "Not found"); return (false, null, "Not found");
@ -431,8 +401,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
result.titles = multilan.titles; result.titles = multilan.titles;
result.description = multilan.description; result.description = multilan.description;
result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, "")); result.linktypes = CreateMultiLanguageLinkTypeObject(GetLinkTypeTranslations(result.linkTypeId, ""));
result.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>( result.doclinksAttachments = GetDocumentAttachment(id, "");
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == id).ToList());
Document.IsActive = false; Document.IsActive = false;
DocumentDbContext.Documents.Update(Document); DocumentDbContext.Documents.Update(Document);
DocumentDbContext.SaveChanges(); DocumentDbContext.SaveChanges();
@ -450,7 +419,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
{ {
try try
{ {
int AttachmentId = DocumentDbContext.DoclinksAttachments.Max(a => a.Id); int AttachmentId = DocumentDbContext.Documents.Max(a => a.Id);
return (true, AttachmentId, ""); return (true, AttachmentId, "");
} }
catch (Exception ex) catch (Exception ex)

View File

@ -30,9 +30,9 @@ namespace DamageAssesment.Api.DocuLinks.Providers
{ {
Models.Doculink Documents = new Models.Doculink(); Models.Doculink Documents = new Models.Doculink();
List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>(); List<Models.DoculinkAttachments> attachments = new List<Models.DoculinkAttachments>();
try try
{ {
string path = "", UserfileName=""; string path = "", UserfileName = "";
var fullDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), uploadpath); var fullDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), uploadpath);
if (!Directory.Exists(fullDirectoryPath)) //Create deirectory if does not exist if (!Directory.Exists(fullDirectoryPath)) //Create deirectory if does not exist
Directory.CreateDirectory(fullDirectoryPath); Directory.CreateDirectory(fullDirectoryPath);
@ -51,20 +51,27 @@ namespace DamageAssesment.Api.DocuLinks.Providers
} }
else else
path = item.url; path = item.url;
attachments.Add(new Models.DoculinkAttachments { docName=UserfileName,Path=path,IsAttachments=item.IsAttachments,CustomOrder=item.CustomOrder }); attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
} }
} }
Documents=new Models.Doculink (){ linkTypeId = documentInfo.linkTypeId, Documents = new Models.Doculink()
documentsTranslations = documentInfo.documentsTranslations,doclinksAttachments=attachments, {
IsDeleted=false,CustomOrder=documentInfo.CustomOrder, IsActive =true}; linkTypeId = documentInfo.linkTypeId,
documentsTranslations = documentInfo.documentsTranslations,
doclinksAttachments = attachments,
IsDeleted = false,
CustomOrder = documentInfo.CustomOrder,
IsActive = true
};
return Documents; return Documents;
} }
catch (Exception ex) { catch (Exception ex)
{
return new Models.Doculink(); return new Models.Doculink();
} }
} }
public Models.Doculink UpdateDocuments(int counter, Models.Doculink document, ReqDoculink documentInfo) public Models.Doculink UpdateDocuments(int counter, Models.Doculink document, ReqDoculink documentInfo)
{ {
@ -93,15 +100,15 @@ namespace DamageAssesment.Api.DocuLinks.Providers
} }
else else
path = item.url; path = item.url;
attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path,IsAttachments=item.IsAttachments,CustomOrder=item.CustomOrder }); attachments.Add(new Models.DoculinkAttachments { docName = UserfileName, Path = path, IsAttachments = item.IsAttachments, CustomOrder = item.CustomOrder, Language = item.Language });
} }
Models.Doculink Documents = new Models.Doculink() Models.Doculink Documents = new Models.Doculink()
{ {
Id = documentInfo.Id, Id = documentInfo.Id,
linkTypeId = documentInfo.linkTypeId, linkTypeId = documentInfo.linkTypeId,
documentsTranslations=documentInfo.documentsTranslations, documentsTranslations = documentInfo.documentsTranslations,
IsActive = true, IsActive = true,
IsDeleted=false, IsDeleted = false,
CustomOrder = documentInfo.CustomOrder, CustomOrder = documentInfo.CustomOrder,
doclinksAttachments = attachments doclinksAttachments = attachments
}; };
@ -109,7 +116,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
return Documents; return Documents;
} }
catch (Exception ex) { catch (Exception ex)
{
return new Models.Doculink(); return new Models.Doculink();
} }
} }
@ -118,7 +126,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
if (path != "") if (path != "")
{ {
FileInfo file = new FileInfo(path); FileInfo file = new FileInfo(path);
if (file?.Exists??false)//check file exsit or not if (file?.Exists ?? false)//check file exsit or not
{ {
file.Delete(); file.Delete();
} }
@ -134,8 +142,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
FileInfo file = new FileInfo(path); FileInfo file = new FileInfo(path);
if (file?.Exists ?? false)//check file exsit or not if (file?.Exists ?? false)//check file exsit or not
{ {
string filename = file.Name.Replace(file.Extension, " ") + DateTime.Now.ToShortDateString().Replace("/","_") + file.Extension; string filename = file.Name.Replace(file.Extension, " ") + DateTime.Now.ToShortDateString().Replace("/", "_") + file.Extension;
file.MoveTo(pathToSave+"\\"+ filename); file.MoveTo(pathToSave + "\\" + filename);
} }
} }
} }