修改圖資編輯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,16 +226,22 @@ namespace FrontendWebApi.ApiControllers
return apiResult;
}
Dictionary<string, object> graph_manage = new Dictionary<string, object>();
//edit file
//原設計圖修改
var new_guid = Guid.NewGuid();
//刪除原本檔案
if (gm.oriSavName != null)
{
FolderFunction folderFunction = new FolderFunction();
folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.oriSavName));
}
var fileName = new_guid + "." + gii.oriOrgName.Split('.')[1];
string fileName = null;
if (gii.oriOrgName != null)
{
fileName = new_guid + "." + gii.oriOrgName.Split('.')[1];
var fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
@ -243,76 +249,35 @@ namespace FrontendWebApi.ApiControllers
{
gii.oriFile.CopyTo(stream);
}
}
graph_manage.Add("@oriOrgName", gii.oriOrgName);
graph_manage.Add("@oriSavName", fileName);
fileName = null;
//竣工圖修改
new_guid = Guid.NewGuid();
//刪除原本檔案
folderFunction = new FolderFunction();
if (gm.donSavName != null)
{
var folderFunction = new FolderFunction();
folderFunction.DeleteFile(Path.Combine(graphManageFileSaveAsPath, gm.donSavName));
}
if (gii.donOrgName != null)
{
fileName = new_guid + "." + gii.donOrgName.Split('.')[1];
fullPath = Path.Combine(graphManageFileSaveAsPath, fileName);
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("@donOrgName", gii.donOrgName);
graph_manage.Add("@donSavName", fileName);
//edit file
//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)
// {
// 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))
// {
// 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);

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