<%@ page title="" language="C#" masterpagefile="~/Admin/AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_MBF_UserGiftCardManage, WebApp_deploy" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CPHead" runat="Server">
    <style type="text/css">
        #tooltip
        {
            position: absolute;
            border: 1px solid #ccc;
            background: #333;
            padding: 2px;
            display: none;
            color: #fff;
        }
    </style>
    <script src="../Skin/CommStyle/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var x = 100;
            var y = 20;

            $("a.tooltip").mouseover(function (e) {
                this.myTitle = this.title;
                this.title = "";
                var imgsrc = $("img", this).attr("bigimg");
                var imgTitle = this.myTitle ? "<br/>" + this.myTitle : "";
                var tooltip = "<div id='tooltip'><img src='" + imgsrc + "' alt='预览图'/>" + imgTitle + "<\/div>"; //创建div
                $("body").append(tooltip); //把它追加到文档中
                x = $("#tooltip").width();
                $("#tooltip").css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX - x) + "px"
                }).show("fast");   //设置x坐标和y坐标，并且显示
            }).mouseout(function () {
                this.title = this.myTitle;
                $("#tooltip").remove();  //移除 
            }).mousemove(function (e) {
                $("#tooltip").css({
                    "top": (e.pageY + y) + "px",
                    "left": (e.pageX - x) + "px"
                });
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

        <table class="nick">
        <tr>
            <td colspan="4" class="tit" style="display: none">
                充值卡列表
            </td>
        </tr>
        <tr>
            <td class="normal">
                礼品卡类别：<asp:DropDownList ID="DropType" 
                    runat="server" AutoPostBack="true" 
                    onselectedindexchanged="Query_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
            <td class="normal">
                面值：<asp:TextBox ID="txtFaceValueQuery" runat="server" 
                    Width="80px" ontextchanged="Query_SelectedIndexChanged" AutoPostBack="true"></asp:TextBox>
            </td>
            <td class="normal">
                购买者：<asp:TextBox ID="txtPurchaseUserNameQuery" runat="server" 
                    Width="80px" ontextchanged="Query_SelectedIndexChanged" AutoPostBack="true"></asp:TextBox>
            </td>
            <td class="normal">
                状态<asp:DropDownList ID="ddl_state" runat="server" 
                    onselectedindexchanged="Query_SelectedIndexChanged" AutoPostBack="true">
                <asp:ListItem Value="" Text="全部"></asp:ListItem>
                <asp:ListItem Value="1" Text="有余额"></asp:ListItem>
                <asp:ListItem Value="0" Text="无余额"></asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="normal">
                购买日期：<asp:TextBox runat="server" 
                    ID="begindate" Width="75px" Height="16px" AutoPostBack="true" 
                    ontextchanged="Query_SelectedIndexChanged" />
                至
                <asp:TextBox runat="server" ID="EndDate" Width="75px" Height="16px" 
                    AutoPostBack="true" ontextchanged="Query_SelectedIndexChanged" />
            </td>
            <td class="normal">
                <asp:Button ID="Button1" runat="server" Text="查询" CausesValidation="false" OnClick="Button1_OnClick" />
            </td>
        </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" CssClass="adminlist" AutoGenerateColumns="False"
        DataKeyNames="CardNumber" OnDataBound="GridView1_DataBound">
                <Columns>
            <asp:BoundField ReadOnly="True" DataField="rowid" HeaderText="序号" ItemStyle-Width="60px">
            </asp:BoundField>
            <asp:BoundField ReadOnly="True" DataField="CardNumber" HeaderText="卡号" ItemStyle-Width="220px">
            </asp:BoundField>
            <asp:TemplateField HeaderText="密码" ItemStyle-Width="120px">
                <ItemTemplate>
                    <asp:Label ID="Password" runat="server" Text='<%#DisplayPwd(Eval("Password"),Eval("BuyID"),Eval("RecieveID")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="节日" ItemStyle-Width="160px">
                <ItemTemplate>
                    <asp:Label ID="FestivalName" runat="server" Text='<%#Eval("FestivalName") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="购买日期" ItemStyle-Width="160px">
                <ItemTemplate>
                    <asp:Label ID="BuyTime" runat="server" Text='<%#Eval("BuyTime") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="FaceValue" DataFormatString="{0:F2}" HeaderText="面值" ItemStyle-Width="100px"></asp:BoundField>
            <asp:BoundField DataField="Balance" DataFormatString="{0:F2}" HeaderText="余额" ItemStyle-Width="100px"></asp:BoundField>
            <asp:BoundField ReadOnly="True" DataFormatString="{0:F2}" DataField="CouponAmount" HeaderText="已奖励" ItemStyle-Width="80px">
            </asp:BoundField>
            <asp:TemplateField HeaderText="购买者" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Label ID="BuyName" runat="server" Text='<%#GetUserName(Eval("BuyID")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="接收者" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Label ID="RecieveName" runat="server" Text='<%#GetUserName(Eval("RecieveID")) %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ReceiveEmail" HeaderText="接收者邮箱" ItemStyle-Width="140px">
            </asp:BoundField>
            <asp:TemplateField HeaderText="卡片" ItemStyle-Width="50px">
                <ItemTemplate>
                    <a href="javascript:void(0);" class="tooltip" title='礼品卡图片'>
                        <img alt='卡对应的图片' bigimg='../UpLoadFile/VIPCardPic/<%#Eval("Picture")%>' src='../UpLoadFile/VIPCardPic/<%#Eval("Picture")%>'
                            style="width: 20px; height: 15px" /></a>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>

        <EmptyDataTemplate>
            <table class="adminlist">
                <tr>
                    <td colspan="9">
                        暂无礼品卡!
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
    </asp:GridView>
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server">
        </webdiyer:AspNetPager>
    </div>
    <div class="div_btm">
    </div>
    <div class="help_intro">
        <h1>
            帮助说明：</h1>
        <ul style="margin: 0; padding: 0; text-align: left; line-height: 20px">
            <li>礼品卡是用户自助购买的，后台只提供查询功能</li>
        </ul>
    </div>
</asp:Content>
