<%@ Page Title="" Language="C#" MasterPageFile="~/Master/MasterPage.master" AutoEventWireup="true" CodeBehind="StatusList.aspx.cs" Inherits="PirTickets.StatusList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>Repair Status Maintenance</h2>
    
        <asp:Button ID="btAdd" runat="server" onclick="btAdd_Click" 
            Text="Add New Status" />
            <table>
    <tr>
<td>Repair Completed Threshold:<asp:DropDownList ID="ddcomplete" 
                runat="server" DataSourceID="SqlDataStatus" DataTextField="status_name" 
                DataValueField="id">
            </asp:DropDownList>
        </td>
        <td>
            <asp:Button ID="btSave" runat="server" Text="Update" onclick="btSave_Click" /></td>
    </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" DataKeyNames="id" 
        DataSourceID="SqlDataStatus" CellPadding="4" ForeColor="#333333" 
        ShowFooter="True" Width="450px" oninit="GridView1_Init" 
        onload="GridView1_Load" onprerender="GridView1_PreRender" 
        onrowcommand="GridView1_RowCommand" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
            <asp:ButtonField ButtonType="Image" CausesValidation="True" 
                ImageUrl="~/images/arrow_58.gif" CommandName="up" />
            <asp:ButtonField ButtonType="Image" ImageUrl="~/images/arrow_57.gif" CommandName="down"  />
            <asp:BoundField DataField="id" HeaderText="ID" ReadOnly="True" 
                SortExpression="id" />
            <asp:BoundField DataField="status_order" HeaderText="Order" 
                SortExpression="status_order" />
            <asp:BoundField DataField="status_name" HeaderText="Status" 
                SortExpression="status_name" />
        </Columns>
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#999999" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataStatus" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
        SelectCommand="SELECT [id], [status_order], [status_name] FROM [statuses]"
        UpdateCommand="update [statuses] set [status_order] =@status_order, [status_name] =@status_name where id=@id"
        DeleteCommand="DELETE FROM [statuses] where id=@id"
        >
    </asp:SqlDataSource>  
</asp:Content>
