電站選單
This commit is contained in:
parent
2003a37437
commit
d84629575f
@ -97,7 +97,53 @@ namespace SolarPower.Controllers
|
||||
|
||||
|
||||
//取得當前使用者可以查看的電站
|
||||
ViewBag.myPowerStationSummaries = powerStationRepository.GetMyPowerStationSummary(myUser);
|
||||
var myPowerStationSummaries = powerStationRepository.GetMyPowerStationSummary(myUser);
|
||||
ViewBag.myPowerStationSummaries = myPowerStationSummaries;
|
||||
|
||||
if (controllerName == "PowerStation" && actionName == "Edit")
|
||||
{
|
||||
//電站資訊的各電站
|
||||
string stationId_param = filterContext.HttpContext.Request.Query["stationId"];
|
||||
|
||||
int stationId = stationId_param == "new" ? 0 : int.Parse(stationId_param);
|
||||
|
||||
|
||||
if (stationId > 0)
|
||||
{
|
||||
var hasSubTagNum = false;
|
||||
int i = 0;
|
||||
foreach(var myPowerStationSummary in myPowerStationSummaries)
|
||||
{
|
||||
if (hasSubTagNum)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int j = 0;
|
||||
foreach(var myPowerStation in myPowerStationSummary.MyPowerStations)
|
||||
{
|
||||
if(myPowerStation.PowerStationId == stationId)
|
||||
{
|
||||
ViewData["SubNum"] = i;
|
||||
ViewData["TagNum"] = j;
|
||||
hasSubTagNum = true;
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//電站管理的新增電站
|
||||
ViewData["SubNum"] = myPowerStationSummaries.Count();
|
||||
ViewData["TagNum"] = 0;
|
||||
}
|
||||
}else if(controllerName == "PowerStation" && actionName == "Index")
|
||||
{
|
||||
ViewData["SubNum"] = myPowerStationSummaries.Count();
|
||||
ViewData["TagNum"] = 0;
|
||||
}
|
||||
|
||||
ViewBag.auths = auth_arr;
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
@{
|
||||
ViewData["MainNum"] = "2";
|
||||
ViewData["SubNum"] = "1";
|
||||
ViewData["Title"] = "電站管理";
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
@{
|
||||
ViewData["MainNum"] = "2";
|
||||
ViewData["SubNum"] = "1";
|
||||
ViewData["Title"] = "電站管理";
|
||||
}
|
||||
|
||||
|
||||
@ -131,26 +131,31 @@
|
||||
<ul>
|
||||
@foreach (var myPowerStationSummary in ViewBag.myPowerStationSummaries)
|
||||
{
|
||||
<li>
|
||||
<li class="@(ViewData["MainNum"].ToString() == "2" &&
|
||||
ViewData["SubNum"].ToString() == ViewBag.myPowerStationSummaries.IndexOf(myPowerStationSummary).ToString() ? "active open" : "")">
|
||||
<a href="javascript:void(0);" title="Category" data-filter-tags="utilities menu child sublevel item">
|
||||
<span class="nav-link-text" data-i18n="nav.category">@myPowerStationSummary.CityName</span>
|
||||
<span class="dl-ref bg-primary-500 hidden-nav-function-minify hidden-nav-function-top">@myPowerStationSummary.Amount</span>
|
||||
</a>
|
||||
<ul>
|
||||
|
||||
@foreach (var myPowerStation in myPowerStationSummary.MyPowerStations)
|
||||
{
|
||||
<li>
|
||||
<li class="@(ViewData["MainNum"].ToString() == "2" &&
|
||||
ViewData["SubNum"].ToString() == ViewBag.myPowerStationSummaries.IndexOf(myPowerStationSummary).ToString() &&
|
||||
ViewData["TagNum"].ToString() == myPowerStationSummary.MyPowerStations.IndexOf(myPowerStation).ToString() ? "active" : "")">
|
||||
<a asp-controller="PowerStation" asp-action="Edit" asp-route-stationId="@myPowerStation.PowerStationId" title="Sublevel Item" data-filter-tags="utilities menu child sublevel item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_menu_child_sublevel_item">@myPowerStation.PowerStationName</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
<li class="@(ViewData["MainNum"] == "2" && ViewData["SubNum"] == "1" ? "active" : "")">
|
||||
<li class="@(ViewData["MainNum"] == "2" && ViewData["SubNum"].ToString() == ViewBag.myPowerStationSummaries.Count.ToString() ? "active" : "")">
|
||||
<a asp-controller="PowerStation" asp-action="Index" title="電站管理" data-filter-tags="utilities disabled item">
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站管理</span>
|
||||
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站管理 + @ViewData["SubNum"]</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@{
|
||||
ViewData["MainNum"] = "7";
|
||||
ViewData["SubNum"] = "3";
|
||||
ViewData["SubNum"] = "2";
|
||||
ViewData["Title"] = "帳號管理";
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user