<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_User" Title="用户管理" Codebehind="KS.User.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
<script>
    $(function(){
        //获取进度百分比
        $(".schedule").each(function() {
            var a = $(this).find(".linebg").text()/$(this).find("em").text()*100;
            $(this).find(".linebg").animate({width:""+a+"%"},300);
        });
    });
     function delUser(userid,o){
                if (confirm('温馨提示：为避免删除用户后，新注册和删除用户同名称的用户，导致数据冗余冲突(如用户充值记录等)，强烈建议执行“宁可锁定也不删除”的原则，您还确定删除用户吗?')){
                    jQuery('#ajaxmsg',window.parent.document).toggle();
                    jQuery.ajax({
                        type: "POST",
                        url: "KS.User.aspx",
                        data: "userid="+userid+"&action=del",
                        success: function (data) {
                            jQuery('#ajaxmsg',window.parent.document).toggle();
                            if (data=="success"){
                                $(o).parent().parent().remove();
                            }else if (data=="failchild"){
                                alert("对不起，用户发展了下线，不可以删除！");
                            }else{
                                alert(data);
                            }
                        }
                    });
                }
            }
            function loadUserDetail(id,showtype,page){
                if (showtype==-1) { 
                    $("#s"+id).toggle();
                }
                if(!$("#s"+id).is(":hidden")){
                    jQuery('#ajaxmsg',window.parent.document).toggle();
                    jQuery.ajax({
                        type: "POST",
                        url: "KS.UserDetail.aspx",
                        data: "userid="+id+"&from=listuserdetail&showtype="+showtype+"&page="+page,
                        success: function (data) {
                            jQuery('#ajaxmsg',window.parent.document).toggle();
                            $("#ss"+id).html(data);
                        }
                    });
                }
            }
     function SetDate() {
        var today = new Date();
        if ($("#showsearchdate").is(":hidden")) {
            $("#showsearchdate").show();
            $('#<%=TxtSearchBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
        $('#<%=TxtSearchEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
    }
    else {
        $("#showsearchdate").hide();
        $('#<%=TxtSearchBeginDate.ClientID%>').val('');
        $('#<%=TxtSearchEndDate.ClientID%>').val('');
    }
}
        </script>
 <div class="content-area mt20">
     <%if (KSCMS.S("action") == "show"){ %>
         <!--<strong>查看用户[<%=drr["username"].ToString() %>]信息</strong>-->
     <%}else { %>
         <div class="myTitle">
            <span class="fr mr20 tips">总用户<span style='color:red'><%=GetAllUser(0) %></span>位，24小时内新增<span style='color:red'><%=GetAllUser(1) %></span>位，24小时内登录<span style='color:red'><%=GetAllUser(2) %></span>位</span>
            所有用户管理
         </div> 
     <%} %>  
	<% if (KSCMS.S("action")!="show"){%>  
       <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                  <asp:ListItem Value="0" Selected="True">用户名</asp:ListItem>
                  <asp:ListItem Value="5">推荐人</asp:ListItem>
                  <asp:ListItem Value="1">姓名</asp:ListItem>
                  <asp:ListItem Value="2">用户ID</asp:ListItem>
                  <asp:ListItem Value="3">手机号码</asp:ListItem>
                  <asp:ListItem Value="4">电子邮箱</asp:ListItem>
                </asp:DropDownList>
                <asp:TextBox runat="server" Width="180px" ID="TxtKeyWord" CssClass="textbox" /> 
                <b onclick="SetDate()" class="link-color">注册时间？</b>
                <span id="showsearchdate"<%if (this.TxtSearchBeginDate.Text==""){ %> style="display:none"<%} %>>
                    <asp:TextBox ID="TxtSearchBeginDate" Width="150px" runat="server"  onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                    <asp:TextBox ID="TxtSearchEndDate" Width="150px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});"  CssClass="textbox Wdate"></asp:TextBox>
                </span>
                <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text="开始搜索" onclick="BtnSearch_Click" />
            </div>
            <div class="property">
                <div class="name button ml15">筛选</div>
                <div class="propertyBox">
                	 <ul class="tabs clearfix">
                        <span class="screen fl">会员类型：</span>
                        <li <%=string.IsNullOrEmpty(KSCMS.S("gid"))?" class='active'":"" %>><a href="KS.User.aspx?<%=UtilsQueryParam.Get("gid") %>"><span>所有用户</span></a></li>
                        <%
                            using (DataTable dt = MyCache.GetUserGroupTable())
                            {
                                foreach (DataRow dr in dt.Rows)
                                {
                                    if (Utils.StrToInt(dr["groupid"].ToString()) > 0)
                                    {
                                        KSCMS.W(string.Format(@"<li{2}><a href=""KS.User.aspx?gid={0}&{3}""><span>{1}</span></a></li>", dr["groupid"].ToString(), dr["groupname"].ToString(), KSCMS.S("gid") == dr["groupid"].ToString() ? " class='active'" : string.Empty,UtilsQueryParam.Get("gid")));
                                    }
                                        
                                }
                            } 
                         %>
                     </ul>
                     <ul class="tabs clearfix">
                        <span class="screen fl">详细分类：</span>
                        <%if (!string.IsNullOrEmpty(KSCMS.S("groupname"))){ %>
                        <li>用户组[<%=KSCMS.S("groupname") %>]</li>
                        <%}else if (!string.IsNullOrEmpty(KSCMS.S("depart"))){%>
                        <li>部门[<%=KSCMS.S("depart") %>]</li>
                       
                        <%  }else{ %>
                            <li<%=string.IsNullOrEmpty(KSCMS.S("usertype"))?" class='active'":"" %>><a href="KS.User.aspx?<%=UtilsQueryParam.Get("userType") %>"">所有用户</a></li>
                            <li<%=KSCMS.S("usertype")=="1"?" class='active'":"" %>><a href="KS.User.aspx?UserType=1&<%=UtilsQueryParam.Get("userType") %>">锁定的用户</a></li>
                            <li<%=KSCMS.S("usertype")=="2"?" class='active'":"" %>><a href="KS.User.aspx?UserType=2&<%=UtilsQueryParam.Get("userType") %>"">所有管理员</a></li>
                            <li<%=KSCMS.S("usertype")=="3"?" class='active'":"" %>><a href="KS.User.aspx?UserType=3&<%=UtilsQueryParam.Get("userType") %>"">待认证</a></li>
                            <li<%=KSCMS.S("usertype")=="4"?" class='active'":"" %>><a href="KS.User.aspx?UserType=4&<%=UtilsQueryParam.Get("userType") %>"">待邮件激活</a></li>
                            <li<%=KSCMS.S("usertype")=="5"?" class='active'":"" %>><a href="KS.User.aspx?UserType=5&<%=UtilsQueryParam.Get("userType") %>"">24小时内登录</a></li>
                            <li<%=KSCMS.S("usertype")=="6"?" class='active'":"" %>><a href="KS.User.aspx?UserType=6&<%=UtilsQueryParam.Get("userType") %>"">24小时内注册</a></li>
                            <li<%=KSCMS.S("usertype")=="7"?" class='active'":"" %>><a href="KS.User.aspx?UserType=7&<%=UtilsQueryParam.Get("userType") %>"">VIP未到期</a></li>
                            <li<%=KSCMS.S("usertype")=="8"?" class='active'":"" %>><a href="KS.User.aspx?UserType=8&<%=UtilsQueryParam.Get("userType") %>"">VIP已过期</a></li>
                        <%} %>
                     </ul>
                     <ul class="tabs clearfix">
                        <span class="screen fl">最后登录设备：</span>
                            <li<%=string.IsNullOrEmpty(KSCMS.S("logindevice"))?" class='active'":"" %>><a href="KS.User.aspx?<%=UtilsQueryParam.Get("logindevice") %>">不限</a></li>
                            <li<%=KSCMS.S("logindevice")=="0"?" class='active'":"" %>><a href="KS.User.aspx?logindevice=0&<%=UtilsQueryParam.Get("logindevice") %>">PC</a></li>
                            <li<%=KSCMS.S("logindevice")=="1"?" class='active'":"" %>><a href="KS.User.aspx?logindevice=1&<%=UtilsQueryParam.Get("logindevice") %>">手机浏览器</a></li>
                            <li<%=KSCMS.S("logindevice")=="2"?" class='active'":"" %>><a href="KS.User.aspx?logindevice=2&<%=UtilsQueryParam.Get("logindevice") %>">微信公众号</a></li>
                            <li<%=KSCMS.S("logindevice")=="3"?" class='active'":"" %>><a href="KS.User.aspx?logindevice=3&<%=UtilsQueryParam.Get("logindevice") %>">APP</a></li>
                            <li<%=KSCMS.S("logindevice")=="4"?" class='active'":"" %>><a href="KS.User.aspx?logindevice=4&<%=UtilsQueryParam.Get("logindevice") %>">小程序</a></li>
                     </ul>
                </div>
            </div>
            <div class="fr">
                <input type="radio" name="optype" value="1" onClick="jQuery('#GroupID').attr('disabled',true)" id="del" checked /><label for="del">删除</label>
                &nbsp;<input type="radio" name="optype" value="2" onClick="jQuery('#GroupID').attr('disabled',true)" id="lock"/><label for="lock">锁定</label>
                &nbsp;<input type="radio" name="optype" value="3" onClick="jQuery('#GroupID').attr('disabled',true)" id="unlock"/><label for="unlock">解锁</label>
                &nbsp;<input type="radio" name="optype" value="4" onClick="jQuery('#GroupID').attr('disabled',false)" id="moveusergroup"/><label for="moveusergroup">移动到</label>
                &nbsp;<select ID="GroupID" disabled="false" name="GroupID" style="margin-right:8px;">
                <%=MyCache.GetUserGroupCache() %>
               </select>
               <asp:Button ID="ExecuteButton" runat="server" Text="开始执行" OnClick="ExecuteButton_Click" />
            </div>
       </div>
    <% } %>


<asp:Panel ID="ListPanel" runat="server" Width="100%">
    <script>
        function GetMyIds() {
            var sid = null;
            for (var i = 0; i < document.getElementsByName("ids").length; i++) {
                var KS = document.getElementsByName("ids")[i];
                if (KS.checked == true) {
                    if (sid == null)
                        sid = KS.value;
                    else
                        sid += "," + KS.value;
                }
            }
            return sid;
        }
        function doCZ(){
           var sid = GetMyIds();
           if (sid==null){
                KesionJS.Alert("请先选择要充值的用户！");
           }else{
                parent.openWin("给用户充值","User/KS.AddMoney.aspx?userID="+sid,true,750,500);
            }
        }
        function doSendMail(){
            var sid = GetMyIds();
            if (sid==null){
                KesionJS.Alert("请先选择要发送邮件的用户！");
            }else{
                location.href='KS.UserMail.aspx?userid='+sid;
            }
        }
        function doSendSms(){
            var sid = GetMyIds();
            if (sid==null){
                KesionJS.Alert("请先选择要发送手机短信的用户！");
            }else{
                location.href='KS.LogSms.aspx?action=send&userid='+sid;
            }
        }
        function doSendMessage(){
            var sid = GetMyIds();
            if (sid==null){
                KesionJS.Alert("请先选择要发送站内消息的用户！");
            }else{
                location.href='KS.UserMessage.aspx?action=send&userid='+sid;
            }
        }
        function doSetVIP(userid) {
             var sid = GetMyIds();
            if (userid == '0') {
                if (sid == null) {
                    KesionJS.Alert("请先选择要设置VIP有效期的用户！");
                }
                else {

                    top.openWin('VIP有效期设置', 'User/KS.AddMoney.aspx?action=setVip&userID='+sid, true, 750, 400);
                }

            } else {
                   top.openWin('VIP有效期设置','User/KS.AddMoney.aspx?action=setVip&userID='+userid,true,750,400);
            }        
            }

    </script>



    <asp:Repeater ID="RptList" runat="server">
          <HeaderTemplate>
          <table width="99%" class="CTable"  border="0" cellpadding="1" cellspacing="1">
              <tr class="CTitle">
               <td align="center"><b>选择</b></td>
               <td align="center"><b>UserID</b></td>
               <td align="center"><b>用户名</b></td>
               <td align="center"><b>用户组</b></td>
               <td align="center" style="display:none"><b>计费方式</b></td>
               <td align="center"><b>财富</b></td>
               <td align="center"><b>最后登录IP</b></td>
               <td align="center"><b>最后登录设备</b></td>
               <td align="center"><b>最后登录时间</b></td>
               <td align="center"><b>状态</b></td>
               <td align="center"><b>VIP有效时间</b></td>
               <td align="center"><b>业务员</b></td>
               <td align="center"><b>修改</b></td>
               <td align="center"><b>删除</b></td>
               <td align="center"><b>充值</b></td>
              <% if (BaseFun.CheckModulePower("edu"))
             {%>
               <td align="center"><b>报名</b></td>
                  <%} %>
              </tr>
          </HeaderTemplate>
         <ItemTemplate>
           <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'" onclick="chk(this);loadUserDetail(<%#Eval("UserID")%>,-1,1)">
                <td class="Ctd" style="text-align:center" onclick="doNone(event)"> <input type="checkbox"  name="ids" id="ids" value="<%#Eval("userid") %>" /></td>
                <td class="Ctd" style="text-align:center"><%# Eval("userid") %> </td>
                <td class="Ctd" style="text-align:center"><a  onclick="doNone(event);" href='KS.User.aspx?action=show&userid=<%#Eval("UserID") %>' title="查看用户[<%# Eval("username") %>]资料"><%# Eval("username") %><%#GetAreaname(Utils.StrToInt(Eval("proid")),Utils.StrToInt(Eval("cityid"))) %></a> </td>
                <td class="Ctd" style="text-align:center"><%# Eval("groupname") %> </td>
                <td class="Ctd" style="text-align:center;display:none;"><%# GetChargeType(Utils.StrToInt(Convert.ToString(Eval("Chargetype")))) %> </td>
                <td class="Ctd" style="text-align:center">
                     <a  onclick="doNone(event);" href='KS.LogMoney.aspx?username=<%#Eval("UserName") %>'><span style="color:Green" id="money<%# Eval("UserID") %>"><%# Math.Round(Convert.ToDouble(Eval("money")),2).ToString() %></span> <%=MyCache.GetCurrencyUnit %></a>/
                <%if (MyCache.GetShopCommonConfig(98) == "1")
                    { %> <a  onclick="doNone(event);" href='KS.Consumer.aspx?username=<%#Eval("UserName") %>'><%#GetPointOrEdays(Utils.StrToInt(Eval("UserID")),Utils.StrToInt(Eval("chargetype")),Utils.StrToInt(Eval("point")),Utils.StrToInt(Eval("edays")),Convert.ToDateTime(Eval("begindate"))) %></a>/<%} %><a  onclick="doNone(event);" href='KS.LogScore.aspx?username=<%#Eval("UserName") %>' title="总积分<%# Eval("Score") %>分，已消费<%# Eval("ScoreHasUse") %>分，可用积分<%# Utils.StrToInt(Eval("Score"))-Utils.StrToInt(Eval("ScoreHasUse")) %>分"><span style="color:blue" id="score<%# Eval("UserID") %>"><%# Eval("score") %></span>分</a>
                </td>
                <td class="Ctd" style="text-align:center"><span class="tips"><%# Eval("lastloginip")%></span></td>
                <td class="Ctd" style="text-align:center"><span class="tips"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("lastlogindevice")))%></span></td>
                <td class="Ctd" style="text-align:center"><span class="tips"><%# Eval("lastlogintime") %></span></td>
                <td class="Ctd" style="text-align:center"><%# ShowUserStatus(Utils.StrToInt(Eval("locked"))) %>  </td>
                <td class="Ctd" style="text-align:center"> 
                    <span class="tips"><a  href="javascript:;" class="link-color" onClick="doSetVIP(<%#Eval("UserID") %>);doNone(event);" > <%# GetVipTips(Eval("LoadType").ToString(),Eval("EndDate").ToString())  %> </a></span>
 </td>
                <td class="Ctd" style="text-align:center">  <%# string.IsNullOrEmpty(Convert.ToString(Eval("agent")))?"-":Eval("agent") %></td>
                <td class="Ctd" style="text-align:center">  
                    
                    <a onclick="doNone(event);" href="KS.UserAdd.aspx?page=<%=CurrPage %>&userid=<%#Eval("userid") %>" class="edit"></a>
</td>
                <td class="Ctd" style="text-align:center">  <a href="javascript:;" onclick="delUser(<%#Eval("userid") %>,this);doNone(event);" class="delete" title="删除" /></a></td>
                <td class="Ctd" style="text-align:center">  <a href="#" class="money" title="充值" onclick='parent.openWin("给用户充值","User/KS.AddMoney.aspx?userID=<%#Eval("userID") %>",false,750,500);doNone(event);return false'>充</a>
</td>
                 <% if (BaseFun.CheckModulePower("edu"))
             {%>
               <td class="Ctd" style="text-align:center"><a onclick="doNone(event);" href="../Course/KS.AddNew.aspx?username=<%#Eval("UserName") %>" class="report"></a></td>
               <%} %>
              </tr>
              <tr id="s<%# Eval("userid") %>" style="display:none;">
                 <td colspan="20" id="ss<%# Eval("userid") %>" style="background:#F7FBFE"></td>
             </tr>
       </ItemTemplate>
             <FooterTemplate>
              <tr class="tdbg emptycss" style="display:<%# bool.Parse((RptList.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="12">
                    <%=emptyTips %>
                </td>
               </tr> 
             
           </table>
          </FooterTemplate>
</asp:Repeater>
<asp:Panel ID="Panel1" runat="server" Height="30px">
          <div class="listedit">
              <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全选</label>
              <input type="button" value="发送邮件" class="button" onclick="doSendMail()" />
              <input type="button" value="发送手机短信" class="button" onclick="doSendSms()" />
              <input type="button" value="发送站内消息" class="button" onclick="doSendMessage()" />
              <input type="button" value="批量充值" class="button" onclick="doCZ()" />
              <input type="button" value="批量开通" class="button" onclick="doSetVIP(0)" />
              <input type="button" value="打印" class="button" onclick="window.print()" />  
              <input type="button" value="导出" class="button" onclick="location.href = 'KS.UserExport.aspx';" />  
          </div>     
</asp:Panel>
<script type="text/javascript">
	showtips('<span class="state"><strong>说明：</strong><br /></span>1、为避免删除用户后，新注册和删除用户同名称的用户，导致数据冗余冲突(如用户充值记录等)，强烈建议执行“宁可锁定也不删除”的原则。<br/>2、如果出现“删除失败”提示，有可能是该用户推荐了下级用户了，这种情况是不允许删除的；');
</script>

</asp:Panel>

<asp:Panel ID="PanelShow" runat="server" Visible="false">
    <div class="tabs_header">
        <ul class="tabs">
            <li<%=KSCMS.S("showType")==""?" class='active'":string.Empty %>><a href="KS.User.aspx?<%=UtilsQueryParam.Get("showtype") %>"><span>基本信息</span></a></li>
            <%if (DataFactoryUser.Exists("KS_User", "agent='" + drr["username"].ToString() + "'"))
                { %>
            <li<%=KSCMS.S("showType")=="3"?" class='active'":string.Empty %>><a href="KS.User.aspx?showType=3&<%=UtilsQueryParam.Get("showtype") %>"><span>客户列表</span></a></li>
            <li<%=KSCMS.S("showType")=="4"?" class='active'":string.Empty %>><a href="KS.User.aspx?showType=4&<%=UtilsQueryParam.Get("showtype") %>"><span>客户订单记录</span></a></li>
                <%} %>
            <%if (Utils.GetSysInfo("//sysinfo/showver").ToString().ToLower()!="cms")
            {%>
            <li<%=KSCMS.S("showType")=="5"?" class='active'":string.Empty %>><a href="KS.User.aspx?showType=5&<%=UtilsQueryParam.Get("showtype") %>"><span>订单记录</span></a></li>
                <%} %>
            <li<%=KSCMS.S("showType")=="1"?" class='active'":string.Empty %>><a href="KS.User.aspx?showType=1&<%=UtilsQueryParam.Get("showtype") %>"><span>登录记录</span></a></li>
            <li<%=KSCMS.S("showType")=="2"?" class='active'":string.Empty %>><a href="KS.User.aspx?showType=2&<%=UtilsQueryParam.Get("showtype") %>"><span>手机绑定记录</span></a></li>
                  <% if (BaseFun.CheckModulePower("edu"))
                      {%>
            <li<%=KSCMS.S("showType") == "6" ? " class='active'" : string.Empty %>><a href="KS.User.aspx?showType=6&<%=UtilsQueryParam.Get("showtype") %>"><span>学习进度</span></a></li>
            <li<%=KSCMS.S("showType") == "7" ? " class='active'" : string.Empty %>><a href="KS.User.aspx?showType=7&<%=UtilsQueryParam.Get("showtype") %>"><span>课程记录</span></a></li>
                <%} %>
        </ul>
    </div>
    <%if (string.IsNullOrEmpty(KSCMS.S("showtype")))
    { %>
     <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
   <%} %>

    <asp:Panel ID="UserPanel" runat="server" Visible="false">
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <asp:TextBox ID="TxtKeyWords" runat="server" CssClass="textbox"  placeholder="请输入订单编号"/>
                <asp:TextBox ID="TxtUserBeginDate" Width="160" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>至&nbsp;&nbsp;<asp:TextBox Width="160" ID="TxtUserEndDate" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>
                <asp:CheckBox ID="CkbSearchLike" runat="server" Text="模糊搜索" /><asp:Button ID="BtnSearchUser" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearchUser_Click" />
                
            </div>
            <input type="button" class="fr button" value="打印本页" onclick="PrintPage('PrintBox')" />
         </div>
        
         <div id="PrintBox">
          <asp:Repeater ID="RptUserList" runat="server" >
          <HeaderTemplate>
          <table width="99%" class="CTable"  border="0" cellpadding="1" cellspacing="1">
              <tr class="CTitle">
               <td align="center"><b>ID</b></td>
               <td align="center"><b>用户名</b></td>
               <td align="center"><b>用户组</b></td>
               <td align="center"><b>财富</b></td>
               <td align="center"><b>累计订单量</b></td>
               <td align="center"><b>累计金额(元)</b></td>
               <td align="center" nowrap><b>最近登录IP</b></td>
               <td align="center" nowrap><b>状态</b></td>
               <td align="center" nowrap><b>修改</b></td>
               <td align="center" nowrap><b>删除</b></td>
              </tr>
          </HeaderTemplate>
         <ItemTemplate>
           <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'" onclick="loadUserDetail(<%#Eval("UserID")%>,-1,1)">
                <td class="Ctd" style="text-align:center"> <%# Eval("UserID") %> </td>
                <td class="Ctd"> <%# Eval("UserName") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("GroupName") %> </td>
                <td class="Ctd" style="text-align:center"><a href='KS.LogMoney.aspx?username=<%#Eval("UserName") %>'><span style="color:Green"><%# Math.Round(Convert.ToDouble(Eval("money")),2).ToString() %></span> <%=MyCache.GetCurrencyUnit %></a>/
                <%if (MyCache.GetShopCommonConfig(98) == "1")
                    { %> <a href='KS.Consumer.aspx?username=<%#Eval("UserName") %>'><%#GetPointOrEdays(Utils.StrToInt(Eval("UserID")),Utils.StrToInt(Eval("chargetype")),Utils.StrToInt(Eval("point")),Utils.StrToInt(Eval("edays")),Convert.ToDateTime(Eval("begindate"))) %></a>/<%} %><a href='KS.LogScore.aspx?username=<%#Eval("UserName") %>' title="总积分<%# Eval("Score") %>分，已消费<%# Eval("ScoreHasUse") %>分，可用积分<%# Utils.StrToInt(Eval("Score"))-Utils.StrToInt(Eval("ScoreHasUse")) %>分"><span style="color:blue"><%# Eval("score") %></span>分</a></td>
                <td class="Ctd" style="text-align:center"> <%# DataFactory.GetOnlyValue("select count(1) From KS_ProOrder Where MoneyReceipt>0 and username='"+Eval("UserName")+"'") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Kesion.APPCode.Public.ReturnShopPrice(DataFactory.GetOnlyValue("select sum(NoUseCouponMoney) From KS_ProOrder Where MoneyReceipt>0 and username='"+Eval("UserName")+"'")) %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("LastLoginIP") %> </td>
                <td class="Ctd" style="text-align:center"> <%# ShowUserStatus(Utils.StrToInt(Eval("locked"))) %> </td>
                <td class="Ctd" style="text-align:center" onclick="doNone(event)"> <input type="button" class="button" value="修改" onclick="location.href='KS.UserAdd.aspx?userid=<%# Eval("userid")%>&agentid=<%=drr["userid"].ToString()%>';" /> </td>
                <td class="Ctd" style="text-align:center" onclick="doNone(event)"> <input type="button" class="button" value="删除" onclick="delUser(<%# Eval("UserID")%>,this)" /></td>             
              </tr>

             <tr id="s<%# Eval("userid") %>" style="display:none;">
                 <td colspan="20" id="ss<%# Eval("userid") %>" style="background:#F7FBFE"></td>
             </tr>
       </ItemTemplate>
             <FooterTemplate>
              <tr class="tdbg emptycss" style="display:<%# bool.Parse((RptUserList.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="12">
                  还没有任何的用户！
                </td>
               </tr> 
           </table>
          </FooterTemplate>
</asp:Repeater></div>
    </asp:Panel>

     <asp:Panel ID="ShopOrderPanel" runat="server" Visible="false">
         <div class="quickSearch clearfix">
            <div class="SearchBox fl">
             	<asp:TextBox ID="TxtOrderKeyWord" runat="server" CssClass="textbox" />
             	<asp:TextBox ID="TxtOrderBeginDate" Width="160" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>至&nbsp;&nbsp;<asp:TextBox Width="160" ID="TxtOrderEndDate" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>
            	<asp:CheckBox ID="CkbOrderLike" runat="server" Text="模糊搜索" /><asp:Button ID="Button2" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearchOrder_Click" />
            	
             </div>
             <input type="button" class="fr button" value="打印本页" onclick="PrintPage('PrintBox')" />
         </div>
         <div id="PrintBox">
          <asp:Repeater ID="RptShopOrder" runat="server" onitemdatabound="Repeater1_ItemDataBound">
          <HeaderTemplate>
          <table width="99%" class="CTable"  border="0" cellpadding="1" cellspacing="1">
              <tr class="CTitle">
               <td align="center"><b>采购时间</b></td>
               <td align="center"><b>订单编号</b></td>
               <td align="center"><b>用户名</b></td>
               <td align="center"><b>数量</b></td>
               <td align="center"><b>金额(元)</b></td>
              </tr>
          </HeaderTemplate>
         <ItemTemplate>
           <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'">
                <td class="Ctd" style="text-align:center"> <%# Eval("Inputtime") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("orderid") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("username") %> </td>
                <td class="Ctd" style="text-align:center"> <%# DataFactory.GetOnlyValue("select sum(num) From KS_ProOrderItem Where orderid='"+Eval("OrderID")+"'") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("NoUseCouponMoney"))) %> </td>
              </tr>
       </ItemTemplate>
             <FooterTemplate>
              <tr class="tdbg emptycss" style="display:<%# bool.Parse((RptShopOrder.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="12">
                  还没有任何的订单！
                </td>
               </tr> 
              <tr class="tdbg" style="display:<%# bool.Parse((RptShopOrder.Items.Count>0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:right" colspan="4">
                  本页合计：
                </td>
                  <td class="Ctd price-color" style="text-align:center; font-size:18px">
                      <%=MyCache.GetCurrencySymbol %><%=Kesion.APPCode.Public.ReturnShopPrice(pageTotalMoney) %>
                  </td>
               </tr> 
                 <tr class="tdbg" style="display:<%# bool.Parse((RptShopOrder.Items.Count>0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:right" colspan="4">
                  所有合计：
                </td>
                  <td class="Ctd price-color" style="text-align:center; font-size:18px">
                      <%=MyCache.GetCurrencySymbol %><%=Kesion.APPCode.Public.ReturnShopPrice(DataFactory.GetOnlyValue("Select Sum(NoUseCouponMoney) From KS_ProOrder o  inner JOIN  KS_User u on U.username=o.username"+param)) %>
                  </td>
               </tr> 
           </table>
          </FooterTemplate>
</asp:Repeater>
        </div>
     </asp:Panel>


     <asp:Panel ID="OrderPanel" runat="server" Visible="false">
         <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <asp:TextBox ID="TxtOrderRecordKey" runat="server" CssClass="textbox" />
                <asp:TextBox ID="TxtOrderRecordBeginDate" Width="160" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>至&nbsp;&nbsp;<asp:TextBox Width="160" ID="TxtOrderRecordEndDate" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"/>
                <asp:CheckBox ID="CkbOrderRecordLike" runat="server" Text="模糊搜索"/><asp:Button ID="Button3" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearchOrderRecord_Click" />
                
             </div>
             <input type="button" class="fr button" value="打印本页" onclick="PrintPage('PrintBox')" />
         </div>
         <div id="PrintBox">
          <asp:Repeater ID="RptOrderList" runat="server" onitemdatabound="Repeater1_ItemDataBound">
          <HeaderTemplate>
          <table width="99%" class="CTable"  border="0" cellpadding="1" cellspacing="1">
              <tr class="CTitle">
               <td align="center"><b>采购时间</b></td>
               <td align="center"><b>订单编号</b></td>
               <td align="center"><b>用户名</b></td>
               <td align="center"><b>数量</b></td>
               <td align="center"><b>金额(元)</b></td>
              </tr>
          </HeaderTemplate>
         <ItemTemplate>
           <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'">
                <td class="Ctd" style="text-align:center"> <%# Eval("Inputtime") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("orderid") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Eval("username") %> </td>
                <td class="Ctd" style="text-align:center"> <%# DataFactory.GetOnlyValue("select sum(num) From KS_ProOrderItem Where orderid='"+Eval("OrderID")+"'") %> </td>
                <td class="Ctd" style="text-align:center"> <%# Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("NoUseCouponMoney"))) %> </td>
              </tr>
       </ItemTemplate>
             <FooterTemplate>
              <tr class="tdbg emptycss" style="display:<%# bool.Parse((RptOrderList.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="12">
                  还没有任何的订单！
                </td>
               </tr> 
              <tr class="tdbg" style="display:<%# bool.Parse((RptOrderList.Items.Count>0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:right" colspan="4">
                  本页合计：
                </td>
                  <td class="Ctd price-color" style="text-align:center; font-size:18px">
                      <%=MyCache.GetCurrencySymbol %><%=Kesion.APPCode.Public.ReturnShopPrice(pageTotalMoney) %>
                  </td>
               </tr> 
                 <tr class="tdbg" style="display:<%# bool.Parse((RptOrderList.Items.Count>0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:right" colspan="4">
                  所有合计：
                </td>
                  <td class="Ctd price-color" style="text-align:center; font-size:18px">
                      <%=MyCache.GetCurrencySymbol %><%=Kesion.APPCode.Public.ReturnShopPrice(DataFactory.GetOnlyValue("Select Sum(NoUseCouponMoney) From KS_ProOrder "+param)) %>
                  </td>
               </tr> 
           </table>
          </FooterTemplate>
</asp:Repeater>
        </div>
     </asp:Panel>



    <asp:Panel ID="LogPanel" runat="server" Visible="false">
     <KS:KSGV ID="LoginLogView" runat="server" Width="99%" CssClass="CTable" PagerType="CustomNumeric" OnRowDataBound="List_RowDataBoundLog" AutoGenerateColumns="False" EmptyDataText="没用登录记录！" GridLines="None">
        <Columns>
            <asp:TemplateField HeaderText="登录设备">
             <itemstyle width="45px" HorizontalAlign="Center" />
             <itemtemplate>
               <span style="color:#999;"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("DeviceType"))) %></span>
             </itemtemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="username" HeaderText="用户名" />
            <asp:BoundField DataField="adddate" HeaderText="登录时间">
            <itemstyle width="120px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="UserIP" HeaderText="登录IP">
            <itemstyle width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="备注说明">
            <itemstyle HorizontalAlign="center" />
            <itemtemplate>
                <%# Eval("Remark") %>
            </itemtemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataRowStyle CssClass="emptycss" />
        <HeaderStyle CssClass="CTitle" />
    </KS:KSGV>
         <div class="message">
         <strong>特别提醒：</strong> 如果登录记录太多，影响了系统性能，可以删除一定时间段前的记录以加快速度。 
         <div>
         <strong>删除范围：</strong><asp:RadioButtonList ID="RdbDelType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
          <asp:ListItem Value="1">10天前</asp:ListItem>
          <asp:ListItem Value="2">1个月前</asp:ListItem>
          <asp:ListItem Value="3">2个月前</asp:ListItem>
          <asp:ListItem Value="4">3个月前</asp:ListItem>
          <asp:ListItem Value="5">6个月前</asp:ListItem>
          <asp:ListItem Value="6" Selected="True">1年前</asp:ListItem>
             </asp:RadioButtonList>
             <asp:Button ID="BtnDel" runat="server" Text="执行删除" OnClick="BtnDel_Click" CssClass="button" /></div>
         </div>
     </asp:Panel>

    <asp:Panel ID="LogMobilePanel" runat="server" Visible="false">
     <KS:KSGV ID="LogMobileView" runat="server" Width="99%" CssClass="CTable nlable" PagerType="CustomNumeric" OnRowDataBound="List_RowDataBoundMobileLog" AutoGenerateColumns="False" EmptyDataText="没有手机绑定记录！" GridLines="None">
        <Columns>
            <asp:TemplateField HeaderText="绑定设备">
                <itemstyle width="45px" HorizontalAlign="Center" />
                <itemtemplate>
                     <span style="color:#999;"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("DeviceType"))) %></span>
             </itemtemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="username" HeaderText="用户名" />
            <asp:BoundField DataField="adddate" HeaderText="绑定时间">
            <itemstyle width="120px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="UserIP" HeaderText="绑定时IP">
            <itemstyle width="100px" HorizontalAlign="Center" />
            </asp:BoundField>
            

            <asp:TemplateField HeaderText="绑定手机号">
            <itemstyle HorizontalAlign="center" />
            <itemtemplate>
                <%# Eval("mobile") %>
            </itemtemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataRowStyle CssClass="emptycss" />
        <HeaderStyle CssClass="CTitle" />
    </KS:KSGV>
         <div class="message">
         <strong>特别提醒：</strong> 如果手机绑定记录太多，影响了系统性能，可以删除一定时间段前的记录以加快速度。 
         <div>
         <strong>删除范围：</strong><asp:RadioButtonList ID="RdbMobileDelType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
          <asp:ListItem Value="1">10天前</asp:ListItem>
          <asp:ListItem Value="2">1个月前</asp:ListItem>
          <asp:ListItem Value="3">2个月前</asp:ListItem>
          <asp:ListItem Value="4">3个月前</asp:ListItem>
          <asp:ListItem Value="5">6个月前</asp:ListItem>
          <asp:ListItem Value="6" Selected="True">1年前</asp:ListItem>
             </asp:RadioButtonList>
             <asp:Button ID="Button1" runat="server" Text="执行删除" OnClick="BtnMobileDel_Click" CssClass="button" /></div>
         </div>
    </asp:Panel>
    <asp:Panel ID="LearnProgress" runat="server" Visible="false">
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <asp:TextBox ID="TxtCourseName" runat="server" CssClass="textbox"  placeholder="请输入课程名称"/>
                <asp:Button ID="SearchLearn" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearchLearn_Click" />
                
            </div>
            <input type="button" class="fr button" value="打印本页" onclick="PrintPage('ShowBox')" />
        </div>
        <div id="ShowBox">
            <asp:Repeater ID="LearnList" runat="server">
                <HeaderTemplate>
                    <table width="99%" class="CTable" border="0" cellpadding="1" cellspacing="1">
                        <tr class="CTitle">
                            <td align="center"><b>课程名称</b></td>
                            <td align="center"><b>课程类型</b></td>
                            <td align="center"><b>学习时间</b></td>
                            <td align="center"><b>学习进度</b></td>
                            <td align="center"><b>IP地址</b></td>
                            <td align="center"><b>学习设备</b></td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'">
                        <td class="Ctd" style="text-align: center;width:20%"><a href="<%# Kesion.HtmlTags.BasicField.GetCourseUrl(Utils.StrToInt(Eval("courseid")), Utils.StrToInt(Eval("teachway")))%>" target="_blank"><%# Eval("name") %> </td>
                        <td class="Ctd" style="text-align: center;"><%# Utils.StrToInt(Eval("teachway"))==5?"直播":"点播"%> </td>
                        <td class="Ctd" style="text-align: center;"><%# Eval("AddDate") %></td>
                        <td class="Ctd" style="text-align: center;height:40px"><%# GetSchedule(Utils.StrToInt(Eval("UserID")), Utils.StrToInt(Eval("CourseID"))) %></td>
                       <td class="Ctd" style="text-align: center"><%# Eval("LastLearnIP") %></td>
                        <td class="Ctd" style="text-align: center"><%# Utils.OrderDeviceName(Utils.StrToInt(Eval("LastLearnDevice").ToString())) %></td>

                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="tdbg emptycss" style="display: <%# bool.Parse((LearnList.Items.Count==0).ToString())?"":"none"%>">
                        <td class="Ctd" style="text-align: center" colspan="4">还没有任何的学习记录！</td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </div>
     </asp:Panel>
    <asp:Panel ID="UserCourse" runat="server" Visible="false">
        <div class="quickSearch clearfix">
            <div class="SearchBox fl">
                <asp:TextBox ID="CourseName" runat="server" placeholder="请输入课程名称" CssClass="textbox" />
                <asp:Button ID="SearchCourse" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearchCourse_Click" />
                
            </div>
            <input type="button" class="fr button" value="打印本页" onclick="PrintPage('ShowCourse')" />
        </div>
        <div id="ShowCourse">
            <asp:Repeater ID="CourseList" runat="server">
                <HeaderTemplate>
                    <table width="99%" class="CTable" border="0" cellpadding="1" cellspacing="1">
                        <tr class="CTitle">
                            <td align="center"><b>课程名称</b></td>
                            <td align="center"><b>课程类型</b></td>
                            <td align="center"><b>发布者</b></td>
                            <td align="center"><b>返现金额(元)</b></td>
                            <td align="center"><b>返现时间</b></td>
                            <td align="center"><b>单价(元)</b></td>
                            <td align="center"><b>折后价格(元)</b></td>
                            <td align="center"><b>资料价格(元)</b></td>
                            <td align="center"><b>税金(元)</b></td>
                            <td align="center"><b>总价(元)</b></td>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'">
                        <td class="splittd" align="left">
                            <img onerror="this.src='<%=MyCache.GetCacheShopConfig(9) %>';" src="<%#Eval("photourl") %>" width='50' height='50' align='left' />
                            <a href="<%#GetUrl(Utils.StrToInt(Eval("OrderType")),Utils.StrToInt(Eval("CourseID")),Utils.StrToInt(Eval("IsBundleSale"))) %>" target="_blank">《<%# Eval("Cname") %>》</a><br />
                            <span <%# Utils.StrToInt(Eval("ordertype"))== 1 ?"style='color:red'":"style='display:none'" %>>课时时限<%#Eval("shixian") %>天</span>
                        </td>
                        <td align="center" class="splittd" style="width: 250px; text-align: center"><%# GetCosType(Utils.StrToInt(Eval("OrderType")),Utils.StrToInt(Eval("IsBundleSale"))) %></td>
                        <td align="center" class="splittd" style="width: 100px; text-align: center"><%#Eval("business").ToString() %></td>
                        <td align="center" class="splittd" style="width: 100px;"><%# Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("PayDiscountMoney").ToString()))%></td>
                        <td align="center" class="splittd" style="width: 100px;"><%# Eval("EffectiveDay")%>天</td>
                        <td align="center" class="splittd" style="width: 100px;"><%#  Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("price")))%></td>
                        <td align="center" class="splittd"><%# Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("OrderTotalPrice")))%></td>
                        <td align="center" class="splittd"><%# Kesion.APPCode.Public.ReturnShopPrice(Eval("NotePrice"))%></td>
                        <td align="center" class="splittd"><%# Kesion.APPCode.Public.ReturnShopPrice(Eval("TaxPrice"))%></td>
                        <td align="center" class="splittd"><%# Kesion.APPCode.Public.ReturnShopPrice(Convert.ToString(Eval("TotalPrice")))%></td>
                    </tr>
                    <%#(Eval("IsBundleSale").ToString()=="1"?GetItem(Eval("orderid").ToString()):"") %>
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="tdbg emptycss" style="display: <%# bool.Parse((CourseList.Items.Count==0).ToString())?"":"none"%>">
                        <td class="Ctd" style="text-align: center" colspan="10">还没有报名任何的课程！</td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </div>
     </asp:Panel>
</asp:Panel>
     <%if (KSCMS.S("action") == "show" && string.IsNullOrEmpty(KSCMS.S("showtype"))){ } else {%>
 <KS:Page ID="Page1" runat="server" />
     <%} %>
</div>

</asp:Content>

