0
我需要每2小時啓動一次網頁,無需點擊按鈕,每次關閉舊網頁以打開新網頁。 此html頁面:啓動按鈕每2小時不點擊
@using (Html.BeginForm("Import", "Monitoring", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.Raw(ViewBag.Error)
<br />
<input type="submit" value="Launch" />
}
這是我的導入方法:
string path4 = "D:/Project/TProdPlan.xlsx";
Excel.Application application4 = new Excel.Application();
Excel.Workbook workbook4 = application4.Workbooks.Open(path4);
Excel.Worksheet worksheet4 = workbook4.ActiveSheet;
Excel.Range range4 = worksheet4.UsedRange;
List<TProdPlan> ListTProdPlan = new List<TProdPlan>();
for (int row = 2; row <= range4.Rows.Count; row++)
{
TProdPlan S = new TProdPlan();
S.Num= (((Excel.Range)range4.Cells[row, 1]).Text);
S.stat = (((Excel.Range)range4.Cells[row, 2]).Text);
ListTProdPlan.Add(S);
}
ViewBag.ListTProdPlans = ListTProdPlan;
//close excelsheet after reading data
workbook4.Close(0);
application4.Quit();
return View("Monitoring");
}
這是 「監控視圖」
<div class="carousel-inner" role="listbox">
<div class="item active">
<h1>Total Seasame Tickets Status (From 16/04 To 22/04)</h1>
<table class="table table-striped">
<thead >
<th style="text-align:center">Number</th>
<th style="text-align:center">Status</th>
<th style="text-align:center">Color Code</th>
</thead>
<tbody style="text-align:center">
@foreach (var Ts in ViewBag.ListTsesames)
{
<tr>
<td>@Ts.Number</td>
<td>@Ts.Status</td>
@if (@Ts.Status == "Resolved")
{
<td><img src="~/Web/Resolved.png" /></td>
}
else if (@Ts.Status == "Opened")
{
<td><img src="~/Web/Opened.png" /></td>
}
else if (@Ts.Status == "Assigned")
{
<td><img src="~/Web/Assigned.png" /></td>
}
else if (@Ts.Status == "PendingCustomer")
{
<td><img src="~/Web/PendingCustomer.png" /></td>
}
else if (@Ts.Status == "Closed Complete")
{
<td><img src="~/Web/Closed Complete.png" /></td>
}
</tr>
}
</tbody>
</table>
<br />
<h1>Total is : 115 </h1>
<div class="carousel-caption">
</div>
</div>
我有嘗試,但不起作用 –
發佈您的代碼,你嘗試了,我們將看看它 – Neil
我需要刷新網頁,每隔1小時,我從中提取excel表中的數據我在「監視」視圖中顯示它。 –