<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_UserList, LebiMall" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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 id="Head1" runat="server">
    <title>会员管理</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link rel="stylesheet" type="text/css" href="css/css.css" media="screen"/>
    <script type="text/javascript" language="javascript" src="js/topHead.js"></script>
    <script src="js/checked.js" type="text/javascript"></script>
    <link href="css/tipswindown.css" type="text/css" rel="stylesheet" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/tipswindown.js" type="text/javascript"></script>
    <script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        var page='<%=page %>';
        function edit(id){
            window.location.href="UserEdit.aspx?id="+id+"&page="+page;
        }
        function dels(){
            var form =document.forms[0];
            var strid="";
            if (confirm("是否要将用户删除？")) {
                for(i=0;i<form.elements.length;i++)
                {
                    if(form.elements[i].type=="checkbox")
                    {
                        if(form.elements[i].checked==true){
                            strid+=form.elements[i].value+",";
                        }
                    }
                }
                if(strid!=""){
                window.location.href="UserList.aspx?strid="+strid+"&type=dels&page="+page;}
            }
        }
        function ding(id){
            window.location.href="Orderlist.aspx?fromid="+id;
        }
        function Message(id){
             window.location.href="WriteMessage.aspx?returnValue="+escape(id+",");
        }
        function Message2(){
            var form =document.forms[0];
            var strid="";
            for(i=0;i<form.elements.length;i++)
            {
                if(form.elements[i].type=="checkbox")
                {
                    if(form.elements[i].checked==true){
                        strid+=form.elements[i].value+",";
                    }
                }
            }
            window.location.href="WriteMessage.aspx?returnValue="+escape(strid);
        }
        function searchu(){
            var str_=document.getElementById("txt_search").value;
            var stime=escape(document.getElementById("txt_starttime").value);
            var etime=escape(document.getElementById("txt_endtime").value);
            window.location.href="Userlist.aspx?usernames="+escape(str_)+"&letime="+stime+"&letime2="+etime;
        }
        function detail(stra){
            window.location.href="AccountLog.aspx?auname="+escape(stra);
        }
    </script>
</head>
<body>
<form id="form1" runat="server" method="post">
        <script>header(4,0,"images/");</script>
        <div class="blank clearfix"></div>
        <!--功能区-->
        <div class="tabmenus mainwidth">
            <ul>
                <li class="current"><a href="userList.aspx"><span>会员管理</span></a></li>
                <li><a href="UserAdd.aspx"><span>会员添加</span></a></li>
                <li><a href="UserSelect.aspx"><span>会员查询</span></a></li>
            </ul>
        </div>
        <div class="tab-mainbody">
            <div class="tab-mainbody2">
                <div class="functionHandleArea clearfix" style="padding:3px 0 3px 4px" >
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="100px;"><input type="text" id="txt_starttime" class="texttime"  runat=server onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" /></td>
                            <td width="5px;">-</td>
                            <td width="110px;"><input type="text" id="txt_endtime" class="texttime"  runat=server  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',skin:'whyGreen',autoPickDate:'null'})" /></td>
                            <td><input type="text" id="txt_search" class="input" style="width:150px;" runat=server /><input type="button" onclick="searchu();" class="btn-search" /></td>
                        </tr>
                        <tr>
                            <td colspan="4" style="height:30px;">
                                <%if(strc=="1"){ %>
                                <input type="image"  title=" 发消息 " onclick="Message2();return false;" src="images/bt_fa.gif" align="absmiddle" />
                                <%} %>
                                <input type="image"  title=" 删除 " onClick="dels();return false;" src="images/bt_delete.gif" align="absmiddle" /> &nbsp;
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="datalist">
                    <table cellspacing="0" border="0" id="list" style="width: 100%; border-collapse: collapse;">
                        <tr>
                            <th style=" width:5%; cursor: pointer;" title="全选" onclick="AllChecked()">
                                选择</th>
                            <th style="width:20%">
                                用户名</th>
                            <th style="width:10%">
                                真实姓名
                            </th>
                            <th style="width:10%">
                                账户余额
                            </th>
                            <th style="width:5%">
                                短信
                            </th>
                            <th style="width:15%">
                                注册时间
                            </th>
                            <th style="width:15%">
                                最后登录时间
                            </th>
                            <th style="width:5%">
                                登录
                            </th>
                            <th style="width:15%">
                                基本操作
                            </th>
                        </tr>
                        <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++){%>
                        <tr>
                            <td>
                                <input type="checkbox" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                                <input type="hidden" id="hidden_id<%=i %>" name="hidden_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>"/>
                            </td>
                            <td>
                                <%=subStr(ds.Tables[0].Rows[i]["username"].ToString())%>
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["uname"] %>
                            </td>
                            <td>
                                ￥<%=ds.Tables[0].Rows[i]["Balance"] %>
                            </td>
                            <td>
                                <img src="images/message.gif" style="cursor:pointer;" title="发站内短消息" alt="发站内短消息" onclick="Message(<%=ds.Tables[0].Rows[i]["id"] %>)" />
                            </td>  
                            <td>
                                <%=ds.Tables[0].Rows[i]["Registertime"]%>
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["LastLogintime"]%>&nbsp;
                            </td>
                            <td>
                                <%=ds.Tables[0].Rows[i]["LoginCount"]%>
                            </td>
                            <td>
                                <a href="javascript:edit(<%=ds.Tables[0].Rows[i]["id"] %>)">编辑</a>&nbsp;|&nbsp;
                                <a href="javascript:ding(<%=ds.Tables[0].Rows[i]["id"] %>)">订单</a>&nbsp;|&nbsp; 
                                <a href="javascript:detail('<%=ds.Tables[0].Rows[i]["uname"] %>')">明细</a>
                            </td>
                        </tr>
                        <%} %>
                        <tr>
                            <td colspan="9" class="list-foot">
                                <div style="float: left; padding-top: 3px;">
                                </div>
                                <div id="divAsp" runat="server" style="float: right; padding-top: 3px;">
                                    <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                                        runat="server" RecordCount="228" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                                        PrevPageText="上一页" PageSize="20" UrlPaging="True" CustomInfoClass="pages1" CurrentPageButtonPosition="Center" ShowBoxThreshold="50"
                                        ShowFirstLast="true" NumericButtonCount="4" BackColor="Transparent" ShowDisabledButtons="False" EnableViewState="False">
                                    </webdiyer:AspNetPager>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <script type="text/javascript">tdshowm("list");</script>
                </div>
            </div>
        </div>
        <script type="text/javascript">
            var $=jQuery;
            var f="<%=returnValue %>";
            var i=2;
            if(f=="true"){
                tipsWindown('操作结果','text:操作成功！','250','100','true','2000','true','text');
                setInterval("fun()", 1000);
            }
            if(f=="false"){
                tipsWindown('操作结果','text:操作失败！','250','100','true','2000','true','text');
            }
            function fun() {
                if (i == 1) {
                    window.location.href="UserList.aspx";
                }
                i--;
            }
        </script>
</form>
</body>
</html>
