修改圖資編輯api

This commit is contained in:
dev02 2022-11-10 09:32:06 +08:00
parent d522e4e801
commit d4d0c4d7b2
5 changed files with 33 additions and 68 deletions

View File

@ -226,93 +226,58 @@ namespace FrontendWebApi.ApiControllers
return apiResult; return apiResult;
} }
Dictionary<string, object> graph_manage = new Dictionary<string, object>(); Dictionary<string, object> graph_manage = new Dictionary<string, object>();
//edit file
//原設計圖修改
var new_guid = Guid.NewGuid(); var new_guid = Guid.NewGuid();
//刪除原本檔案 //刪除原本檔案
FolderFunction folderFunction = new FolderFunction(); if (gm.oriSavName != null)
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))
{ {
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("@oriOrgName", gii.oriOrgName);
graph_manage.Add("@oriSavName", fileName); graph_manage.Add("@oriSavName", fileName);
fileName = null;
//竣工圖修改
new_guid = Guid.NewGuid(); new_guid = Guid.NewGuid();
//刪除原本檔案 //刪除原本檔案
folderFunction = new FolderFunction(); if (gm.donSavName != null)
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))
{ {
gii.donFile.CopyTo(stream); var folderFunction = new FolderFunction();
folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName));
} }
graph_manage.Add("@oriOrgName", gii.donOrgName); if (gii.donOrgName != null)
graph_manage.Add("@oriSavName", fileName); {
fileName = new_guid + "." + gii.donOrgName.Split('.')[1];
//edit file var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
//if (gii.oriOrgName != null || gii.donOrgName != null)
//{
// if (!System.IO.Directory.Exists(graphManageFileSaveAsPath))
// System.IO.Directory.CreateDirectory(graphManageFileSaveAsPath);
// if (gm.oriSavName != null && gii.oriOrgName != null) using (var stream = new FileStream(fullPath, FileMode.Create))
// { {
// var new_guid = Guid.NewGuid(); gii.donFile.CopyTo(stream);
}
// //刪除原本檔案 }
// FolderFunction folderFunction = new FolderFunction(); graph_manage.Add("@donOrgName", gii.donOrgName);
// folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName)); 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("@code", gii.code);
graph_manage.Add("@name", gii.name); graph_manage.Add("@name", gii.name);
graph_manage.Add("@main_system_tag", gii.main_system_tag); graph_manage.Add("@main_system_tag", gii.main_system_tag);

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB