diff --git a/FrontendWebApi/ApiControllers/GraphManageController.cs b/FrontendWebApi/ApiControllers/GraphManageController.cs index 4616afd..7d93b4b 100644 --- a/FrontendWebApi/ApiControllers/GraphManageController.cs +++ b/FrontendWebApi/ApiControllers/GraphManageController.cs @@ -226,93 +226,58 @@ namespace FrontendWebApi.ApiControllers return apiResult; } - Dictionary graph_manage = new Dictionary(); + //edit file + //原設計圖修改 var new_guid = Guid.NewGuid(); - //刪除原本檔案 - FolderFunction folderFunction = new FolderFunction(); - folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName)); - - var fileName = new_guid + "." + gii.oriOrgName.Split('.')[1]; - - var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); - - using (var stream = new FileStream(fullPath, FileMode.Create)) + if (gm.oriSavName != null) { - gii.oriFile.CopyTo(stream); + FolderFunction folderFunction = new FolderFunction(); + folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName)); } + string fileName = null; + if (gii.oriOrgName != null) + { + fileName = new_guid + "." + gii.oriOrgName.Split('.')[1]; + + var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); + + using (var stream = new FileStream(fullPath, FileMode.Create)) + { + gii.oriFile.CopyTo(stream); + } + } graph_manage.Add("@oriOrgName", gii.oriOrgName); graph_manage.Add("@oriSavName", fileName); + fileName = null; + //竣工圖修改 new_guid = Guid.NewGuid(); - //刪除原本檔案 - folderFunction = new FolderFunction(); - folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName)); - - fileName = new_guid + "." + gii.donOrgName.Split('.')[1]; - - fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); - - using (var stream = new FileStream(fullPath, FileMode.Create)) + if (gm.donSavName != null) { - gii.donFile.CopyTo(stream); + var folderFunction = new FolderFunction(); + folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName)); } - graph_manage.Add("@oriOrgName", gii.donOrgName); - graph_manage.Add("@oriSavName", fileName); + if (gii.donOrgName != null) + { + fileName = new_guid + "." + gii.donOrgName.Split('.')[1]; - //edit file - //if (gii.oriOrgName != null || gii.donOrgName != null) - //{ - // if (!System.IO.Directory.Exists(graphManageFileSaveAsPath)) - // System.IO.Directory.CreateDirectory(graphManageFileSaveAsPath); + var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); - // if (gm.oriSavName != null && gii.oriOrgName != null) - // { - // var new_guid = Guid.NewGuid(); + using (var stream = new FileStream(fullPath, FileMode.Create)) + { + gii.donFile.CopyTo(stream); + } - // //刪除原本檔案 - // FolderFunction folderFunction = new FolderFunction(); - // folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName)); + } + graph_manage.Add("@donOrgName", gii.donOrgName); + graph_manage.Add("@donSavName", fileName); - // var fileName = new_guid + "." + gii.oriOrgName.Split('.')[1]; - - // var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); - - // using (var stream = new FileStream(fullPath, FileMode.Create)) - // { - // gii.oriFile.CopyTo(stream); - // } - - // graph_manage.Add("@oriOrgName", gii.oriOrgName); - // graph_manage.Add("@oriSavName", fileName); - // } - - // if (gm.donSavName != null && gii.donOrgName != null) - // { - // var new_guid = Guid.NewGuid(); - - // //刪除原本檔案 - // FolderFunction folderFunction = new FolderFunction(); - // folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName)); - - // var fileName = new_guid + "." + gii.donOrgName.Split('.')[1]; - - // var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName); - - // using (var stream = new FileStream(fullPath, FileMode.Create)) - // { - // gii.donFile.CopyTo(stream); - // } - - // graph_manage.Add("@oriOrgName", gii.donOrgName); - // graph_manage.Add("@oriSavName", fileName); - // } - //} graph_manage.Add("@code", gii.code); graph_manage.Add("@name", gii.name); graph_manage.Add("@main_system_tag", gii.main_system_tag); diff --git a/FrontendWebApi/wwwroot/upload/graph_manage/5f5ae752-823a-4c66-8679-e7c25859ea7a.PNG b/FrontendWebApi/wwwroot/upload/graph_manage/5f5ae752-823a-4c66-8679-e7c25859ea7a.PNG new file mode 100644 index 0000000..93c4851 Binary files /dev/null and b/FrontendWebApi/wwwroot/upload/graph_manage/5f5ae752-823a-4c66-8679-e7c25859ea7a.PNG differ diff --git a/FrontendWebApi/wwwroot/upload/graph_manage/9709a746-063c-4fe1-8827-9cce23bdeb5d.png b/FrontendWebApi/wwwroot/upload/graph_manage/9709a746-063c-4fe1-8827-9cce23bdeb5d.png deleted file mode 100644 index 1616986..0000000 Binary files a/FrontendWebApi/wwwroot/upload/graph_manage/9709a746-063c-4fe1-8827-9cce23bdeb5d.png and /dev/null differ diff --git a/FrontendWebApi/wwwroot/upload/graph_manage/b705e2ca-9a76-4eb4-adb2-46fd49fd9dcb.PNG b/FrontendWebApi/wwwroot/upload/graph_manage/b705e2ca-9a76-4eb4-adb2-46fd49fd9dcb.PNG new file mode 100644 index 0000000..e69de29 diff --git a/FrontendWebApi/wwwroot/upload/graph_manage/de08e7ee-9839-4403-90e5-754dec4e389b.jpg b/FrontendWebApi/wwwroot/upload/graph_manage/de08e7ee-9839-4403-90e5-754dec4e389b.jpg new file mode 100644 index 0000000..c002f98 Binary files /dev/null and b/FrontendWebApi/wwwroot/upload/graph_manage/de08e7ee-9839-4403-90e5-754dec4e389b.jpg differ