<%@ Page Title="" Language="C#" MasterPageFile="~/Master/MasterPage.master" AutoEventWireup="true" CodeBehind="FieldRestrictions.aspx.cs" Inherits="PirTickets.FieldRestrictions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h3>
        Restricted fields</h3>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="id" DataSourceID="SqlDataSource1" CellPadding="4" 
            ForeColor="#333333">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                    ReadOnly="True" SortExpression="id" />
                <asp:TemplateField HeaderText="Name" SortExpression="name">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>' ToolTip='<%# Bind("description") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField DataField="readonlyuser" HeaderText="Read Only User" 
                    SortExpression="readonlyuser" />
                <asp:CheckBoxField DataField="reportuser" HeaderText="Report User" 
                    SortExpression="reportuser" />
                <asp:CheckBoxField DataField="technician" HeaderText="Technician" 
                    SortExpression="technician" />
                <asp:CheckBoxField DataField="manager" HeaderText="Manager" 
                    SortExpression="manager" />
                <asp:CheckBoxField DataField="administrator" HeaderText="Administrator" 
                    SortExpression="administrator" />
            </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="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:PirTickets %>" 
            DeleteCommand="DELETE FROM [security] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [security] ([name], [description], [readonlyuser], [reportuser], [technician], [manager], [administrator]) VALUES (@name, @description, @readonlyuser, @reportuser, @technician, @manager, @administrator)" 
            SelectCommand="SELECT [id], [name], [description], [readonlyuser], [reportuser], [technician], [manager], [administrator] FROM [security]" 
            UpdateCommand="UPDATE [security] SET [name] = @name, [description] = @description, [readonlyuser] = @readonlyuser, [reportuser] = @reportuser, [technician] = @technician, [manager] = @manager, [administrator] = @administrator WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="readonlyuser" Type="Boolean" />
                <asp:Parameter Name="reportuser" Type="Boolean" />
                <asp:Parameter Name="technician" Type="Boolean" />
                <asp:Parameter Name="manager" Type="Boolean" />
                <asp:Parameter Name="administrator" Type="Boolean" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="readonlyuser" Type="Boolean" />
                <asp:Parameter Name="reportuser" Type="Boolean" />
                <asp:Parameter Name="technician" Type="Boolean" />
                <asp:Parameter Name="manager" Type="Boolean" />
                <asp:Parameter Name="administrator" Type="Boolean" />
            </InsertParameters>
        </asp:SqlDataSource>
    </p>
        
</asp:Content>
