<%@ page language="C#" autoeventwireup="true" inherits="HL_Admin_Admin_ShopAddClass, 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>
    <link href="css/template_css.css" type="text/css" rel="stylesheet" />
    <base target="_self"></base>
    <style type="text/css">
    .tdbg1{
        text-align:right;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:FormView ID="FormView1" runat="server" DefaultMode="Insert" Width="100%" DataSourceID="ObjectDataSource2"
                OnItemUpdating="ObjectDataSource2_Updating" OnDataBound="FormView1_DataBound"
                OnItemUpdated="FormView1_ItemUpdated" OnItemInserted="FormView1_ItemInserted">
                <InsertItemTemplate>
                    <table class="tableadd">
                        <tr>
                            <th colspan="2">添加新栏目</th>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                所属栏目：</td>
                            <td class="tdbg2">
                                    <asp:DropDownList ID="ClassDir" runat="server" Width="250px" DataSourceID="ObjectDataSource3"
                                        DataTextField="ClassName" DataValueField="ClassID" OnDataBound="ClassDir_DataBound"
                                        AppendDataBoundItems="True" SelectedValue='<%#Bind("ParentID") %>'>
                                        <asp:ListItem Value="-1">无作为一级栏目</asp:ListItem>
                                    </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目名称：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目目录名：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目状态：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                在父栏分类中显示：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                打开方式：</td>
                            <td class="tdbg2">
                                <asp:RadioButtonList ID="OpenType" runat="server" SelectedValue='<%#Bind("ItemOpenType") %>'
                                    RepeatDirection="Horizontal">
                                    <asp:ListItem Text="原窗口" Value="1" Selected="True" />
                                    <asp:ListItem Text="新窗口" Value="0" />
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目提示：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="ClassTips" runat="server" Width="200px" Text='<%#Bind("Tips") %>' /></td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目说明：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="ReadMe" runat="server" Width="200px" Text='<%#Bind("ReadMe") %>' /></td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                每页显示商品数：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="MaxPerPage" runat="server" Width="50px" Text='<%#Bind("MaxPerPage") %>' />个
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                商品排序方式：</td>
                            <td class="tdbg2">
                                <asp:DropDownList ID="ProductOrderType" runat="server" SelectedValue='<%#Bind("ItemListOrderType") %>'>
                                    <asp:ListItem Text="商品ID升序" Value="1" />
                                    <asp:ListItem Text="商品ID降序" Value="2" />
                                    <asp:ListItem Text="更新时间升序" Value="3" />
                                    <asp:ListItem Text="更新时间降序" Value="4" />
                                    <asp:ListItem Text="点击次数升序" Value="5" />
                                    <asp:ListItem Text="点击次数降序" Value="6" />
                                </asp:DropDownList>
                            </td>
                        </tr> 
                         <tr>
                            <td class="tdbg1">
                                栏目所属专题：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目下商品风格：</td>
                            <td class="tdbg2">
                                <asp:DropDownList ID="ProductSkinID" runat="server" DataSourceID="ObjectDataSource4"
                                    DataTextField="SkinName" DataValueField="ProjectName" SelectedValue='<%# Bind("ProductSkinID") %>' />
                            </td>
                        </tr>                       
                        <tr>
                            <td class="tdbg1">
                                是否允许添加商品：</td>
                            <td class="tdbg2">
                                <asp:CheckBox ID="CheckBox1" runat="server" Text="允许" Checked='<%#Bind("EnableAdd") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1"></td>
                            <td  class="tdbg2" style="text-align: center;">
                                <asp:LinkButton ID="AddChannel" Text="添加" CausesValidation="true" CommandName="Insert"
                                    runat="server" />
                                    <asp:LinkButton ID="cl" runat="server" OnClientClick="window.close();" Text="取消"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </InsertItemTemplate>
                <EditItemTemplate>
                    <table class="tableadd">
                        <tr>
                            <th colspan="2">修改栏目</th>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                序号：</td>
                            <td class="tdbg2">
                                <asp:Label ID="Label1" runat="server" Text='<%#Bind("ClassID") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                所属栏目：</td>
                            <td class="tdbg2">
                                <asp:Literal ID="BelongClass" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目名称：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目目录名：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目状态：</td>
                            <td class="tdbg2">
                                <asp:CheckBox ID="CheckBox1" runat="server" Text="启用" Checked='<%#Bind("ShowOnTop") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                在父栏分类中显示：</td>
                            <td class="tdbg2">
                                <asp:CheckBox ID="CheckBox2" runat="server" Text="是" Checked='<%#Bind("ShowOnIndex") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                打开方式：</td>
                            <td class="tdbg2">
                                <asp:RadioButtonList ID="OpenType" runat="server" SelectedValue='<%#Bind("ItemOpenType") %>'
                                    RepeatDirection="Horizontal">
                                    <asp:ListItem Text="原窗口" Value="1" Selected="True" />
                                    <asp:ListItem Text="新窗口" Value="0" />
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目提示：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="ClassTips" runat="server" Width="200px" Text='<%#Bind("Tips") %>' /></td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                栏目说明：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="ReadMe" runat="server" Width="200px" Text='<%#Bind("ReadMe") %>' /></td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                每页显示商品数：</td>
                            <td class="tdbg2">
                                <asp:TextBox ID="MaxPerPage" runat="server" Width="50px" Text='<%#Bind("MaxPerPage") %>' />个
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1">
                                商品排序方式：</td>
                            <td class="tdbg2">
                                <asp:DropDownList ID="ProductOrderType" runat="server" SelectedValue='<%#Bind("ItemListOrderType") %>'>
                                    <asp:ListItem Text="商品ID升序" Value="1" />
                                    <asp:ListItem Text="商品ID降序" Value="2" />
                                    <asp:ListItem Text="更新时间升序" Value="3" />
                                    <asp:ListItem Text="更新时间降序" Value="4" />
                                    <asp:ListItem Text="点击次数升序" Value="5" />
                                    <asp:ListItem Text="点击次数降序" Value="6" />
                                </asp:DropDownList>
                            </td>
                        </tr> 
                         <tr>
                            <td class="tdbg1">
                                栏目所属专题：</td>
                            <td class="tdbg2">
                                <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="tdbg1">
                                栏目下商品风格：</td>
                            <td class="tdbg2">
                                <asp:DropDownList ID="ProductSkinID" runat="server" DataTextField="SkinName" DataValueField="ProjectName"
                                    SelectedValue='<%# Bind("ProductSkinID") %>' DataSourceID="ObjectDataSource4" />
                                该子类是否继承此风格：<asp:CheckBox ID="ChildClassUseSkin" runat="server" />是
                            </td>
                        </tr>                     
                        <tr>
                            <td class="tdbg1">
                                是否允许添加商品：</td>
                            <td class="tdbg2">
                                <asp:CheckBox ID="CheckBox3" runat="server" Text="允许" Checked='<%#Bind("EnableAdd") %>' />
                            </td>
                        </tr>
                        <tr>
                            <td class="tdbg1"></td>
                            <td  class="tdbg2" style="text-align: center;">
                                <asp:LinkButton ID="UpdateChannel" Text="保存修改" CausesValidation="true" CommandName="update"
                                    runat="server" />
                                    <asp:LinkButton ID="cl" runat="server" OnClientClick="window.close();" Text="取消"></asp:LinkButton>
                            </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="Shop_Class" UpdateMethod="UpdateShopClass"
                OnInit="ObjectDataSource2_Init" OldValuesParameterFormatString="original_{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" />
                    <asp:Parameter Name="ItemOpenType" Type="Int32" />
                    <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" />
                </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" />
                    <asp:Parameter Name="ItemOpenType" Type="Int32" />
                    <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" />
                    <asp:Parameter Name="ChildClassUseSkin" Type="Boolean" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="0" Name="ClassID" QueryStringField="ClassID"
                        Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource3" runat="server" SelectMethod="GetAllClassNameFillDropDown"
                TypeName="Shop_Class" />
            <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" SelectMethod="GetSkinNameBySkinType"
                TypeName="SkinBll">
                <SelectParameters>
                    <asp:Parameter Name="SkinType" Type="String" DefaultValue="Product" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource5" runat="server" SelectMethod="GetSpecialByChannel"
                TypeName="SpecialBll">
                <SelectParameters>
                    <asp:Parameter Name="ChannelID" Type="String" DefaultValue="-1" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </div>
    </form>
</body>
</html>
