<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_ShopCity, mallz" title="地区管理" enableviewstate="false" enableEventValidation="false" %>
<%@ Import Namespace="MallZ.Web" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<table class="" width="98%">
   <tr>
     <th align="left">地区管理</th>
     <td align="right">
     <div style="float:right; margin:5px 0 0 5px">
	<asp:LinkButton ID="Button3" runat="server" OnClick="Button3_Click" CausesValidation="false" Text="添 加" />
     </div>
     <asp:Panel runat="server" ID ="Panelheand"  style="float:right;">
             快速查找省份：<asp:DropDownList ID="DropDownList1" runat="server" AppendDataBoundItems="True"
             AutoPostBack="True" DataSourceID="ObjectDataSource2" DataTextField="Province"
             DataValueField="Province">
             <asp:ListItem>所有</asp:ListItem>
     </asp:DropDownList>
     <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetAllProvince"  TypeName="MallZ.Data.Shop_City"/>
     </asp:Panel>
     </td>
   </tr>
</table>

  <asp:Panel runat="server" ID ="Pannel1">

        <asp:GridView id="GridView1" runat="server" DataSourceID="ObjectDataSource1" AutoGenerateColumns="False" DataKeyNames="ID" CssClass="adminlist" AllowPaging="True" PageSize="20"  OnDataBound="GridView1_DataBound">
        <Columns>
        <asp:BoundField DataField="Province" HeaderText="一级（省份）" />
        <asp:BoundField DataField="City" HeaderText="二级（城市）" />
        <asp:CheckBoxField DataField="Flag" HeaderText="<a href='#' title='只有标记了重点城市才会在商品分类列表地区下拉框中显示。'>重点城市</a>" HeaderStyle-Width="150" />
        <asp:TemplateField HeaderStyle-Width="100" HeaderText="删除">
          <ItemTemplate>
            <asp:LinkButton ID="mod" runat="server" CommandName="edit" Text="编辑" />
            <asp:LinkButton ID="cl" runat="server" CommandName="Delete" OnClientClick="if(confirm('确定删除吗？'))return true; return false;" Text="删除" />
          </ItemTemplate>
          <EditItemTemplate>
            <asp:LinkButton ID="modi" runat="server" CommandName="Update" Text="提交" />
            <asp:LinkButton ID="cl" runat="server" CommandName="Cancel" Text="取消" />
          </EditItemTemplate>
        </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <tr>
            <th>省份</th><th>城市</th><th>标记</th><th>操作</th>
            </tr>
            <tr><td colspan="5">暂无信息！</td></tr> 
        </EmptyDataTemplate> 
        </asp:GridView>
    
    
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeleteCity"
        InsertMethod="AddCity" SelectMethod="GetCity" TypeName="MallZ.Data.Shop_City" UpdateMethod="UpdateCity">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Flag" Type="Boolean" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="Province" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="Province" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="Flag" Type="Boolean" />
        </InsertParameters>
    </asp:ObjectDataSource>

    <div class="help_intro" >
	<h1>帮助说明：</h1>
        <ul>
          <li>注意：地区跟商品所在地和店铺所在地相关联，非必要情况请不要编辑名称或删除。</li></ul>                       
    </div>
    
</asp:Panel> 

  <asp:Panel runat="server" ID="panneladd" Visible="False">
   <table class="nick" cellpadding="1" cellspacing="1" border="0">
        <tr>
             <td class="tit" colspan="2">新添地区</td>
        </tr>
        <tr class="tdbg">
            <td class="ltd">省份：</td>
            <td class="rtd">
                <input id="TxtProvince" maxlength="10" name="UserName" size="30" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtProvince"
                    ErrorMessage="省份名称不能空"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td class="ltd">城市：</td>
            <td class="rtd">
                <input id="TxtCity" 　 maxlength="10" name="Balance" size="30" runat="server" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtCity"
                    ErrorMessage="城市名称不能空"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td class="ltd">标记：</td>
            <td class="rtd">
                <asp:CheckBox ID="chFlag" runat="server" /></td>
        </tr>
        <tr>
            <td class="btm" colspan="2">
        	<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="保存" />
        	<asp:Button ID="Button1" runat="server" Text="返回" CausesValidation="False" OnClick="Button1_Click" />
	    </td>
        </tr>
    </table>     
  </asp:Panel> 
    
</asp:Content>

