diff --git a/24Hour/Controllers/Common/LawyerArchivesController.cs b/24Hour/Controllers/Common/LawyerArchivesController.cs index ec23882..746c372 100644 --- a/24Hour/Controllers/Common/LawyerArchivesController.cs +++ b/24Hour/Controllers/Common/LawyerArchivesController.cs @@ -1201,6 +1201,7 @@ namespace _24Hour.Controllers.Common { var svc = await _db.Queryable() .Where(x => x.Id == lawyersvc.Id).FirstAsync(); + var annexphoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "annexs"); var annexs = new DirectoryInfo(annexphoto) .GetFiles() @@ -1208,6 +1209,32 @@ namespace _24Hour.Controllers.Common .Replace(@"\", @"/")) .ToList() .ConvertToJsonStr(); + + + var legalAidPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "legalAidPhoto"); + var legalAidPhotos = new DirectoryInfo(legalAidPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + + var relationshipProofPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "relationshipProofPhoto"); + var relationshipProofPhotos = new DirectoryInfo(relationshipProofPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + + var otherPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "otherPhoto"); + var otherPhotos = new DirectoryInfo(otherPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + if (svc == null) { var lawyer = await _db.Queryable() @@ -1219,6 +1246,9 @@ namespace _24Hour.Controllers.Common lawyersvc.createuserId = lawyer.Id; lawyersvc.annex = annexs; + lawyersvc.legalAidPhoto = legalAidPhotos; + lawyersvc.relationshipProofPhoto = relationshipProofPhotos; + lawyersvc.otherPhoto = otherPhotos; _db.BeginTran(); var num = await _db.Insertable(lawyersvc).ExecuteCommandAsync(); @@ -1235,13 +1265,18 @@ namespace _24Hour.Controllers.Common svc.createuserId = lawyer.Id; svc.annex = annexs; - + svc.legalAidPhoto = legalAidPhotos; + svc.relationshipProofPhoto = relationshipProofPhotos; + svc.otherPhoto = otherPhotos; _db.BeginTran(); var num = await _db.Updateable(svc) .UpdateColumns(x => new { x.annex, - x.createuserId + x.createuserId, + x.relationshipProofPhoto, + x.otherPhoto, + x.legalAidPhoto }) .IgnoreColumns(ignoreAllNullColumns: true) .ExecuteCommandAsync(); @@ -1291,10 +1326,11 @@ namespace _24Hour.Controllers.Common { var lawyerdir = Path.Combine(packegdir, "lawyerservices", item.Id); if (Directory.Exists(lawyerdir) == false) Directory.CreateDirectory(lawyerdir); + + var files = item.annex.ConvertToModel>(); var annecdir = Path.Combine(lawyerdir, "annexs"); if (Directory.Exists(annecdir) == false) Directory.CreateDirectory(annecdir); - foreach (var file in files) { var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); @@ -1304,6 +1340,48 @@ namespace _24Hour.Controllers.Common System.IO.File.Copy(filepath, targetfile); } } + + + var legalphotots = item.legalAidPhoto.ConvertToModel>(); + var legalAidPhotoDir = Path.Combine(lawyerdir, "legalAidPhoto"); + if (Directory.Exists(legalAidPhotoDir) == false) Directory.CreateDirectory(legalAidPhotoDir); + foreach (var legalphotot in legalphotots) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + legalphotot.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + + + var relationshipProofPhotos = item.relationshipProofPhoto.ConvertToModel>(); + var relationshipProofPhotoDir = Path.Combine(lawyerdir, "relationshipProofPhoto"); + if (Directory.Exists(relationshipProofPhotoDir) == false) Directory.CreateDirectory(relationshipProofPhotoDir); + foreach (var relationshipProofPhoto in relationshipProofPhotos) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + relationshipProofPhoto.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + + var otherPhotos = item.otherPhoto.ConvertToModel>(); + var otherPhotoDir = Path.Combine(lawyerdir, "otherPhoto"); + if (Directory.Exists(otherPhotoDir) == false) Directory.CreateDirectory(otherPhotoDir); + foreach (var otherPhoto in otherPhotos) + { + var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + otherPhoto.Replace("/", @"\"); + if (System.IO.File.Exists(filepath)) + { + var targetfile = Path.Combine(legalAidPhotoDir, Path.GetFileName(filepath)); + System.IO.File.Copy(filepath, targetfile); + } + } + } //存储用户的相关附件 foreach (var item in users)