demo20230512/Areas/admin/Views/ParameterDatabase/Import.cshtml
2023-05-12 10:20:28 +08:00

106 lines
4.3 KiB
Plaintext

@using Resources
@{ ViewBag.Title = Resource.StaticLabelSimaproParameter;
Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
var History = ViewBag.History as List<Weee.Models.Paramemter.SimaproVersion>;
var counts = ViewBag.ParameterCounts as List<int>;
var relatedCount = ViewBag.relatedCount as List<int>; }
<div class="col-md-12">
<h2>@Resource.StaticLabelImport</h2>
<hr />
<div class="col-md-12">
@using (Html.BeginForm("Upload", "ParameterDatabase", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="form-group">
<input type="file" name="uploadedFile" style="float: left;" />
<span>
<label>@Resource.VersionDecsription</label>
<input type="text" name="version" maxlength="30" style="width: 300px;" value="@ViewBag.version" />
</span>
<span>
<label>@Resource.RAIntlTravelScalarSource</label>
<input type="text" name="parasource" maxlength="30" style="width: 300px;" />
</span>
</div>
<div class="form-group">
<label>@Resource.StaticLabelGlobal_Description</label>
<div>
<textarea name="description" class="form-control"></textarea>
</div>
</div>
<div class="form-group text-right">
<input type="submit" value="@Resource.StaticLabelImport" class="btn btn-default" />
</div>}
@if (!string.IsNullOrWhiteSpace(ViewBag.successMsg))
{
<div class="alert alert-success">
@ViewBag.successMsg
</div>}
@if (!string.IsNullOrWhiteSpace(ViewBag.errorMsg))
{
<div class="alert alert-danger">
@ViewBag.errorMsg
</div>}
<h2>@Resource.Log</h2>
<hr />
<div>
<table class="table table-bordered text-center">
<tr>
<th>@Resource.ImportDateTime</th>
<th>@Resource.VersionDecsription</th>
<th>@Resource.StaticLabelGlobal_Description</th>
<th>@Resource.NumberOfCoefficients</th>
<th>@Resource.RAIntlTravelScalarSource</th>
<th>@Resource.EnabledStatus</th>
<th></th>
</tr>
@for (int i = 0; i < History.Count(); i++)
{
<tr>
<td>@History[i].CreatedDate.ToString("yyyy/MM/dd HH:mm:ss")</td>
<td>@History[i].Version</td>
<td>@History[i].Description</td>
<td>@counts[i]</td>
<td>@History[i].paraSource</td>
<td>@History[i].IsActive</td>
<td>
@Html.ActionLink(History[i].IsActive ? Resource.DeActive : Resource.Active, "ToggleStatus", new { id = History[i].ID }, new { @class = "btn btn-xs btn-default" })
@if (History[i].IsActive)
{
@Html.ActionLink(Resource.StaticLabelGlobal_Delete, "DeleteVersion", new { id = History[i].ID }, new { @class = "btn btn-xs btn-default disabled", data = relatedCount[i], onclick = "deleteItem(this)" })
@Html.ActionLink(Resource.StaticLabelGlobal_Edit, "EditSimaproVersion", new { simaproVersionID = History[i].ID }, new { @class = "btn btn-xs btn-default disabled" }) }
else
{
@Html.ActionLink(Resource.StaticLabelGlobal_Delete, "DeleteVersion", new { id = History[i].ID }, new { @class = "btn btn-xs btn-default", data = relatedCount[i], onclick = "deleteItem(this)" })
@Html.ActionLink(Resource.StaticLabelGlobal_Edit, "EditSimaproVersion", new { simaproVersionID = History[i].ID }, new { @class = "btn btn-xs btn-default" })}
</td>
</tr>}
</table>
</div>
</div>
</div>
<div class="col-md-2"></div>
@section PageScripts {
<script>
function deleteItem (item){
if ($(item).attr("data") != "0") {
if (confirm("有" + $(item).attr("data") + "筆關聯資料會一起被刪除,請確認")) {
return true;
}
else {
event.preventDefault();
return false;
}
}
return true;
}
</script>
}