<%@ Page Title="Login List" Language="vb" AutoEventWireup="false" MasterPageFile="~/FiniqAppMasterPage.Master" CodeBehind="LoginList.aspx.vb" Inherits="FinIQWebApp.LoginList" %>

<%@ Register Src="../FinIQ_User_Controls/DateControl.ascx" TagName="DateControl"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
     <script type="text/javascript">
        //<Added by Suraj Jaigude || 11-Apr-2020 || RHBUPINT-554 || search work on enter/tab out>
        function EnterKeyOnSearch(evt) {
            var code = (evt.which) ? evt.which : evt.keyCode;

            if (code == 13 || code == 9) {
                document.getElementById('<%=btnLoad.ClientID%>').click();
            }
        }
        //</Added by Suraj Jaigude || 11-Apr-2020 || RHBUPINT-554 || search work on enter/tab out>
    </script>
    <asp:ScriptManagerProxy ID="ScriptManagerProxy" runat="server">
    </asp:ScriptManagerProxy>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>

            <table>

                <tr>
                    <td>
                        <asp:Label ID="lblerror" CssClass="lblerror" runat="server"></asp:Label>
                        <asp:Label ID="lblInfo" CssClass="lblInfo" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
            <table style="margin-top:10px">

                <tr>
                    <td style="width: 40px">
                        <asp:Label ID="lblEntity" Text="Entity" CssClass="lbl" runat="server"></asp:Label>
                    </td>
                    <td style="width: 180px">
                        <asp:DropDownList ID="lstEntityName" runat="server" AutoPostBack="True" TabIndex="1"
                            CssClass="ddl" Width="160px">
                        </asp:DropDownList>
                    </td>
                    <td style="width: 45px">
                        <asp:Label ID="lblSelect" runat="server" CssClass="lbl" Text="Select"></asp:Label>

                    </td>
                    <td>
                        <asp:DropDownList ID="ddlGroupName" runat="server" AutoPostBack="true" CssClass="ddl" Width="60px">
                            <asp:ListItem Value="ALL"></asp:ListItem>
                            <asp:ListItem Value="User"></asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td style="width: 180px">
                        <asp:TextBox ID="txtsearch" runat="server" Width="160px" onkeydown="EnterKeyOnSearch(event)"></asp:TextBox>
                    </td>

                     <td style="display:none">
                        <asp:Label ID="lblfrom" runat="server" CssClass="lbl" Visible="false">From </asp:Label>
                    </td>
                    <td style="width:140px;display:none">
                        <uc1:DateControl ID="txtfromdate" runat="server" CalenderCss="btn1" TextBoxCss="txt" Visible="false" />
                    </td>
                    <td style="width:20px;display:none">
                        <asp:Label ID="lblTo" runat="server" CssClass="lbl" Text="To" Visible="false"></asp:Label>
                    </td>
                    <td style="width:135px;display:none">
                        <uc1:DateControl ID="txttodate" runat="server" CalenderCss="btn1" TextBoxCss="txt" Visible="false" />
                    </td>
                      <td>
                        <asp:Button ID="btnLoad" runat="server" CssClass="btn" Text="Load"
                            Width="80px" />
                    </td>
 <%--ManasiA || 15-Apr-2021 || Export to excel icon and layout changes--%>
                    <td style="width:80px">
                        <%--<asp:Button ID="btnExcel" runat="server" CssClass="btn" Text="Export To Excel" Width="100px" />--%>
                         <asp:Button ID="btnExcel" runat="server" CssClass="btnExcel" ToolTip="Export To Excel" /> 
                    </td>
                    <td class="lbl">Page Count 
                    </td>
                    <td style="width:50px">
                        <asp:TextBox ID="txtpagecount" runat="server" Width="35px" Text="10" AutoPostBack="true" MaxLength="3"></asp:TextBox>
                    </td>

                    <td>
                        <asp:Label ID="Label2" runat="server">Total Records :</asp:Label>
                        <asp:Label ID="lblTotalRecords" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
         
            <table style="margin-top:15px">
                <tr>
                    <td>
                       <asp:GridView ID="grdLoginList" runat="server" AllowPaging="True" AutoGenerateColumns="False" PageSize="10" CssClass="Grid" 
                            AllowSorting="true" ShowHeaderWhenEmpty="true">
                            <SelectedRowStyle CssClass="GridItemSelect" />
                            <RowStyle CssClass="GridItem" />
                            <HeaderStyle CssClass="GridHeader" />
                            <FooterStyle CssClass="GridFooter" />
                            <PagerStyle CssClass="GridPager" />
                            <Columns>
                                 <asp:TemplateField HeaderText="Login ID" HeaderStyle-HorizontalAlign="Center" Visible="true">
                                    <HeaderStyle Width="80px" />
                                    <ItemStyle Wrap="true" HorizontalAlign="Left"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.LoginID").ToString)%>'
                                            ID="lblLoginID">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Login Name" HeaderStyle-HorizontalAlign="Center" Visible="true">
                                    <HeaderStyle Width="120px" />
                                    <ItemStyle Wrap="true" HorizontalAlign="Left"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.LoginName").ToString)%>'
                                            ID="lblLoginName">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Group ID" HeaderStyle-HorizontalAlign="Center" Visible="true">
                                    <HeaderStyle Width="80px" />
                                    <ItemStyle Wrap="true" HorizontalAlign="Left"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.Group").ToString)%>'
                                            ID="lblGroupID">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="User Role" HeaderStyle-HorizontalAlign="Center" Visible="true">
                                    <HeaderStyle Width="80px" />
                                    <ItemStyle Wrap="true" HorizontalAlign="Left"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.UserRole").ToString)%>'
                                            ID="lblUserRole">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                  <asp:TemplateField HeaderText="Created At" SortExpression="CreatedAt">
                                    <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="150px"></HeaderStyle>
                                    <ItemStyle Wrap="False" HorizontalAlign="Center" VerticalAlign="Middle" Width="150px"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label ID="lblCreatedAt" CssClass="lbl" runat="server" Text='<%# Eval("CreatedAt")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Last Login Date" HeaderStyle-HorizontalAlign="Center" Visible="true">
                                    <HeaderStyle Width="180px" />
                                    <ItemStyle Wrap="true" HorizontalAlign="Center"></ItemStyle>
                                    <ItemTemplate>
                                        <asp:Label runat="server" Text='<%# Microsoft.Security.Application.Encoder.HtmlEncode(DataBinder.Eval(Container, "DataItem.LastLoginDate").ToString)%>'
                                            ID="lblLastLoginDate">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                               
                              
                            </Columns>
                      
                        </asp:gridview>
                    </td>
                </tr>
            </table>

        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnExcel" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>