diff --git a/Backend/Controllers/LoginController.cs b/Backend/Controllers/LoginController.cs index 3dc1d62..d1a72a8 100644 --- a/Backend/Controllers/LoginController.cs +++ b/Backend/Controllers/LoginController.cs @@ -2,7 +2,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using Repository.BackendRepository.Implement; using Repository.BackendRepository.Interface; +using Serilog.Core; using System; using System.Collections.Generic; using System.Linq; @@ -14,16 +16,18 @@ namespace Backend.Controllers { private readonly ILogger logger; private readonly IUserInfoRepository userInfoRepository; + private readonly IBackendRepository backendRepository; - public LoginController(ILogger logger, - IUserInfoRepository userInfoRepository) + public LoginController(ILogger logger, IUserInfoRepository userInfoRepository, IBackendRepository backendRepository) { this.logger = logger; this.userInfoRepository = userInfoRepository; + this.backendRepository = backendRepository; } public IActionResult Index() { + ViewBag.ProjectName = backendRepository.GetOneAsync("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result; return View(); } @@ -92,6 +96,7 @@ namespace Backend.Controllers /// public IActionResult ForgotPassword() { + ViewBag.ProjectName = backendRepository.GetOneAsync("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result; return View("~/Views/Login/ForgotPassword.cshtml"); } @@ -147,5 +152,33 @@ namespace Backend.Controllers return RedirectToAction("Index", "Login"); } + + /// + /// 獲取專案名稱(東別) + /// + /// + [HttpPost] + [Route("Variable/ProjectName")] + public async Task> ProjectName() + { + ApiResult apiResult = new ApiResult(); + + try + { + var variable = await backendRepository.GetOneAsync("select * from variable where deleted = 0 and system_type = 'project_name';"); + + apiResult.Data = variable; + apiResult.Code = "0000"; + apiResult.Msg = "成功"; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + logger.LogError("【LogginController/ProjectName】" + exception.Message); + } + + return apiResult; + } } } diff --git a/Backend/Controllers/MybaseController.cs b/Backend/Controllers/MybaseController.cs index f75c4e0..1aa2cdd 100644 --- a/Backend/Controllers/MybaseController.cs +++ b/Backend/Controllers/MybaseController.cs @@ -76,6 +76,7 @@ namespace Backend.Controllers ViewBag.myUserInfo = myUserInfo; ViewBag.role = showview.Result; + ViewBag.ProjectName = backendRepository.GetOneAsync("select system_key from variable where deleted = 0 and system_type = 'project_name';").Result; #region 記錄人員操作記錄 var content = JsonConvert.SerializeObject(filterContext.ActionArguments); var parameter = content.CompareTo("{}") == 0 ? null : content; diff --git a/Backend/Controllers/VariableController.cs b/Backend/Controllers/VariableController.cs index 7943488..39eccc0 100644 --- a/Backend/Controllers/VariableController.cs +++ b/Backend/Controllers/VariableController.cs @@ -242,31 +242,6 @@ namespace Backend.Controllers return apiResult; } - /// - /// 獲取專案名稱(東別) - /// - /// - [HttpPost] - public async Task> ProjectName() - { - ApiResult apiResult = new ApiResult(); - - try - { - var variable = await backendRepository.GetOneAsync("select * from variable where deleted = 0 and system_type = 'project_name';"); - - apiResult.Data = variable; - apiResult.Code = "0000"; - apiResult.Msg = "成功"; - } - catch (Exception exception) - { - apiResult.Code = "9999"; - apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; - Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); - } - - return apiResult; - } + } } diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index 83a741d..17d6d47 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -179,7 +179,7 @@ namespace Backend.Services.Implement string[] s2 = s1[0].Split('/'); var displayName = s1[1].Split('=')[1]; - row.name = s1[0].Replace('/', '_').Remove(s1[0].Length - 1, 1).Remove(0, 1); + row.name = s1[0].Remove(s1[0].Length - 1, 1).Remove(0, 1); row.displayName = displayName; row.isHistory = false; @@ -275,30 +275,30 @@ namespace Backend.Services.Implement var newConPoint = conPoint.Where(x => !x.isHistory).ToArray(); foreach(var n in newConPoint) { - if (n.name.Split('_').Length == 9) + if (n.name.Split('/').Length == 9) { result.Add(new ImpNiaItem { - device_area_tag = n.name.Split('_')[0], - device_building_tag = n.name.Split('_')[1], - device_system_tag = n.name.Split('_')[2], - device_name_tag = n.name.Split('_')[3], - device_point_name = n.name.Split('_')[8], + device_area_tag = n.name.Split('/')[0], + device_building_tag = n.name.Split('/')[1], + device_system_tag = n.name.Split('/')[2], + device_name_tag = n.name.Split('/')[3], + device_point_name = n.name.Split('/')[8], full_name = n.displayName, parent_path = oneStationName, isHistory = n.isHistory }); } - else if (n.name.Split('_').Length == 11) //Arena_D2_CWB_L110_CAP_D2_CWB_L110_CAP_MET1_ER + else if (n.name.Split('/').Length == 11) //Arena_D2_CWB_L110_CAP_D2_CWB_L110_CAP_MET1_ER { - if (n.name.Split('_')[6] == "S" || n.name.Split('_')[6] == "CWB") //for security system and CWB system + if (n.name.Split('/')[6] == "S" || n.name.Split('/')[6] == "CWB") //for security system and CWB system { result.Add(new ImpNiaItem { - device_building_tag = n.name.Split('_')[5], - device_system_tag = n.name.Split('_')[6], - device_floor_tag = n.name.Split('_')[7], - device_name_tag = n.name.Split('_')[8], - device_point_name = n.name.Split('_')[10], + device_building_tag = n.name.Split('/')[5], + device_system_tag = n.name.Split('/')[6], + device_floor_tag = n.name.Split('/')[7], + device_name_tag = n.name.Split('/')[8], + device_point_name = n.name.Split('/')[10], full_name = n.displayName, parent_path = oneStationName, isHistory = n.isHistory @@ -308,11 +308,11 @@ namespace Backend.Services.Implement { result.Add(new ImpNiaItem { - device_building_tag = n.name.Split('_')[5], - //device_system_tag = n.name.Split('_')[1], - device_floor_tag = n.name.Split('_')[7], - device_name_tag = n.name.Split('_')[6], - device_point_name = n.name.Split('_')[10], + device_building_tag = n.name.Split('/')[5], + //device_system_tag = n.name.Split('/')[1], + device_floor_tag = n.name.Split('/')[7], + device_name_tag = n.name.Split('/')[6], + device_point_name = n.name.Split('/')[10], full_name = n.displayName, parent_path = oneStationName, isHistory = n.isHistory diff --git a/Backend/Views/Login/ForgotPassword.cshtml b/Backend/Views/Login/ForgotPassword.cshtml index f949888..b456cdb 100644 --- a/Backend/Views/Login/ForgotPassword.cshtml +++ b/Backend/Views/Login/ForgotPassword.cshtml @@ -7,7 +7,7 @@ - 忘記密碼 | IBMS後台管理系統 + 忘記密碼 | @ViewData["ProjectName"]後台管理系統 @@ -29,7 +29,7 @@
diff --git a/Backend/Views/Login/Index.cshtml b/Backend/Views/Login/Index.cshtml index 188b3ee..aa43f1f 100644 --- a/Backend/Views/Login/Index.cshtml +++ b/Backend/Views/Login/Index.cshtml @@ -7,7 +7,7 @@ - 登入 | IBMS後台管理系統 + 登入 | @ViewData["ProjectName"]後台管理系統 @@ -31,7 +31,7 @@
diff --git a/Backend/Views/Shared/_Layout.cshtml b/Backend/Views/Shared/_Layout.cshtml index 3092ef9..c5d27af 100644 --- a/Backend/Views/Shared/_Layout.cshtml +++ b/Backend/Views/Shared/_Layout.cshtml @@ -4,7 +4,7 @@ - @ViewData["Title"] - IBMS後台管理系統 + @ViewData["Title"] - @ViewData["ProjectName"]後台管理系統 @@ -353,7 +353,7 @@
--> -

IBMS後台管理系統

+

@ViewData["ProjectName"]後台管理系統

@@ -998,3 +998,5 @@ @RenderSection("Scripts", required: false) +