fixed bug with "Running Tasks"

This commit is contained in:
vfedosevich 2013-05-17 16:06:02 +03:00
parent 9a10d75492
commit b9cde075d6
7 changed files with 584 additions and 434 deletions

View file

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

View file

@ -66,13 +66,34 @@ 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");
// bind controls
lnkTaskName.Text = GetAuditLogTaskName(task.Source, task.TaskName);
lnkTaskName.NavigateUrl = EditUrl("TaskID", task.TaskId, "view_details");
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;
}
// duration
TimeSpan duration = (TimeSpan)(DateTime.Now - task.StartDate);
@ -86,9 +107,6 @@ 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

@ -1,19 +1,51 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.42
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal {
public partial class Tasks {
protected System.Web.UI.Timer tasksTimer;
protected System.Web.UI.UpdatePanel tasksUpdatePanel;
protected System.Web.UI.WebControls.GridView gvTasks;
protected System.Web.UI.WebControls.ObjectDataSource odsTasks;
/// <summary>
/// tasksTimer control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.Timer tasksTimer;
/// <summary>
/// tasksUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel tasksUpdatePanel;
/// <summary>
/// gvTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvTasks;
/// <summary>
/// odsTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource odsTasks;
}
}