<%@ page language="C#" enableeventvalidation="false" masterpagefile="../ShopMasterPage/MyShopMasterPage.master" autoeventwireup="true" inherits="Shop_member_Shop_ReceiveAddress, HoWaveVGO" title="收货地址设置" %>
<%@ Register Src="../ProvinceCity.ascx" TagName="ProvinceCity" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <div class="pageTitle"><span>收货地址设置</span></div>

 <div class="tips_onclick"  style="width:94%">您好，在这里可以预设您的收货地址，最多3个。</div>
 
 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="Addresssource"
     CssClass="tableHead" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >
    <Columns>
        <asp:BoundField DataField="username" HeaderText="姓名" />
         <asp:TemplateField HeaderText="具体地址" ShowHeader="False">
            <ItemTemplate>                
                <asp:Literal ID="address" runat="server" Text='<%# Convert.ToString(Eval("address")).Replace("&","") %>'/>
            </ItemTemplate>
        </asp:TemplateField>       
        <asp:BoundField DataField="zipcode" HeaderText="邮政编码" />
        <asp:BoundField DataField="ConectPhone" HeaderText="电话" />
        <asp:BoundField DataField="MobilePhone" HeaderText="手机" />
        <asp:BoundField DataField="Email" HeaderText="Email地址" />
        <asp:TemplateField HeaderText="删除" ShowHeader="False">
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"
                    OnClick="LinkButton1_Click" Text="删除"/>
                <asp:Label ID="Labaddressid" runat="server" Text='<%# Eval("addressid") %>' Visible="False"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:HyperLinkField DataNavigateUrlFields="AddressID" DataNavigateUrlFormatString="shop_updateaddress.aspx?AddressID={0}"
            HeaderText="编辑" Text="更改" />
    </Columns>   
 </asp:GridView>
 <div class="clear" style="height:5px; overflow:hidden;"></div>
 <table class="ShopOrderStyle">
 <caption>收货信息</caption>
 <tr>
     <td class="OrderTitle"> 姓名： </td>
     <td>
       <asp:TextBox ID="TxtUserName" runat="server" CausesValidation="True"  Height="16px" MaxLength="50" />
       <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="不能为空" ControlToValidate="TxtUserName"/>
     </td>
 </tr>
  <tr>
     <td class="OrderTitle">所在地：</td>
     <td>
       <uc1:ProvinceCity ID="ProvinceCity1" runat="server" />      
     </td>
 </tr>
   <tr class="div_row">
     <td class="OrderTitle">详细地址：</td>
     <td>
       <asp:TextBox ID="TxtAddress3" runat="server"  Height="16px" MaxLength="50" />
       <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtAddress3"
            ErrorMessage="不能为空"/>      
     </td>
 </tr>  
     <tr class="div_row">
         <td class="OrderTitle">
             Email地址：</td>
         <td>
             <asp:TextBox ID="TxtEmail" runat="server"  Height="16px" MaxLength="50" />
             <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="TxtEmail"
                 ErrorMessage="Email地址不正确" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"/></td>
     </tr>
  <tr class="div_row">
     <td class="OrderTitle">邮编：</td>
     <td>
       <asp:TextBox ID="TxtZipCode" runat="server"  Height="16px" MaxLength="6" />
       <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TxtZipCode"
            ErrorMessage="不能为空" Display="Dynamic"/>
       <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TxtZipCode"
            ErrorMessage="邮政编码格式不对" ValidationExpression="\d{6}" Display="Dynamic"/>
     </td>
 </tr>
  <tr class="div_row">
     <td class="OrderTitle">电话：</td>
     <td>
       <asp:TextBox ID="TxtPhone0" runat="server" Width="30px"  Height="16px" MaxLength="4" />-&nbsp;
       <asp:TextBox ID="TxtPhone1" runat="server" Width="100px"  Height="16px" MaxLength="8" />-
       <asp:TextBox ID="TxtPhone2" runat="server" Width="30px"  Height="16px" MaxLength="4" />(区号-电话-分机)      
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TxtPhone0"
             ErrorMessage="不能为空" Display="Dynamic"/>
         <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="TxtPhone1"
             ErrorMessage="不能为空" Display="Dynamic"/>
     </td>
 </tr>
  <tr class="div_row">
     <td class="OrderTitle" style="height: 26px">手机：</td>
     <td style="height: 26px">
       <asp:TextBox ID="TxtMoblephone" runat="server" Width="90px"  Height="16px"  MaxLength="11"/>
       <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TxtMoblephone"
            ErrorMessage="手机号码不对" ValidationExpression="\d{11}" Display="Dynamic"/>
     </td>
 </table>
 <br />
 <div style="text-align:center;">
      <asp:Button ID="ButAddress" runat="server" OnClick="ButAddress_Click" Text="新增收货地址"/>
 </div> 

<asp:ObjectDataSource ID="Addresssource" runat="server" DeleteMethod="DeleteAddress"
    SelectMethod="GetAddress" TypeName="Shop_Address" UpdateMethod="UpdateAddress" OldValuesParameterFormatString="{0}">
    <DeleteParameters>
        <asp:Parameter Name="AddressID" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="UserId" Type="Int32" />
        <asp:Parameter Name="username" Type="String" />
        <asp:Parameter Name="address" Type="String" />
        <asp:Parameter Name="zipcode" Type="Int32" />
        <asp:Parameter Name="connetphone" Type="String" />
        <asp:Parameter Name="mobilephone" Type="String" />
        <asp:Parameter Name="Email" Type="String" />
        <asp:Parameter Name="addressid" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
        <asp:SessionParameter DefaultValue="0" Name="UserId" SessionField="Howave_UserID" Type="Int32" />
    </SelectParameters>
</asp:ObjectDataSource>
    
</asp:Content>

