<%@ page language="C#" autoeventwireup="true" inherits="HL_Admin_Admin_ModifyCard, HoWaveVGO" enableEventValidation="false" %>

<!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 runat="server">
    <title>修改充值卡</title>
     <base target="_self"></base>
     <script type="text/javascript" src="Js/getdate.js"></script>
      <link href="Css/template_css.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">
function ShowCardType(ObjValue)
{
   var index=parseInt(ObjValue);  
   var AutoObj=document.getElementById("AutoBat");
   var Single1=document.getElementById("Single1");
   var Single2=document.getElementById("Single2");
   if(index==2)
   {
      AutoObj.style.display="";
      Single1.style.display="none";
      Single2.style.display="none";
   }
   else
   {
       AutoObj.style.display="none";
       Single1.style.display="";
       Single2.style.display="";
   }
}
</script> 
<style type="text/css">
.nick tr th{
    width:25%;
    text-align:right;
}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" DefaultMode="Edit" 
       OnItemUpdated="FormView1_ItemUpdated" DataKeyNames="CardID" OnDataBound="FormView1_DataBound" Width="100%" OnItemInserted="FormView1_ItemInserted">
           <EditItemTemplate>
               <table  class="nick">
                  <tr>
                      <th>充值卡类型：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="CardType" runat="server" SelectedValue='<%# Bind("CardType") %>'>
                             <asp:ListItem Text="本站充值" Value="1" Selected="True" />
                             <asp:ListItem Text="其它充值卡" Value="2" />
                          </asp:DropDownList>   
                       </td>
                  </tr>                             
                   <tr>
                      <th>充值卡卡号：</th>
                      <td class="rtd"> 
                         <asp:TextBox ID="CardNum" runat="server"  Text='<%# Eval("CardNum") %>'  Width="200" ReadOnly="true" BackColor="#CCCCCC"/>
                        
                      </td>
                  </tr>
                   <tr>
                      <th>充值卡密码：</th>
                      <td class="rtd">
                         <asp:TextBox ID="CardPassword" Text='<%# Bind("CardPassword") %>' runat="server" CssClass="unwatermarked"/>
                         <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                               ControlToValidate="CardPassword" ErrorMessage="充值卡密码不能为空"/>
                      </td>
                   </tr>
                   <tr>
                      <th>充值卡面值：</th>
                      <td class="rtd">
                         <asp:TextBox ID="CardValue" Text='<%# Bind("CardMoney") %>' runat="server" />
                          <div style="float:left; position:absolute;"><asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="CardValue"
                              ErrorMessage="充值卡的面值必须为大于０的整数" MaximumValue="999999999" MinimumValue="1" Type="Integer"/>
                          </div><div style="float:left; position:absolute;"><asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
                               ControlToValidate="CardValue" ErrorMessage="充值卡面值不能为空"/></div>  
                      </td>
                  </tr> 
                   <tr>
                      <th>充值卡截止日期：</th>
                      <td class="rtd">
                          <asp:TextBox ID="CardEndDate" runat="server" Text='<%# Bind("CardEndDate") %>'/></td>
                  </tr>
                  <tr>
                      <th>充值卡单位：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("CardValidUnit") %>'>
                             <asp:ListItem Text="元" Value="元" Selected="True" />
                             <asp:ListItem Text="点" Value="点" />
                          </asp:DropDownList>                                      
                      </td>
                  </tr>
                   <tr>
                      <th>购买人得到通行币：</th>
                      <td class="rtd">
                          <asp:TextBox ID="CardCoin" runat="server" Text='<%# Bind("CardValidNum") %>'/>
                          <asp:RangeValidator id="rv2" runat="server" Type="Integer" MinimumValue="0" MaximumValue="999999" ControlToValidate="CardCoin" ErrorMessage="购买人得到通行币不能小于0" Display="Dynamic"/>
                      </td>
                  </tr>
                 
                  <tr style="display:none;">
                      <th>代理商：</th>
                      <td class="rtd">
                          <asp:TextBox ID="CardAgent" runat="server" Text='<%# Bind("CardAgentName") %>'/>
                      </td>
                  </tr>
                  <tr>
                      <td colspan="2" style="text-align:center;"> 
                      <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                          Text="更新" /> 
                      <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="window.close()" CausesValidation="False" CommandName="Cancel"
                          Text="取消" />
                       </td>
                  </tr>                              
               </table>
              </EditItemTemplate>
             <InsertItemTemplate>
              <table class="nick" width="100%">            
                 <tr>
                    <th>充值卡类型：</th>
                    <td class="rtd"  style="width:70%">
                        <asp:DropDownList id="CardType" runat="server"  SelectedValue='<%# Bind("CardType") %>'>
                          <asp:ListItem Text="本站充值" Value="1" Selected="true" />
                          <asp:ListItem Text="其它充值卡" Value="2" />
                        </asp:DropDownList>
                    </td>
                 </tr>
                 <tr>
                    <th>生成充值卡类型：</th>
                    <td class="rtd">
                        <asp:DropDownList id="CreateCardType" runat="server"  SelectedValue='<%# Bind("CreateCardType") %>'>
                             <asp:ListItem Text="单张" Value="1" Selected="true" />
                             <asp:ListItem Text="批量" Value="2" />
                          </asp:DropDownList>
                    </td>
                 </tr>
                 <tr id="AutoBat" style="display:none;">
                    <th>生成充值卡数量：</th>
                    <td class="rtd">
                       <asp:TextBox id="CardQuantity" runat="server" Text='<%# Bind("CardQuantity") %>' />
                        <asp:RangeValidator id="rv3" runat="server" Type="Integer" MinimumValue="1" MaximumValue="999999" ControlToValidate="CardQuantity" ErrorMessage="生成充值卡数量必须为大于０的整数" Display="Dynamic"/>
                        <asp:RequiredFieldValidator id="rfv1" runat="server"  ControlToValidate="CardQuantity" ErrorMessage="生成充值卡数量不能为空" Display="Dynamic"/></td>
                 </tr>
                 <tr id="Single1">
                     <th>充值卡卡号：</th>
                     <td class="rtd"><asp:TextBox id="CardNum" runat="server" Text='<%# Bind("CardNum") %>' Width="200" />
                        <asp:RequiredFieldValidator id="rfv2" runat="server"  ControlToValidate="CardNum" ErrorMessage="充值卡卡号不能为空" Display="Dynamic"/> 
                     </td>
                 </tr>
                 <tr id="Single2">
                      <th>充值卡密码：</th>
                      <td class="rtd"><asp:TextBox id="CardPassword" runat="server" Text='<%# Bind("CardPassword") %>'/>
                        <asp:RequiredFieldValidator id="rfv3" runat="server" ControlToValidate="CardPassword" ErrorMessage="充值卡密码不能为空" Display="Dynamic"/> 
                      </td>
                 </tr>
                 <tr>
                     <th>充值卡面值：</th>
                     <td class="rtd"><asp:TextBox id="CardValue" runat="server" Text='<%# Bind("CardMoney") %>' /> 
                        <asp:RequiredFieldValidator id="rfv4" runat="server" ControlToValidate="CardValue" ErrorMessage="充值卡面值不能为空" Display="Dynamic"/> 
                        <asp:RangeValidator id="rv1" runat="server" Type="Integer" MinimumValue="1" MaximumValue="999999" ControlToValidate="CardValue" ErrorMessage="充值卡的面值必须为大于０的整数" Display="Dynamic"/>
                     </td>
                 </tr>
                 <tr>
                    <th>充值卡截止日期：</th>
                    <td class="rtd">
                        <asp:TextBox id="CardEndDate" runat="server" Text='<%# Bind("CardEndDate") %>'/>
                    </td>
                 </tr>
                 <tr>
                     <th>充值卡单位：</th>
                     <td class="rtd">
                          <asp:DropDownList id="DropDownList1" runat="server"  SelectedValue='<%# Bind("CardValidUnit") %>'>
                             <asp:ListItem Text="元" Value="元" Selected="true" />
                             <asp:ListItem Text="点" Value="点" />
                          </asp:DropDownList> 
                     </td>
                 </tr>
                 <tr>
                      <th>购买人得到通行币：</th>
                      <td class="rtd">
                           <asp:TextBox id="CardCoin" runat="server" Text='<%# Bind("CardValidNum") %>'/>
                            <asp:RangeValidator id="rv2" runat="server" Type="Integer" MinimumValue="0" MaximumValue="999999" ControlToValidate="CardCoin" ErrorMessage="购买人得到通行币不能小于0" Display="Dynamic"/>
                      </td>
                </tr>
                
                <tr style="display:none;">
                   <th>代理商：</th>
                   <td class="rtd">
                       <asp:TextBox id="CardAgent" runat="server" Text='<%# Bind("CardAgentName") %>'/>
                   </td>
               </tr>
               <tr>
                  <td colSpan="2" style="text-align:center;">
                     <asp:LinkButton id="InsertButton"  runat="server" CausesValidation="true" Text="插入" CommandName="Insert"/>
                     <asp:LinkButton id="CancleButton" runat="server" OnClientClick="window.close()" CausesValidation="False" Text="取消" CommandName="Cancel"/>
                  </td>
               </tr>
              </table>        
           </InsertItemTemplate>
           <ItemTemplate>
               <table  class="nick">
                  <tr>
                      <th>充值卡类型：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="CardType" runat="server" SelectedValue='<%# Bind("CardType") %>'>
                             <asp:ListItem Text="本站充值" Value="1" Selected="True" />
                             <asp:ListItem Text="其它充值卡" Value="2" />
                          </asp:DropDownList>   
                       </td>
                  </tr>                             
                   <tr>
                      <th>充值卡卡号：</th>
                      <td class="rtd"> 
                         <asp:TextBox ID="CardNum" runat="server"  Text='<%# Eval("CardNum") %>'  Width="200" ReadOnly="true" BackColor="#CCCCCC"/>
                        
                      </td>
                  </tr>
                   <tr>
                      <th>充值卡密码：</th>
                      <td class="rtd">
                         <asp:TextBox ID="CardPassword" Text='<%# Bind("CardPassword") %>' runat="server" CssClass="unwatermarked"/>
                      </td>
                   </tr>
                   <tr>
                      <th>充值卡面值：</th>
                      <td class="rtd">
                         <asp:Label ID="CardValue" Text='<%# Bind("CardMoney") %>' runat="server" />
                          
                      </td>
                  </tr> 
                   <tr>
                      <th>充值卡截止日期：</th>
                      <td class="rtd">
                          <asp:TextBox ID="CardEndDate" runat="server" Text='<%# Bind("CardEndDate") %>'/></td>
                  </tr>
                  <tr>
                      <th>充值卡单位：</th>
                      <td class="rtd">
                          <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("CardValidUnit") %>'>
                             <asp:ListItem Text="元" Value="元" Selected="True" />
                             <asp:ListItem Text="点" Value="点" />
                          </asp:DropDownList>                                      
                      </td>
                  </tr>
                   <tr>
                      <th>购买人得到通行币：</th>
                      <td class="rtd">
                          <asp:Label ID="CardCoin" runat="server" Text='<%# Bind("CardValidNum") %>'/>
                          
                      </td>
                  </tr>
                 
                  <tr style="display:none;">
                      <th>代理商：</th>
                      <td class="rtd">
                          <asp:TextBox ID="CardAgent" runat="server" Text='<%# Bind("CardAgentName") %>'/>
                      </td>
                  </tr>
                  <tr>
                      <td colspan="2" style="text-align:center;">
                      <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="window.close()" CausesValidation="False"
                          Text="关闭" />
                       </td>
                  </tr>                              
               </table>
              </ItemTemplate>
       </asp:FormView> 
       <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  SelectMethod="GetCardByCardID" TypeName="CardBLL" UpdateMethod="UpdateCard" OnInit="ObjectDataSource1_Init"   InsertMethod="AddCard">           
             <UpdateParameters>
                 <asp:Parameter Name="CardNum" Type="String" />
                 <asp:Parameter Name="CardPassword" Type="String" />
                 <asp:Parameter Name="CardType" Type="Int32" />
                 <asp:Parameter Name="CardAgentName" Type="String" />
                 <asp:Parameter Name="CardValidNum" Type="String" />
                 <asp:Parameter Name="CardMoney" Type="Decimal" />
                 <asp:Parameter Name="CardValidUnit" Type="String" />
                 <asp:Parameter Name="CardEndDate" Type="DateTime" />
                 <asp:Parameter Name="CardCreateTime" Type="DateTime" />
                 <asp:Parameter Name="CardUseTime" Type="DateTime" />
                 <asp:Parameter Name="CardSellFrom" Type="String" />
                 <asp:Parameter Name="CardID" Type="Int32" />
             </UpdateParameters>            
           <SelectParameters>
               <asp:QueryStringParameter Name="CardID" QueryStringField="CardID" Type="Int32" />
           </SelectParameters>
            <InsertParameters>
                 <asp:Parameter Name="CreateCardType" Type="Int32" />
                 <asp:Parameter Name="CardQuantity" Type="Int32" />
                 <asp:Parameter Name="CardNum" Type="String" />
                 <asp:Parameter Name="CardPassword" Type="String" />
                 <asp:Parameter Name="CardType" Type="Int32" />
                 <asp:Parameter Name="CardAgentName" Type="String" />
                 <asp:Parameter Name="CardValidNum" Type="String" />
                 <asp:Parameter Name="CardMoney" Type="Decimal" />
                 <asp:Parameter Name="CardValidUnit" Type="String" />
                 <asp:Parameter Name="CardSellFrom" Type="String" />
                 <asp:Parameter Name="CardCreateTime" Type="DateTime" />
                 <asp:Parameter Name="CardUseTime" Type="DateTime" />
                 <asp:Parameter Name="CardEndDate" Type="DateTime" />
             </InsertParameters>   
         </asp:ObjectDataSource> 
    </div>
    </form>
</body>
</html>
