<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_LogSms"  Title="查看短信发送记录" Codebehind="KS.LogSms.aspx.cs" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Publics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">

    <asp:Panel ID="Panel1" runat="server">
        <div class="listedit">
          <ul>
            <asp:LinkButton ID="delall" runat="server" OnClick="LinkButton1_Click" OnClientClick="return(confirm('此操作不可逆，确定删除全部短信发送记录吗?'))" CssClass="button">删除全部</asp:LinkButton>
            <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="return(confirm('此操作不可逆，确定删除选中的短信发送记录吗?'))" OnClick="Button2_Click" CssClass="button">删除选中</asp:LinkButton>
          </ul>
        </div>     
         <div class="content-area mt20">
         <div class="myTitle">
         	<span class="fr">
                <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click1" CssClass="button mr20">导出到Excel</asp:LinkButton>
                <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click" CssClass="button mr20">发送手机短信</asp:LinkButton>
            </span>
         	手机短信发送管理
         </div>
         <div class="quickSearch clearfix">
             <div class="SearchBox fl">
                 <asp:TextBox ID="TxtKeyWord" runat="server" CssClass="textbox" Width="200px" />
                 <asp:DropDownList ID="DrpSearchType" runat="server" style="margin-right:8px;">
                     <asp:ListItem Value="0">手机号码</asp:ListItem>
                     <asp:ListItem Value="1">发送内容</asp:ListItem>
                     <asp:ListItem Value="2">IP地址</asp:ListItem>
                 </asp:DropDownList>
                 <asp:RadioButtonList ID="RdbStatus" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                      <asp:ListItem Value="0" Selected="True">所有</asp:ListItem>
                      <asp:ListItem Value="1">成功</asp:ListItem>
                      <asp:ListItem Value="2">失败</asp:ListItem>
                 </asp:RadioButtonList>
                 <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text="开始搜索" OnClick="BtnSearch_Click" />
             </div>
          </div>
        <KS:KSGV ID="LogListView"  cssclass="CTable" runat="server" AutoGenerateColumns="False" EmptyDataText="暂无手机短消息发送记录！"
            OnRowDataBound="LogListView_RowDataBound" Width="100%" GridLines="None"  DataKeyNames="id">
            <Columns>
                <asp:TemplateField HeaderText="<input type='checkbox' name='chkall' id='chkall' onclick='CheckAll(this.form);'/>">
                <ItemStyle HorizontalAlign="Center"  Width="30"/>
                <ItemTemplate>
                <input type="checkbox"  name="ids" value="<%#Eval("id") %>" />
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="用户">
                <itemstyle horizontalalign="Center" />
                <itemtemplate>
                   <%# string.IsNullOrEmpty(Convert.ToString(Eval("username")))?"-":Eval("username") %>
                </itemtemplate>
            </asp:TemplateField>
                <asp:BoundField DataField="UserIP" HeaderText="操作IP">
                 <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:BoundField DataField="adddate" HeaderText="发送时间">
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="mobile" HeaderText="接收手机">
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                 <asp:TemplateField HeaderText="状态">
                <itemstyle horizontalalign="center" Height="30px"/>
                <itemtemplate>
                   <%# Eval("IsSuccess").ToString().Equals("1")?"<span style='color:green'>成功</span>":"<span style='color:red'>失败</span>" %>
                </itemtemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="发送内容">
                <itemstyle horizontalalign="Left" Height="30px"/>
                <itemtemplate>
                    <span class="tips"><%# Eval("content") %></span>
                </itemtemplate>
            </asp:TemplateField>
                 <asp:TemplateField HeaderText="返回信息">
                <itemstyle horizontalalign="Left"/>
                <itemtemplate>
                    <span class="tips"><%# Kesion.Publics.Utils.ClearHtml(Convert.ToString(Eval("remark"))) %></span>
                </itemtemplate>
            </asp:TemplateField>
             
            </Columns>
            <HeaderStyle CssClass="CTitle" />
            <EmptyDataRowStyle CssClass="emptycss" />
           
        </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="执行删除"  CssClass="button button_on" OnClick="BtnDel_Click" />
         </div>
     </div>

     <KS:Page ID="Page1" runat="server" />
     </asp:Panel>
</div>
    <asp:Panel ID="Panel2" runat="server" Visible="false">
<div class="content-area mt20">    
     <div class="myTitle"><a href='KS.LogSms.aspx' class="fr button mr20">返回</a>发送手机短消息</div>
     <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 146px"><b>收件人选择：</b></td>
            <td class="righttd">
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide();" value="1"<%=string.IsNullOrEmpty(KSCMS.S("userid"))?" checked":"" %> />所有会员(<span style="color:red"><%=DataFactoryUser.GetOnlyValue("select count(1) From KS_User") %></span>位)<br />
                <input type="radio" name="optype" onclick="jQuery('#grouparea').show();" value="2" />指定会员组
                <br />
                <div id="grouparea" style="display:none">
                <%=BaseFun.GetUserGroup_CheckBox("groupid",4,"0") %>
                </div>
                 <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#departarea').show(); jQuery('#classinfo').hide(); " value="5" />指定部门<br />
                <div id="departarea" style="display:none">
                    <select name="departid">
                    <%=BaseFun.GetSQLOption("select DepartID,DepartMentName from KS_UserDepartment ","0") %>
                    </select>
                </div>
                <%if (BaseFun.CheckModulePower("edu")) { %>
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide(); jQuery('#classinfo').show(); jQuery('#departarea').hide();"  value="6" />指定班级<br />
                <div id="classinfo" style="display:none">
                    <select name="classroomid">
                    <%=BaseFun.GetSQLOption("select RoomID,Title from KS_CosClassRoom ","0") %>
                    </select>
                </div>
                <%} %>
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide();" value="4"<%=!string.IsNullOrEmpty(KSCMS.S("userid"))?" checked":"" %> />指定用户名
                <asp:TextBox ID="TxtToUserName" runat="server" CssClass="textbox" Width="246px" /><span class="tips">多个用户名间请用<font color="#0000ff">英文的逗号</font>分隔</span><div style="height:10px"></div>
                <input type="radio" name="optype" onclick="jQuery('#grouparea').hide();" value="3" />指定手机号码<asp:TextBox ID="ToMobile" runat="server"
                    Width="246px" CssClass="textbox"></asp:TextBox><span class="tips">多个手机号间请用<font color="#0000ff">英文的逗号</font>分隔</span></td>
          </tr>

         <tr>
             <td align="right" class="lefttd" height="30" style="width: 146px">
                 <strong>发送内容：</strong>

                 <div class="tips">
                 <strong>可用标签：</strong><br />
                 {$UserName} -用户名<br />
                 {$RealName} -姓名<br />
                 {$Sex} -先生或是女士<br />
                 {$SiteName} -网站名称<br />
                 {$SendTime} -发送时间<br />
                 {$SendDate} -发送日期<br />
                 </div>
             </td>
             <td class="righttd">
                 <asp:TextBox ID="Content" TextMode="multiLine" style="width:95%;height:250px;" runat="server">您好{$UserName}!  新年快乐！{$SiteName}贺!
                 </asp:TextBox>
                 <br />
                 <span class="tips">TIPS:建议不超过66个字符,请确保您的短信账号余额充足！！！</span>
                 

             </td>
         </tr>
         
        </table>
    <br />
    <KS:Foot ID="Foot1" runat="server" SubmitButtonText="开始发送(0)" OnSubmit="Foot1_Submit" />
    </asp:Panel>
 
</div>

</asp:Content>
