diff --git a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs index 9dabe41..02dcaa4 100644 --- a/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs +++ b/EuroTran/EasyBL.WEBAPP/ShowEasy/ONSiteMaintain_UpdService.cs @@ -6,6 +6,7 @@ using SqlSugar; using SqlSugar.Base; using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace EasyBL.WEBAPP.ShowEasy @@ -1449,6 +1450,18 @@ namespace EasyBL.WEBAPP.ShowEasy { PreviewFileModel.FileID = Guid.NewGuid().ToString(); PreviewFileModel.ParentID = ServiceBaseInfoModel.PreviewFile; + var sServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); + var sFromFullPath = sServerPath + PreviewFileModel.FilePath; + if (File.Exists(sFromFullPath)) + { + var sToFullPath = sFromFullPath.Insert(sFromFullPath.LastIndexOf(@"."), @"(1)"); + if (File.Exists(sToFullPath)) + { + sToFullPath = sToFullPath.Insert(sToFullPath.LastIndexOf(@"."), @"(1)"); + } + Common.FnCopyFile(sFromFullPath, sToFullPath); + PreviewFileModel.FilePath = sToFullPath.Replace(sServerPath, ""); + } } if (lstPreviewFile.Count() > 0) @@ -1458,11 +1471,23 @@ namespace EasyBL.WEBAPP.ShowEasy //PreviewFile var lstBannerFile = db.Queryable() - .Where(x => x.OrgID == i_crm.ORIGID && x.ParentID == OldBannerFileGuid).ToList(); + .Where(x => x.OrgID == i_crm.ORIGID && x.ParentID == OldBannerFileGuid).ToList(); foreach (var BannerFileModel in lstBannerFile) { BannerFileModel.FileID = Guid.NewGuid().ToString(); BannerFileModel.ParentID = ServiceBaseInfoModel.BannerFile; + var sServerPath = System.Web.HttpContext.Current.Server.MapPath("/"); + var sFromFullPath = sServerPath + BannerFileModel.FilePath; + if (File.Exists(sFromFullPath)) + { + var sToFullPath = sFromFullPath.Insert(sFromFullPath.LastIndexOf(@"."), @"(1)"); + if (File.Exists(sToFullPath)) + { + sToFullPath = sToFullPath.Insert(sToFullPath.LastIndexOf(@"."), @"(1)"); + } + Common.FnCopyFile(sFromFullPath, sToFullPath); + BannerFileModel.FilePath = sToFullPath.Replace(sServerPath, ""); + } } if (lstBannerFile.Count() > 0)