<%@ Page Language="vb" MasterPageFile="~/CITAD.Master" 
    AutoEventWireup="false" 
    Codebehind="UserList.aspx.vb"
    Inherits="CITAD.WEB.VB.UserList" 
    Culture="auto" 
    meta:resourcekey="PageResource1"
    UICulture="auto" 
    EnableEventValidation ="false"
    Title="Danh sách người sử dụng"%>

<%@ Register Src="../../Controls/MessageBox.ascx" TagName="MessageBox" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        //window.document.onkeydown=KeyDown;
	    window.document.onkeyup=ShortcutKeys;
        function ShortcutKeys()
        {
                if(event.ctrlKey)
                {
                    if(window.event.keyCode==69) //Đóng
                    {
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuClose');
                    }
                    if(window.event.keyCode==49) //Thêm mới
                    {
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuAdd');
                    }
                    if(window.event.keyCode==50) //Sửa
                    {
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuEdit');
                    }
                    if(window.event.keyCode==51) //Xóa
                    {
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuDelete');
                    }
                    if(window.event.keyCode==52) //Truy vấn
                    {
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuIquiry');
                    }
                }
                if(event.keyCode == 13)
                {    
                    var tablet = document.getElementById('eventSRC');                
                    if(tablet.contains(event.srcElement)){
                        __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuIquiry');                    
                    }                
                }
        }        
        window.onload = function(){
            document.getElementById('<%=txtUserID.ClientID%>').focus();
        }
    </script>
    <cc1:ToolkitScriptManager runat="Server" ID="ScriptManager1" EnableScriptGlobalization="True"
             EnableScriptLocalization="True" CombineScripts="True" EnablePageMethods="true"  />
    <table border= "0" cellpadding="0" cellspacing="2" width="770px">
        <tr>
            <td>
                <table class="citad-toolbar" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="citad-toolbar-tdleft"></td>
                        <td class="citad-toolbar-tdmain">
                            <asp:Menu ID="Menu1" runat="server" 
                                OnMenuItemClick="Menu1_MenuItemClick"
                                Font-Names="Verdana"
                                Font-Size="11px"
                                
                                Orientation="Horizontal" 
                                CssClass="citad-menu" 
                                StaticSubMenuIndent="10px" 
                                meta:resourcekey="Menu1Resource1"
                                
                                StaticHoverStyle-CssClass="citad-menu-hover"
                                StaticMenuStyle-CssClass="citad-menu"
                                StaticSelectedStyle-CssClass="citad-menu-selected"
                                
                                StaticMenuItemStyle-HorizontalPadding="5px"
                                StaticMenuItemStyle-VerticalPadding="2px">
                                <Items>
                                    <asp:MenuItem Text="Tho&#225;t" Value="mnuClose" meta:resourcekey="MenuItemResource1" ImageUrl="~/Images/Menu/home.gif">
                                    </asp:MenuItem>
                                    <asp:MenuItem Text="Th&#234;m mới" Value="mnuAdd" meta:resourcekey="MenuItemResource2" ImageUrl="~/Images/Menu/add.gif">
                                    </asp:MenuItem>
                                    <asp:MenuItem Text="Sửa" Value="mnuEdit" meta:resourcekey="MenuItemResource3" ImageUrl="~/Images/Menu/open.gif"></asp:MenuItem>
                                    <asp:MenuItem Text="Xo&#225;" Value="mnuDelete" meta:resourcekey="MenuItemResource4" ImageUrl="~/Images/Menu/delete.gif"></asp:MenuItem>
                                    <asp:MenuItem Text="Truy vấn" Value="mnuIquiry" meta:resourcekey="MenuItemResource5" ImageUrl="~/Images/Menu/search.gif"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                  <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Menu1" EventName="MenuItemClick" />
                    </Triggers>
                    <ContentTemplate>
                        <table id="eventSRC" cellspacing="2">
                            <tr>
                                <td style="width: 203px; margin-left:10px;">
                                    <fieldset style="height: 45px">
                                        <legend>
                                            <asp:Label ID="Label2" runat="server" Text="Tên đăng nhập" meta:resourcekey="Label22Resource1"></asp:Label></legend>
                                            <asp:TextBox ID="txtUserID" runat="server" meta:resourcekey="txtUserIDResource1" CssClass="citad-txt"></asp:TextBox><br />
                                    </fieldset>
                                </td>
                                <td>
                                    <fieldset style="height: 45px"><legend><asp:Label ID="Label3" runat="server" Text="T&#236;nh trạng" meta:resourcekey="Label3Resource1"></asp:Label></legend>
                                        <table>
                                            <tr>
                                                <td style="width: 100px; height: 22px;">
                                                    <asp:RadioButton ID="rdbDangSuDung" runat="server" Text="Đang sử dụng" GroupName="grpTinhTrang" meta:resourcekey="rdbDangSuDungResource1" Width="120px" /></td>
                                                <td style="width: 100px; height: 22px;">
                                                    <asp:RadioButton ID="rdbKhongSuDung" runat="server" Text="Kh&#244;ng sử dụng" GroupName="grpTinhTrang" meta:resourcekey="rdbKhongSuDungResource1" Width="128px" /></td>
                                                <td style="width: 100px; height: 22px;">
                                                    <asp:RadioButton ID="rdbTatCa" runat="server" Text="Tất cả" Width="80px" GroupName="grpTinhTrang" Checked="True" meta:resourcekey="rdbTatCaResource1" /></td>
                                            </tr>
                                        </table>
                                    </fieldset>
                               </td>
                           </tr>
                        </table> 
                        <table width="100%">
                            <tr>
                                <td align="right">
                                    <asp:Label ID="lblTongSo" runat="server" Font-Bold="True" meta:resourcekey="lblTongSoResource1"
                                        Text="Tổng số:"></asp:Label>
                                    <asp:Label ID="lblCount" runat="server" Font-Bold="True"></asp:Label></td>
                            </tr>
                        </table>
                        <asp:GridView DataKeyNames="USER_ID" ID="dgvUser" runat="server" 
                            CellPadding="2" 
                            AllowPaging="True" 
                            AutoGenerateColumns="False" 
                            meta:resourcekey="grvTrxListResource1" 
                            CssClass="grid" 
                            OnPageIndexChanging="dgvUser_PageIndexChanging" 
                            OnRowDataBound="dgvUser_RowDataBound" OnSelectedIndexChanged="dgvUser_SelectedIndexChanged">
                            <FooterStyle CssClass="grid-footer" />
                            <RowStyle CssClass="grid-row" />
                            <EditRowStyle BackColor="#999999" />
                            <SelectedRowStyle CssClass="grid-selectedRow" />
                            <PagerStyle CssClass="grid-pager" HorizontalAlign="Center" />
                            <HeaderStyle CssClass="grid-header" />
                            <AlternatingRowStyle CssClass="grid-alternating" />
                            <Columns>
                                <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkCheckAll" runat="server" onclick="return CheckAll(this,'chkOne');" meta:resourcekey="chkCheckAllResource1"/>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <input id="chkOne" type="checkbox" runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />  
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="TT" meta:resourcekey="BoundFieldResource1" >
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="USER_NAME" HeaderText="Tên đầy đủ" meta:resourcekey="BoundFieldResource2">
                                </asp:BoundField>
                               <%-- 
                                <asp:BoundField HeaderText="T&#234;n đăng nhập" DataField="USER_ID" meta:resourcekey="BoundFieldResource3">
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                --%>
                                
                                <asp:TemplateField HeaderText="Tên đăng nhập" meta:resourcekey="TemplateFieldResource6">
                                    
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtUSER_ID" runat="server" CommandName="Select" Text='<%# Bind("USER_ID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                    
                                </asp:TemplateField>
                                
                                <asp:BoundField DataField="tinhtrang" HeaderText="T&#236;nh trạng" meta:resourcekey="BoundFieldResource4">
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField HeaderText="Hết hạn mật khẩu" meta:resourcekey="BoundFieldResource5">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                            </Columns>
                            <EmptyDataTemplate>
                                <asp:Label ID="lblMsgGrv" runat="server" meta:resourcekey="lblMsgGrvResource1" Text="Kh&#244;ng c&#243; bản ghi n&#224;o"></asp:Label>
                            </EmptyDataTemplate>
                        </asp:GridView>
                   <asp:HiddenField ID="hidModalPopup" runat="server" />
                    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" meta:resourcekey="Panel1Resource1" Style="display: none" Width="400px">
                        <p style="font-size: 14px">
                            <asp:Label ID="lblMessage" runat="server" meta:resourcekey="lblMessageResource1"></asp:Label>&nbsp;</p>
                        <p style="text-align: center">
                            <asp:Button ID="OkButton" runat="server" CssClass="citad-btn" meta:resourcekey="OkButtonResource1"
                                Text="OK" />
                        </p>
                    </asp:Panel>
                        <uc1:MessageBox ID="MessageBox1" runat="server" />
                    <cc1:ModalPopupExtender ID="ModalPopupExtenderUList" runat="server"  OkControlID="OkButton" TargetControlID="hidModalPopup" PopupControlID="Panel1" DynamicServicePath="" Enabled="True">
                        </cc1:ModalPopupExtender>
                    <asp:HiddenField ID="hidConfirmDelete" runat="server" />
                    <asp:Panel ID="Panel2" runat="server" CssClass="modalPopup" Style="display: none" Width="400px" meta:resourcekey="Panel2Resource1">
                        <p style="font-size: 14px; text-align:center;">
                            <asp:Label ID="lblConfirmDelete" runat="server" meta:resourcekey="lblConfirmDeleteResource1" ></asp:Label>&nbsp;</p>
                        <p style="text-align: center">
                            <asp:Button ID="btnOKDelete" runat="server" CssClass="citad-btn" Text="OK" OnClick="btnOKDelete_Click" meta:resourcekey="btnOKDeleteResource1" />
                            <asp:Button ID="btnCancelDelete" runat="server" CssClass="citad-btn" Text="Cancel" meta:resourcekey="btnCancelDeleteResource1" />
                        </p>
                    </asp:Panel>
                        <cc1:ModalPopupExtender ID="ModalPopupExtenderConfirm" runat="server" CancelControlID="btnCancelDelete" TargetControlID="hidConfirmDelete" PopupControlID="Panel2" DynamicServicePath="" Enabled="True">
                        </cc1:ModalPopupExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>