<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_ShopAddClass, WebApp_deploy" title="编辑商城栏目" enableviewstate="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <asp:FormView ID="FormView1" runat="server" DataKeyNames="ClassID"  DefaultMode="Insert" Width="100%" DataSourceID="ObjectDataSource2"
        OnItemUpdating="ObjectDataSource2_Updating" OnDataBound="FormView1_DataBound"
        OnItemUpdated="FormView1_ItemUpdated" OnItemInserted="FormView1_ItemInserted">
        <InsertItemTemplate>
            <table class="nick">
                <tr>
                    <td class="tit" colspan="2">
                        添加分类
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        所属分类：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ClassDir" runat="server" AppendDataBoundItems="True" SelectedValue='<%#Bind("ParentID") %>'>
                            <asp:ListItem Value="-1">无作为一级分类</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类名称：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ClassName" runat="server" Width="200px" Text='<%#Bind("ClassName") %>' />
                        <asp:RequiredFieldValidator ID="dd" runat="server" ErrorMessage="不能为空" ControlToValidate="ClassName" />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        类型名称：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ddlTypeName" runat="server" AppendDataBoundItems="True" 
                            SelectedValue='<%# Bind("Attributes_Type") %>' DataSourceID="ObjectDataSource1" 
                            DataTextField="Attributes_Type" DataValueField="Attributes_Type">
                         <asp:ListItem Value="-1">请选择</asp:ListItem>
                        </asp:DropDownList>
                        
                        </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类目录名：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="TextBox1" runat="server" Width="200px" Text='<%#Bind("ClassDir") %>'
                            onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}" />
                        只能用英文
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类状态：
                    </td>
                    <td class="rtd">
                        <asp:RadioButtonList ID="ClassStatus" runat="server" SelectedValue='<%#Bind("ShowOnTop") %>'
                            RepeatDirection="Horizontal">
                            <asp:ListItem Text="开启" Value="true" Selected="True" />
                            <asp:ListItem Text="关闭" Value="false" />
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        在分类中显示：
                    </td>
                    <td class="rtd">
                        <asp:RadioButtonList ID="RadioButtonList2" runat="server" SelectedValue='<%#Bind("ShowOnIndex") %>'
                            RepeatDirection="Horizontal">
                            <asp:ListItem Text="是" Value="true" Selected="True" />
                            <asp:ListItem Text="否" Value="false" />
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类提示：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ClassTips" runat="server" Width="200px" Text='<%#Bind("Tips") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类说明：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ReadMe" runat="server" Width="200px" Text='<%#Bind("ReadMe") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类所属专题：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ClassSpecial" runat="server" DataSourceID="ObjectDataSource5"
                            DataTextField="SpecialName" DataValueField="SpecialID" SelectedValue='<%# Bind("SpecialID") %>'
                            AppendDataBoundItems="true">
                            <asp:ListItem Text="不属于任何专题" Value="-1" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类下商品风格：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ProductSkinID" runat="server" DataSourceID="ObjectDataSource4"
                            DataTextField="SkinName" DataValueField="SkinID" SelectedValue='<%# Bind("ProductSkinID") %>'>
                            <asp:ListItem Value="-1" Text="不属于任何风格" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        每页显示商品数量：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("MaxPerPage") %>'>
                            <asp:ListItem Text="20" Value="20" />
                            <asp:ListItem Text="40" Value="40" />
                            <asp:ListItem Text="80" Value="80" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        显示形式：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("ItemListOrderType") %>'
                            onchange="if(this.value=='2'){document.getElementById('ShowPicSize').style.display=''}else{document.getElementById('ShowPicSize').style.display='none'};">
                            <asp:ListItem Text="列表方式" Value="1" />
                            <asp:ListItem Text="图文方式" Value="2" />
                            <asp:ListItem Text="纯文字方式" Value="3" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr id="ShowPicSize" style="display: none;">
                    <td class="ltd">
                        显示图片大小规格：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("ItemOpenType") %>'>
                            <asp:ListItem Text="120X120" Value="1" />
                            <asp:ListItem Text="220X220" Value="2" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center">
                        <asp:Button ID="AddChannel" Text="添 加" CausesValidation="true" CommandName="Insert"
                            runat="server" />
                        <input type="button" onclick="location.href='Admin_ShopClass.aspx'" value="返 回" />
                    </td>
                </tr>
            </table>
        </InsertItemTemplate>
        <EditItemTemplate>
            <table class="nick">
                <tr>
                    <td class="tit" colspan="2">
                        修改分类
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类：
                    </td>
                    <td class="rtd">
                        <asp:Literal ID="LiteralClassName" Text='<%# Eval("ClassName") %>' runat="server" />
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ClassID") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        所属分类：
                    </td>
                    <td class="rtd">
                        <asp:Literal ID="BelongClass" runat="server" />&nbsp;&nbsp;&nbsp;<input type="button"
                            onclick="document.getElementById('changeClassOwn').style.display=''" value="修改" />
                    </td>
                </tr>
                <tr id="changeClassOwn" style="display: none;">
                    <td class="ltd">
                        所属新分类
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="NewClassArray" runat="server" />
                        <asp:HiddenField ID="H_ParentID" runat="server" Value='<%#Eval("ParentID") %>' />
                        <asp:HiddenField ID="H_arrChildID" runat="server" Value='<%#Eval("arrChildID") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类名称：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ClassName" runat="server" Width="200px" Text='<%#Bind("ClassName") %>' />
                        <asp:RequiredFieldValidator ID="dd" runat="server" ErrorMessage="不能为空" ControlToValidate="ClassName" />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        类型名称：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ddlTypeName" runat="server" AppendDataBoundItems="True" 
                            SelectedValue='<%# Bind("Attributes_Type") %>' DataSourceID="ObjectDataSource1" 
                            DataTextField="Attributes_Type" DataValueField="Attributes_Type">
                         <asp:ListItem Value="-1">请选择</asp:ListItem>
                        </asp:DropDownList>
                </tr>
                <tr>
                    <td class="ltd">
                        分类目录名：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="TextBox1" runat="server" Width="200px" Text='<%#Bind("ClassDir") %>'
                            onkeyup="if((/[\W]/g).test(value)){alert('只能用英文！');value=value.replace(/[\W]/g,'');}" />只能用英文
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类状态：
                    </td>
                    <td class="rtd">
                        <asp:CheckBox ID="CheckBox1" runat="server" Text="启用" Checked='<%#Bind("ShowOnTop") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        在父分类中显示：
                    </td>
                    <td class="rtd">
                        <asp:CheckBox ID="CheckBox2" runat="server" Text="是" Checked='<%#Bind("ShowOnIndex") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类提示：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ClassTips" runat="server" Width="200px" Text='<%#Bind("Tips") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类说明：
                    </td>
                    <td class="rtd">
                        <asp:TextBox ID="ReadMe" runat="server" Width="200px" Text='<%#Bind("ReadMe") %>' />
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类所属专题：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ClassSpecial" runat="server" DataSourceID="ObjectDataSource5"
                            DataTextField="SpecialName" DataValueField="SpecialID" SelectedValue='<%# Bind("SpecialID") %>'
                            AppendDataBoundItems="true">
                            <asp:ListItem Text="不属于任何专题" Value="-1" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        分类下商品风格：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="ProductSkinID" runat="server" DataTextField="SkinName" DataValueField="SkinID"
                            AppendDataBoundItems="true" SelectedValue='<%# Bind("ProductSkinID") %>' DataSourceID="ObjectDataSource4"
                            OnDataBinding="ProductSkinID_OnDataBinding">
                            <asp:ListItem Text="不属于任何风格" Value="-1" />
                        </asp:DropDownList>
                        子类是否继承此风格：<asp:CheckBox ID="ChildClassUseSkin" runat="server" />是
                    </td>
                </tr>
                <tr style='<%=GetDisplay() %>'>
                    <td class="ltd">
                        该类是否有试衣参数：
                    </td>
                    <td class="rtd">
                        <asp:CheckBox ID="HasParameter" runat="server" Checked='<%# Bind("HasParameter") %>' />是
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        每页显示商品数量：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("MaxPerPage") %>'>
                            <asp:ListItem Text="20" Value="20" />
                            <asp:ListItem Text="40" Value="40" />
                            <asp:ListItem Text="80" Value="80" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="ltd">
                        显示形式：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("ItemListOrderType") %>'
                            onchange="if(this.value=='2'){document.getElementById('ShowPicSize').style.display=''}else{document.getElementById('ShowPicSize').style.display='none'};">
                            <asp:ListItem Text="列表方式" Value="1" />
                            <asp:ListItem Text="图文方式" Value="2" />
                            <asp:ListItem Text="纯文字方式" Value="3" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr id="ShowPicSize" style="display: none;">
                    <td class="ltd">
                        显示图片大小规格：
                    </td>
                    <td class="rtd">
                        <asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Bind("ItemOpenType") %>'>
                            <asp:ListItem Text="120X120" Value="1" />
                            <asp:ListItem Text="220X220" Value="2" />
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center;">
                        <asp:Button ID="UpdateChannel" Text=" 保 存 " CausesValidation="true" CommandName="update"
                            runat="server" />
                        <asp:Button ID="cl" runat="server" OnClientClick="javascript:{history.back();return false;}"
                            Text=" 取 消 " />
                    </td>
                </tr>
            </table>
            <asp:HiddenField ID="H_ClassParentPath" runat="server" Value='<%#Eval("ParentPath") %>' />
        </EditItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="InsertClass"
        SelectMethod="GetClassByClassID" TypeName="HoWave.Web.Shop_Class" UpdateMethod="UpdateShopClass"
        OnInit="ObjectDataSource2_Init"  
        OldValuesParameterFormatString="{0}">
        <InsertParameters>
            <asp:Parameter Name="ChannelID" Type="Int32" />
            <asp:Parameter Name="SpecialID" Type="Int32" />
            <asp:Parameter Name="ClassName" Type="String" />
            <asp:Parameter Name="ClassType" Type="Int32" />
            <asp:Parameter Name="OpenType" Type="Int32" />
            <asp:Parameter Name="ParentID" Type="Int32" />
            <asp:Parameter Name="Tips" Type="String" />
            <asp:Parameter Name="ReadMe" Type="String" />
            <asp:Parameter Name="ShowOnTop" Type="Boolean" />
            <asp:Parameter Name="ShowOnIndex" Type="Boolean" />
            <asp:Parameter Name="ItemListOrderType" Type="Int32" />
            <asp:Parameter Name="IsElite" Type="Boolean" />
            <asp:Parameter Name="EnableAdd" Type="Boolean" />
            <asp:Parameter Name="MaxPerPage" Type="Int32" DefaultValue="20" />
            <asp:Parameter Name="ItemOpenType" Type="Int32" DefaultValue="1" />
            <asp:Parameter Name="ClassDir" Type="String" />
            <asp:Parameter Name="TemplateID" Type="Int32" />
            <asp:Parameter Name="ClassSkinID" Type="Int32" />
            <asp:Parameter Name="ProductTemplateID" Type="Int32" />
            <asp:Parameter Name="HasParameter" Type="Boolean" DefaultValue="false" />
            <asp:Parameter Name="ProductSkinID" Type="String" DefaultValue="-1" />
            <asp:Parameter Name="Attributes_Type" Type="String" DefaultValue="-1" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="ChannelID" Type="Int32" />
            <asp:Parameter Name="SpecialID" Type="Int32" />
            <asp:Parameter Name="ClassName" Type="String" />
            <asp:Parameter Name="Tips" Type="String" />
            <asp:Parameter Name="ReadMe" Type="String" />
            <asp:Parameter Name="ShowOnTop" Type="Boolean" />
            <asp:Parameter Name="ShowOnIndex" Type="Boolean" />
            <asp:Parameter Name="IsElite" Type="Boolean" />
            <asp:Parameter Name="EnableAdd" Type="Boolean" />
            <asp:Parameter Name="ItemListOrderType" Type="Int32" />
            <asp:Parameter Name="MaxPerPage" Type="Int32" DefaultValue="20" />
            <asp:Parameter Name="ItemOpenType" Type="Int32" DefaultValue="1" />
            <asp:Parameter Name="ClassDir" Type="String" />
            <asp:Parameter Name="TemplateID" Type="Int32" />
            <asp:Parameter Name="ClassSkinID" Type="Int32" />
            <asp:Parameter Name="ProductTemplateID" Type="Int32" />
            <asp:Parameter Name="ProductSkinID" Type="String" />
            <asp:Parameter Name="ClassID"  Type="Int32" DefaultValue="0" />
            <asp:Parameter Name="ChildClassUseSkin" Type="Boolean" />
            <asp:Parameter Name="HasParameter" Type="Boolean" />
            <asp:Parameter Name="Attributes_Type"  Type="String" DefaultValue="" />
        </UpdateParameters>
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="ClassID" QueryStringField="ClassID"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" SelectMethod="GetProSkinBySkinType"
        TypeName="HoWave.Web.SkinBll">
        <SelectParameters>
            <asp:Parameter ConvertEmptyStringToNull="true" Name="SkinType" Type="String" DefaultValue="Product" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="GetAllSpcilaid"
        TypeName="HoWave.Web.SpecialBll"></asp:ObjectDataSource>
                                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                            SelectMethod="GetAllAttributesType" 
                            TypeName="HoWave.Web.Shop_ProductAttributes"></asp:ObjectDataSource>
</asp:Content>
