<%@ Page Language="VB" AutoEventWireup="false" CodeFile="EditSettings.aspx.vb" Inherits="EditSettings" ValidateRequest="false" %>
<%@ Register Src="../Controls/TopBanner.ascx" TagName="TopBanner" TagPrefix="uc1" %>

<!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>Edit Provider Settings</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <uc1:TopBanner ID="topMenuBanner" runat="server" />
    </div>
    <div>
    <table border='0'>
        <tr>
            <td>
                Page:&nbsp;
                <asp:TextBox ID="txtPage" runat="server" width="50"></asp:TextBox>
                &nbsp;<asp:Button ID="btnPage" runat="server" Text="Go to Page" />
            </td>
        </tr>
        <tr>
            <td>
                Filter on Environment Name:
                <asp:TextBox ID="txtEnvironment" runat="server" width="100" Visible='false'></asp:TextBox>
                <asp:DropDownList ID="ddlEnvironment" runat="server" 
                        DataTextField="environmentname"
                        DataSourceID="SqlDataSource2" DataValueField="environmentname"
                />
                &nbsp;Provider Name:
                <asp:TextBox ID="txtProvider" runat="server" width="100"></asp:TextBox>
                &nbsp;Setting Name:
                <asp:TextBox ID="txtSetting" runat="server" Width="100"></asp:TextBox>
                &nbsp;Setting Value:
                <asp:TextBox ID="txtValue" runat="server" Width="100"></asp:TextBox>
                &nbsp;<asp:Button ID="btnFilter" runat="server" Text="Filter" />
                <asp:Label ID="lblFilter" runat="server" Visible='false'></asp:Label>
            </td>
        </tr>
    </table>
    </div>
    <div>
        &nbsp;
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
            </Columns>
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333"   HorizontalAlign='Left'/>
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <PagerSettings Position="TopAndBottom" />                               
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Left" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" HorizontalAlign='Left'/>
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"  ConnectionString="<%$ ConnectionStrings:Charter.Website.WS.CommerceEngineConnectionString %>"
            SelectCommand="select '' as environmentname FROM [ADMIN].[Provider_Settings] union SELECT distinct environmentname FROM [ADMIN].[Provider_Settings]  order by 1"
            DataSourceMode="DataReader"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Charter.Website.WS.CommerceEngineConnectionString %>"
            DeleteCommand="DELETE FROM [ADMIN].[Provider_Settings] WHERE [ID] = @ID" InsertCommand="INSERT INTO [ADMIN].[Provider_Settings] ([EnvironmentName], [ProviderName], [SettingName], [SettingValue], [CreateDate], [ModifiedDate]) VALUES (@EnvironmentName, @ProviderName, @SettingName, @SettingValue, @CreateDate, @ModifiedDate)"
            SelectCommand="SELECT * FROM [ADMIN].[Provider_Settings]" UpdateCommand="UPDATE [ADMIN].[Provider_Settings] SET [EnvironmentName] = @EnvironmentName, [ProviderName] = @ProviderName, [SettingName] = @SettingName, [SettingValue] = @SettingValue, [CreateDate] = @CreateDate, [ModifiedDate] = @ModifiedDate WHERE [ID] = @ID">
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="EnvironmentName" Type="String" />
                <asp:Parameter Name="ProviderName" Type="String" />
                <asp:Parameter Name="SettingName" Type="String" />
                <asp:Parameter Name="SettingValue" Type="String" />
                <asp:Parameter Name="CreateDate" Type="DateTime" />
                <asp:Parameter Name="ModifiedDate" Type="DateTime" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="EnvironmentName" Type="String" />
                <asp:Parameter Name="ProviderName" Type="String" />
                <asp:Parameter Name="SettingName" Type="String" />
                <asp:Parameter Name="SettingValue" Type="String" />
                <asp:Parameter Name="CreateDate" Type="DateTime" />
                <asp:Parameter Name="ModifiedDate" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
