<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OnlineUsers.aspx.cs" Inherits="Root_OnlineUsers_OnlineUsers" %>

<%@ Register src="../UserControl/Header.ascx" tagname="Header" tagprefix="uc1" %>
<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <meta name="viewport" content="width=device-width,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <link type="text/css" href="../Styles/root_table.css" rel="Stylesheet" />
    <script type="text/javascript">
        function delete_online(ou_id) {
            var db = document.getElementById("dll_db").value;
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: 'OnlineUsers_Service.asmx/DeleteUser',
                data: "{db:'" + db + "',ou_id:'" + ou_id + "'}",
                dataType: 'json',
                success: function (result) {
                    var r = result.d;
                    if (r == "success") {
                        window.location = "OnlineUsers.aspx?db=" + db;
                    } else {
                        alert(r);
                    }
                }
            });
        }
    </script>
</head>
<body>
    <uc1:Header runat="server" ID="uc1" />
    <form id="form1" runat="server">
    <div style='text-align:left;width:800px;border:solid 0px red;margin:auto;'>
    选择账套：
    <asp:DropDownList runat="server" ID="dll_db" AutoPostBack="True" onselectedindexchanged="dll_db_SelectedIndexChanged" CssClass="root_listbox">
    </asp:DropDownList>
    <asp:Button runat="server" Text="刷新" CssClass="metro_btn" ID="refresh" onclick="Refresh_Click"/>

    <asp:Label runat="server" ID="lbl_msg" Text="" ForeColor="White"></asp:Label>
    <br /><br />
    <asp:ListView ID="list_view" runat="server" ItemPlaceholderID="placeHolder">
        <LayoutTemplate>
            <table id="lvTable" class="root_table" style='width:800px;background-color:#green;margin:auto'>
                <thead>
                <tr>
                    <th nowrap>用户ID</th>
                    <th nowrap>用户名</th>
                    <th nowrap>姓名</th>
                    <th nowrap>登录日期</th>
                    <th nowrap>IP地址</th>
                    <th nowrap>操作</th>
                </tr>
                </thead>
                <tbody>
                    <tr id="placeHolder" runat="server"></tr>
                </tbody>
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td><%# Eval("u_id")%></td>
                <td><%# Eval("username")%></td>
                <td><%# Eval("nickname")%></td>
                <td><%# Eval("login_date")%></td>
                <td><%# Eval("ip")%></td>
                <td><a class="btn btn-red" href="javascript:delete_online(<%# Eval("ou_id")%>);">踢除</a></td>
            </tr>
        </ItemTemplate>
        <EmptyDataTemplate>
            <center>所选账套没有在线用户</center>
        </EmptyDataTemplate>
    </asp:ListView>


    </div>
    </form>
</body>
</html>
