<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Client/ClientMaster.master" CodeBehind="Accounts.aspx.vb" Inherits="Web.Accounts" %>
<%@ MasterType VirtualPath="../ClientMaster.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phContent" runat="server">

    <header>
        <h1>Accounts</h1>
    </header>

    <asp:GridView ID="gvAccounts" runat="server" DataSourceID="dsAccounts"
        AutoGenerateColumns="false">
        <Columns>
            <asp:BoundField HeaderText="Username" DataField="username" />
            <asp:BoundField HeaderText="Last Login" DataField="dateLastLogin" />
            <asp:BoundField HeaderText="Name" DataField="nameFull" />
        </Columns>
        <EmptyDataTemplate>
            There are no accounts.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="dsAccounts" runat="server"
        SelectCommand="
            SELECT id, dateLastLogin, username,
                nameLast + ', ' + nameFirst + ' ' + nameMiddle +
                    CASE WHEN nameSuffix='' THEN '' ELSE ', ' END + nameSuffix
                    AS nameFull
            FROM web_ClientAccount
            WHERE contractId=@contractId"
        >
        <SelectParameters>
            <asp:Parameter Name="contractId" />
        </SelectParameters>
    </asp:SqlDataSource>

</asp:Content>
