update start/stop task from windows service

This commit is contained in:
vfedosevich 2013-05-23 18:18:25 +03:00
parent 8577c73c4c
commit d14b5fc01f
16 changed files with 240 additions and 93 deletions

View file

@ -13,9 +13,8 @@
<asp:TemplateField HeaderText="gvTasksName">
<ItemStyle Width="40%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnkTaskName" runat="server" Visible="false">
<asp:hyperlink id="lnkTaskName" runat="server">
</asp:hyperlink>
<asp:Literal ID="litTaskName" runat="server" Visible="false"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ItemName" HeaderText="gvTasksItemName"></asp:BoundField>
@ -27,16 +26,15 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="gvTasksProgress">
<ItemTemplate>
<asp:Panel ID="pnlProgressBarContainer" runat="server" class="ProgressBarContainer" Visible="false">
<div class="ProgressBarContainer">
<asp:Panel id="pnlProgressIndicator" runat="server" CssClass="ProgressBarIndicator"></asp:Panel>
</asp:Panel>
<asp:Literal ID="litProgressIndicator" runat="server" Visible="false">In Progress</asp:Literal>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvTasksActions">
<ItemTemplate>
<asp:LinkButton ID="cmdStop" runat="server" CommandName="stop"
CausesValidation="false" Text="Stop" OnClientClick="return confirm('Do you really want to terminate this task?');" Visible="false"></asp:LinkButton>
CausesValidation="false" Text="Stop" OnClientClick="return confirm('Do you really want to terminate this task?');"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>

View file

@ -66,34 +66,13 @@ namespace WebsitePanel.Portal
// find controls
HyperLink lnkTaskName = (HyperLink)e.Row.FindControl("lnkTaskName");
Literal litTaskName = (Literal)e.Row.FindControl("litTaskName");
Literal litTaskDuration = (Literal)e.Row.FindControl("litTaskDuration");
Panel pnlProgressBarContainer = (Panel)e.Row.FindControl("pnlProgressBarContainer");
Panel pnlProgressIndicator = (Panel)e.Row.FindControl("pnlProgressIndicator");
Literal litProgressIndicator = (Literal)e.Row.FindControl("litProgressIndicator");
LinkButton cmdStop = (LinkButton)e.Row.FindControl("cmdStop");
if (String.IsNullOrEmpty(task.TaskId))
{
litTaskName.Visible = true;
litProgressIndicator.Visible = true;
// bind controls
litTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
}
else
{
lnkTaskName.Visible = true;
pnlProgressBarContainer.Visible = true;
cmdStop.Visible = true;
// bind controls
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
// stop button
cmdStop.CommandArgument = task.TaskId;
}
// bind controls
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
// duration
TimeSpan duration = (TimeSpan)(DateTime.Now - task.StartDate);
@ -107,6 +86,9 @@ namespace WebsitePanel.Portal
if (task.IndicatorMaximum > 0)
percent = task.IndicatorCurrent * 100 / task.IndicatorMaximum;
pnlProgressIndicator.Width = Unit.Percentage(percent);
// stop button
cmdStop.CommandArgument = task.TaskId;
}
protected void gvTasks_RowCommand(object sender, GridViewCommandEventArgs e)

View file

@ -51,7 +51,7 @@ namespace WebsitePanel.Portal
private void BindTask()
{
DateTime lastLogDate = DateTime.MinValue;
DateTime lastLogDate = DateTime.Now.AddYears(-1);
if (ViewState["lastLogDate"] != null)
lastLogDate = (DateTime)ViewState["lastLogDate"];