<%@ Page Language="c#" Codebehind="LdapPrzekierowania.aspx.cs" AutoEventWireup="True" Inherits="KOLKaP_WEB.KOLKaP.LdapPrzekierowania" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
  <title>LdapPrzekierowania</title>
  
  
  <meta content="C#" name="CODE_LANGUAGE" />
  <meta content="JavaScript" name="vs_defaultClientScript" />
  
  <link href="../Web.css?2" type="text/css" rel="stylesheet" />

  <script type="text/C#" runat="server" language="C#">
    private void LdapPrzekierowania_TextChanged(object sender, EventArgs e)
    {
      if ((sender as TextBox).Parent != null)
      {
        if (((sender as TextBox).Parent as TableCell).Parent != null)
        {
          if ((((sender as TextBox).Parent as TableCell).Parent as System.Web.UI.WebControls.DataGridItem).Cells[3] != null)
          {
            if ((((sender as TextBox).Parent as TableCell).Parent as System.Web.UI.WebControls.DataGridItem).Cells[3].Controls[1] is DropDownList)
            {
              if ((sender as TextBox).Text != "")
                ((((sender as TextBox).Parent as TableCell).Parent as System.Web.UI.WebControls.DataGridItem).Cells[3].Controls[1] as DropDownList).Enabled = true;
              else
                ((((sender as TextBox).Parent as TableCell).Parent as System.Web.UI.WebControls.DataGridItem).Cells[3].Controls[1] as DropDownList).Enabled = false;
            }
          }
        }
      }
    }
  </script>

