<%@ Page Language="C#" EnableEventValidation="false"  MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.User.Admin_UserVIPCard" Title="VIP账号卡" Codebehind="KS.UserVIPCard.aspx.cs" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="Kesion.Cache" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
    <asp:Panel ID="VIPCardList" runat="server" Width="100%">
         <div class="content-area mt20">
               <div class="myTitle">
                   <asp:LinkButton ID="addVIPCard" runat="server" OnClick="addVIPCard_Click" CssClass="fr button button_on mr20">添加VIP卡</asp:LinkButton>
                  会员实体卡管理
                   </div>
               <KS:KSGV ID="list" cssclass="CTable" runat="server" AutoGenerateColumns="False" Width="99%" EmptyDataText="没有添加任何会员实体卡!" GridLines="None" OnRowDataBound="list_RowDataBound" OnRowCommand="list_RowCommand" OnRowCreated="list_RowCreated" >
                  <Columns>
                     <asp:TemplateField HeaderText="选择">
                         <itemstyle horizontalalign="Center" width="30px" />
                         <itemtemplate>
                             <input type="checkbox"  name="ids" id="ids" value='<%#Eval("VipCardID") %>' />
                         </itemtemplate>
                     </asp:TemplateField>
                     
                     <asp:TemplateField HeaderText="会员卡名称">
                         <itemtemplate>
                            <%# Eval("cardname") %> 
                         </itemtemplate>
                     </asp:TemplateField> 
                     <asp:TemplateField HeaderText="激活自动成为分销商">
                         <itemstyle horizontalalign="Center" width="100px" />
                         <itemtemplate>
                            <span style="color:#666"><%# Eval("autoCreateFXS").ToString()=="1"?"是":"否" %></span>  
                         </itemtemplate>
                     </asp:TemplateField>
                      <asp:TemplateField HeaderText="赠送VIP天数">
                         <itemstyle width="60px" horizontalalign="Center" />
                         <itemtemplate>
                            <%# Eval("VipDays") %>天
                         </itemtemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="有效期">
                         <itemstyle horizontalalign="Center" width="230px" />
                         <itemtemplate>
                             <%# GetExpireDate(Convert.ToString(Eval("BeginDate")),Convert.ToString(Eval("EndDate")))%>
                         </itemtemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="面值">
                        <itemstyle horizontalalign="Center" width="150px" />
                        <itemtemplate>
                        <%=MyCache.GetCurrencySymbol%><%# Public.ReturnShopPrice(Utils.StrToDecimal(Eval("FaceValue")))%>
                        </itemtemplate>
                     </asp:TemplateField> 
                     <asp:TemplateField HeaderText="状态">
                         <itemstyle width="30px" horizontalalign="Center"/>
                         <itemtemplate>
                             <a href="?action=status&VipCardID=<%#Eval("VipCardID")%>" <%# Convert.ToString(Eval("status"))=="0"?"class='redFont' title='停用'":"class='greenFont' title='正常'" %>><%# Convert.ToString(Eval("status"))=="0"?"停用":"正常" %></a>
                         </itemtemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="发放数量">
                         <itemstyle horizontalalign="Center" width="200px" />
                         <itemtemplate>
                          <span style="color:Red"> <%# DataFactory.GetOnlyValue("SELECT COUNT(1) FROM KS_User Where VipCardID="+Eval("VipCardID")) %></span> 张        
                          <a href='KS.UserVIPCardItem.aspx?VipCardID=<%# Eval("VipCardID") %>' class="greenFont">(查看)</a>
                         </itemtemplate>
                     </asp:TemplateField>
                    
                     <asp:TemplateField HeaderText="生成">
                         <itemstyle width="160px" horizontalalign="Center" />
                         <itemtemplate>
                             <asp:LinkButton ID="pubBtn1" runat="server" CommandArgument=<%#Eval("VipCardID") %>  CommandName="make" CssClass="greenFont">生成</asp:LinkButton>
                         </itemtemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="编辑">
                         <itemstyle width="30px" CssClass="Ctd" horizontalalign="Center"/>
                         <itemtemplate>
                             <asp:LinkButton ID="LinkButton1" ToolTip="编辑" CssClass="edit" runat="server" commandargument=<%#Eval("VipCardID") %> commandname="modify"></asp:LinkButton>
                         </itemtemplate>
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="删除">
                         <itemstyle width="30px" horizontalalign="Center"/>
                         <itemtemplate>
                             <asp:LinkButton runat="server" id="delete" ToolTip="删除" CssClass="delete" commandargument=<%#Eval("VipCardID") %> commandname="del"></asp:LinkButton>
                         </itemtemplate>
                     </asp:TemplateField>
                     
                  </Columns>
                  <HeaderStyle CssClass="CTitle" />
                  <EmptyDataRowStyle CssClass="emptycss" />
              </KS:KSGV>
              <asp:Panel ID="Panel1" runat="server" Height="30px" Width="741px">
                  <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="if (GetIDS('del')){this.form.action='?action=del';this.form.submit()}" id="Button1" />
                    <asp:LinkButton ID="editVIPCard" runat="server" OnClick="editVIPCard_Click" CssClass="button">编辑会员实体卡</asp:LinkButton>                  
                  </div>
              </asp:Panel>  
              <KS:Page ID="Page1" runat="server" />
         </div>
    </asp:Panel>
    <asp:Panel ID="VIPCardManage" runat="server" Width="100%" Visible="false">

  <div class="content-area mt20">        
        <div class="myTitle">添加会员实体卡</div>
         <table width="99%"  border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px"><strong>会员实体卡名称：</strong></td>
                <td class="righttd">&nbsp;<asp:TextBox ID="TxtCardName" runat="server" CssClass="textbox"></asp:TextBox>
                    如:半年VIP学习卡等 
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtCardName" ErrorMessage="请输入会员实体卡名称!"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                 <strong>使用起始日期：</strong>
                </td>
                <td class="righttd">&nbsp;<asp:TextBox  CssClass="textbox Wdate" ID="TxtBeginDate" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"></asp:TextBox> 至 <asp:TextBox  CssClass="textbox Wdate" ID="TxtEndDate" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"></asp:TextBox>&nbsp;
                    说明过了这个期限不能再使用</td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                    <strong>封面：</strong></td>
                <td class="righttd"><table cellspacing="0" cellpadding="0"><tr><td>&nbsp;<asp:TextBox ID="TxtDefaultPic" runat="server" CssClass="textbox" Width="480px"></asp:TextBox>
                    &nbsp;<input type="button" class="button" onclick="SelectFiles('<%=this.TxtDefaultPic.ClientID %>',0);" value="选择图片"></td>
                            <%if (Kesion.BLL.KSSecurity.CheckCommonUploadPower()){ %>
                            <td style="padding-left:4px;padding-top:15px; vertical-align:middle; *padding-top:12px;"> <%=Kesion.APPCode.UploadAPI.EchoUpload("classpic",this.TxtDefaultPic.ClientID,150) %></td>
                            <%} %>
                            <td><img id="show<%=TxtDefaultPic.ClientID %>" src="<%=TxtDefaultPic.Text %>" width="60" height="60" style="border:1px solid #f1f1f1;" onerror="this.src='../../sysimg/nopic.gif'"/></td>
                          </tr></table>
                </td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px"><strong>描述：</strong></td>
                <td class="righttd">
                    &nbsp;<asp:TextBox ID="TxtIntro" runat="server" Height="96px" TextMode="MultiLine" Width="481px"></asp:TextBox></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                    <strong>对外销售价：</strong></td>
                <td class="righttd">&nbsp;<asp:TextBox  CssClass="textbox" ID="TxtFaceValue" Text="10" runat="server" Width="70px"></asp:TextBox>元<span style="color: #ff0000">* 会员卡对外的销售价格。</span></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                    <strong>赠送VIP天数：</strong></td>
                <td class="righttd">&nbsp;<asp:TextBox  CssClass="textbox" ID="TxtVIPDays" Text="30" runat="server" Width="70px"></asp:TextBox>天 <span style="color: #ff0000">*设置为0表示不赠送。</span></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                    <strong><span style="background-color: #f0f9fe">登录激活是否自动成为分销商</span>：</strong></td>
                <td class="righttd">
                    <asp:RadioButtonList ID="RdbAutoCreateFXS" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True" >否</asp:ListItem>
                        <asp:ListItem Value="1">是</asp:ListItem>
                    </asp:RadioButtonList></td>
            </tr>
              <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                    <strong><span style="background-color: #f0f9fe">首次登录强制要求录入推荐人UserId</span>：</strong></td>
                <td class="righttd">
                    <asp:RadioButtonList ID="RdbMustInputRecommender" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True" >否</asp:ListItem>
                        <asp:ListItem Value="1">是</asp:ListItem>
                    </asp:RadioButtonList></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 198px">
                <strong>状态：</strong>
                </td>
                <td class="righttd">
                <asp:RadioButtonList ID="RdbStatus" runat="server" RepeatDirection="horizontal">
                 <asp:ListItem Value="1" Selected="true">正常</asp:ListItem>
                 <asp:ListItem Value="0">停用</asp:ListItem>
                </asp:RadioButtonList>
                </td>
            </tr>
            
        </table>
      <br />
      <KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
        <script type="text/javascript">
            showtips('<span class="state"><strong>说明：</strong><br /></span>会员实体卡发放后,建议尽量不要再修改会员实体卡信息如面值、VIP天数等参数!');
	</script>
          
    </asp:Panel>
  </div>  
    
</asp:Content>

