<%@ Page Async="true" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
        <a id="top"></a>
        <center>
            <asp:Label ID="lblTittle" runat="server" Text="Scheduled tasks on" CssClass="styleLblTitle"
                Font-Size="Large" ForeColor="#FF5F00" Font-Bold="True" Font-Names="Verdana"></asp:Label>
            <asp:ListBox ID="lstbServeur" runat="server" ForeColor="#FF5F00" OnSelectedIndexChanged="lstbServeurSelectionChange"
                Rows="1" OnTextChanged="lstbServeurSelectionChange" Font-Names="Verdana" AutoPostBack="True"></asp:ListBox>
        </center>
        <asp:TextBox ID="lblError" runat="server" Font-Names="Verdana" ForeColor="Red"
            ReadOnly="True" TextMode="MultiLine" BorderStyle="None" Visible="False"
            Width="901px"></asp:TextBox>
        <br />
        <asp:TextBox ID="tbxSearchText" runat="server" OnTextChanged="btnSearch_Click" ForeColor="Red"
            Font-Names="Verdana"></asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="Search"
            ForeColor="#FF5F00" Font-Names="Verdana" />
        <asp:Button ID="btnFailed" runat="server" OnClick="btnFailed_Click" Text="Failed"
            ForeColor="#FF5F00" Font-Names="Verdana" />
        <br />
        <p>
            <asp:TextBox ID="TextBox2" runat="server" Height="150px" Width="667px" ReadOnly="True"
                TextMode="MultiLine"></asp:TextBox>
        </p>
        <div>
            <asp:ListView ID="lvGroups" runat="server" ItemPlaceholderID="itemPlaceHolder1" OnItemDataBound="lvGroupsItemDataBound">
                <LayoutTemplate>
                    <%--                <table border="1">--%>
                    <%--                <table class="groupe">--%>
                    <tr>
                        <asp:PlaceHolder ID="itemPlaceHolder1" runat="server"></asp:PlaceHolder>
                    </tr>
                    <%--                </table>--%>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr class="table.groupe">
                        <td>
                            <asp:Label ID="lblGroup" runat="server" BorderStyle="Solid" BorderWidth="1" Font-Bold="true"
                                Font-Names="Verdana" Text='<%# Eval("Groupe").ToString() %>' ForeColor="White" BackColor="#FF9933"></asp:Label>
                        </td>
                    </tr>
                    <br />
                    <asp:ListView ID="lvJobs" runat="server" ItemPlaceholderID="itemPlaceHolder2">
                        <LayoutTemplate>
                            <table border="1" class="example">
                                <tr>
                                    <td style="width: 5%">Active
                                    </td>
                                    <td style="width: 25%">Name
                                    </td>
                                    <td style="width: 35%">Description
                                    </td>
                                    <td style="width: 5%">Result
                                    </td>
                                    <td style="width: 10%">
                                        <%--                                <asp:LinkButton ID="linkOrderDateExecution" runat="server" OnClick="linkOrderDateExecution_Click">Last run</asp:LinkButton>
                                        --%>
                                    Last run
                                    </td>
                                    <td style="width: 8%">Execution Time
                                    </td>
                                    <td style="width: 8%">Next Execution
                                    </td>
                                    <td style="width: 4%">Status
                                    </td>
                                </tr>
                                <tr>
                                    <asp:PlaceHolder ID="itemPlaceHolder2" runat="server"></asp:PlaceHolder>
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr class="<%# Container.DisplayIndex % 2 == 0 ? "" : "a" %>">
                                <td>
                                    <center>
                                        <asp:Image ID="imgJobActive" runat="server" ImageUrl='<%# GetStatsActive((VisualCron.JobClass)Container.DataItem) %>' />
                                    </center>
                                </td>
                                <td>
                                    <asp:LinkButton ID="linkJobTasks" Text='<%# Eval("Name").ToString()%>' runat="server"
                                        OnClick="linkJobTasks_Click"><%# Eval("Name").ToString()%></asp:LinkButton>
                                </td>
                                <td>
                                    <%# Eval("Description").ToString()%>
                                </td>
                                <td>
                                    <center>
                                        <asp:Image ID="imgTaskResult" runat="server" ImageUrl='<%# GetTaskResult((VisualCron.JobClass)Container.DataItem) %>' /></center>
                                </td>
                                <td>
                                    <%# Eval("Stats.DateLastExecution").ToString()%>
                                </td>
                                <td>
                                    <%# CvtSecondsToTime((VisualCron.JobClass)Container.DataItem)%>
                                </td>
                                <td>
                                    <%# Eval("Stats.DateNextExecution").ToString()%>
                                </td>
                                <td>
                                    <%# Eval("Stats.Status").ToString()%>
                        </ItemTemplate>
                        <%--                    <EmptyDataTemplate>
                        <br />
                    </EmptyDataTemplate>
                        --%>
                    </asp:ListView>
                    <br />
                </ItemTemplate>
            </asp:ListView>
        </div>
        <p>
            <asp:Label ID="Label1" runat="server" Font-Names="Verdana"></asp:Label>
        </p>
        <p>
            <asp:TextBox ID="TextBox1" runat="server" Height="354px" Width="667px" ReadOnly="True"
                TextMode="MultiLine"></asp:TextBox>
        </p>
    </form>
</body>
</html>