</head>
<body class="body" oncontextmenu="return false" style="background-color: #c7c7c7">
  <form id="Form1" method="post" runat="server">
    <table cellspacing="0" cellpadding="0" width="100%" border="0">
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="4">
          <asp:Label ID="lblError" runat="server" EnableViewState="False"></asp:Label>
        </td>
      </tr>
      <tr>
        <td colspan="4">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%; height:100%">
            <tbody>
              <tr>
                <td style="width:100%; height:9" valign="bottom" colspan="2">
                  <asp:Label ID="lblPrzekierowania" runat="server" Font-Size="11px" Font-Bold="True"
                    Width="100%" Visible="False" Font-Names="Tahoma,Arial,Helvetica">Aktywne przekierowania</asp:Label>
                </td>
              </tr>
              <tr>
                <td valign="top" colspan="2">
                  <asp:DataGrid ID="dgPrzekierowania" runat="server" Width="100%" CssClass="aspGrid"
                    AllowSorting="True" PageSize="15" DataSource="<%# dvPrzekierowania %>" AutoGenerateColumns="False">
                    <AlternatingItemStyle CssClass="TableItemAlt"></AlternatingItemStyle>
                    <ItemStyle CssClass="TableItem"></ItemStyle>
                    <HeaderStyle HorizontalAlign="Center" ForeColor="White" CssClass="TableHeader" VerticalAlign="Top">
                    </HeaderStyle>
                    <Columns>
                      <asp:BoundColumn DataField="ADRES" SortExpression="ADRES" HeaderText="Adres"></asp:BoundColumn>
                    </Columns>
                    <PagerStyle BackColor="LightGray" CssClass="Pager"></PagerStyle>
                  </asp:DataGrid>
                </td>
              </tr>
            </tbody>
          </table>
        </td>
      </tr>
      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
          <asp:Label ID="lblPrzekierowanie" runat="server" Font-Bold="True" Font-Size="11px"
            Font-Names="Tahoma,Arial,Helvetica">Przekierowania</asp:Label>
        </td>
        <td align="right" colspan="1">
          <asp:Button ID="btnZapisz" runat="server" Width="90px" CssClass="aspButton" Text="Zapisz"
            OnClick="btnZapisz_Click"></asp:Button>
        </td>
      </tr>
      <tr>
        <td colspan="4">
          <asp:DataGrid ID="dgPrzekierowaniaKolKap" runat="server" Width="100%" CssClass="aspGrid"
            PageSize="15" AutoGenerateColumns="False" DataSource="<%# dvPrzekierowaniaKolKap %>">
            <AlternatingItemStyle CssClass="TableItemAlt"></AlternatingItemStyle>
            <ItemStyle CssClass="TableItem"></ItemStyle>
            <HeaderStyle HorizontalAlign="Center" ForeColor="White" CssClass="TableHeader" VerticalAlign="Top">
            </HeaderStyle>
            <Columns>
              <asp:TemplateColumn SortExpression="PRZEKIEROWANIE_EMAIL" HeaderText="Adres">
                <HeaderStyle Width="35px"></HeaderStyle>
                <ItemTemplate>
                  <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PRZEKIEROWANIE_EMAIL") %>'
                    Width="100%" Enabled="False">
                  </asp:TextBox>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn SortExpression="DATA_OD" HeaderText="Przekierowanie od">
                <HeaderStyle Width="20%"></HeaderStyle>
                <ItemTemplate>
                  <asp:TextBox ID="TextBox2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.DATA_OD", "{0:yyyy-MM-dd}") %>'
                    Width="100%">
                  </asp:TextBox>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn SortExpression="DATA_DO" HeaderText="Przekierowanie do">
                <HeaderStyle Width="20%"></HeaderStyle>
                <ItemTemplate>
                  <asp:TextBox ID="TextBox3" runat="server" OnTextChanged="LdapPrzekierowania_TextChanged"
                    Text='<%# DataBinder.Eval(Container, "DataItem.DATA_DO", "{0:yyyy-MM-dd}") %>'
                    AutoPostBack="True" Width="100%">
                  </asp:TextBox>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn SortExpression="BLOKADA" HeaderText="Akcja po wygaśnięciu">
                <HeaderStyle Width="25%"></HeaderStyle>
                <ItemTemplate>
                  <asp:DropDownList ID="DropDownList1" runat="server" Width="100%" Font-Size="Small"
                    SelectedValue='<%# DataBinder.Eval(Container, "DataItem.BLOKADA") %>'>
                    <asp:ListItem Value="0" Selected="True">-wybierz akcje-</asp:ListItem>
                    <asp:ListItem Value="1">po dacie 'do' zablokuj konto</asp:ListItem>
                    <asp:ListItem Value="2">po dacie 'do' usuń przekierowanie</asp:ListItem>
                  </asp:DropDownList>
                </ItemTemplate>
              </asp:TemplateColumn>
            </Columns>
            <PagerStyle BackColor="LightGray" CssClass="Pager"></PagerStyle>
          </asp:DataGrid>
        </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3">
          <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="11px" Font-Names="Tahoma,Arial,Helvetica">Nowe przekierowanie</asp:Label>
        </td>
        <td colspan="1" align="right">
          <asp:Button ID="btnDodaj" runat="server" Width="90px" CssClass="aspButton" Text="Dodaj"
            OnClick="btnDodaj_Click"></asp:Button>
        </td>
      </tr>
      <tr>
        <td style="height: 34px; width:34%">
          <small>Adres<br /></small>
          <br />
          <asp:TextBox ID="tbAdres" runat="server" Text="" Font-Size="Small" Width="100%"></asp:TextBox>
        </td>
        <td style="height: 34px; width:21%">
          <small>Przekierowanie od<br />(yyyy-MM-dd)</small><br />
          <asp:TextBox ID="tbPrzekierowanieOd" runat="server" Text="" Font-Size="Small" Width="100%"></asp:TextBox>
        </td>
        <td style="height: 34px; width:21%">
          <small>Przekierowanie do<br />(yyyy-MM-dd)</small><br />
          <asp:TextBox ID="tbPrzekierowanieDo" runat="server" Text="" Font-Size="Small" Width="100%"
            AutoPostBack="True" OnTextChanged="tbPrzekierowanieDo_TextChanged"></asp:TextBox>
        </td>
        <td style="height: 34px; width:24%">
          <small>Akcja po dacie do<br /></small><br />
          <asp:DropDownList ID="ddlAkcjaPo" runat="server" Font-Size="Small" Width="100%">
            <asp:ListItem Value="0">-wybierz akcje-</asp:ListItem>
            <asp:ListItem Value="1">po dacie 'do' zablokuj konto</asp:ListItem>
            <asp:ListItem Value="2">po dacie 'do' usuń przekierowanie</asp:ListItem>
          </asp:DropDownList>
        </td>
      </tr>
    </table>
  </form>
</body>
</html>
