<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Brand.aspx.cs" Inherits="LMN.Web.Admin.Shop.BrandList" %>

<!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/admin.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/wbox/wbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/jquery-1.4.1.min.js"></script>
<script src="../Scripts/alert.js" type="text/javascript"></script>
<script src="../Scripts/wbox.js" type="text/javascript"></script>
<script type="text/C#" runat="server">
    protected int Count = 0;
    protected string WriteTr() {
        Count++;
        return Count % 7 == 0 ? "</tr><tr>" : "";
    }
</script>
</head>
<body>
<form id="form1" runat="server">
    <div style="padding: 20px;">
        <h4 class="title">品牌管理 <a href="BrandAdd.aspx">+<span>添加</span></a></h4>
        <div class="division">
            <table>
                <%--<tr class="left">
                <th class="chk"><input type="checkbox" class="sel" name="all" id="all" value="true"></th>
                <th class="w40">排序</th>
                <th>名称(<i>别名</i>)</th>
            </tr>
                        <td><input type="checkbox" id="id_<%#Eval("id") %>" name="id" value="<%#Eval("id") %>"></td>
                        <td>
                            <%#Eval("sort") %></td>
                --%>
                <tr item-id="17">
                    <asp:Repeater ID="Repeater1" runat="server">
                        <ItemTemplate>
                            <td><a href="BrandAdd.aspx?action=dele&id=<%#Eval("id") %>" target="iframe" onclick="if (!confirm('确认删除选中的记录？'))return false;" style="float: right; color: #ccc;">删</a><a href="BrandAdd.aspx?id=<%#Eval("id") %>" title="编辑<%#Eval("name")%>(<%#Eval("alias")%>)">
                            <%#string.IsNullOrEmpty(Eval("logo").ToString()) ? Eval("name") + "(" + Eval("alias") + ")" : "<img src=\""+Eval("logo")+"\" alt=\"编辑"+Eval("name")+"("+Eval("alias")+")\" />"%>
                            </a></td>
                            <%=WriteTr() %>
                        </ItemTemplate>
                    </asp:Repeater>
                </tr>
                <%--<tr>
                <td colspan="7"><input style="float: left;" type="button" id="dele" name="dele" value="批量删除" />
                    <div style="float: left; margin-left: 5px;">
                        <LMN:Pager ID="Pager1" runat="server" PageSize="20" CssClass="pager">
                        </LMN:Pager>
                    </div>
                </td>
            </tr>--%>
            </table>
        </div>
    </div>
</form>
<iframe id="iframe" name="iframe" src="about:blank" style="display: none;"></iframe>
<script type="text/javascript">
    $("#all").click(function() {
        var b = $(this).attr("checked");
        $("input[name=id]").each(function() {
            $(this).attr("checked", b);
        });
    });
    $("#dele").click(function() {
        if ($("input[name=id]:checked").length == 0) {
            showTips("请选择要删除的项！", 3);
            return false;
        }

        if (!confirm("确认删除选中的记录？")) return false;

        var ids = "";
        $("input[name=id]:checked").each(function() {
            ids += (ids == "" ? "" : ",") + $(this).val();
        });

        if (ids != "") {
            $.get("Action.aspx?action=branddelete&id=" + ids + "&" + new Date(), function(data) {
                if (data == "-1") {
                    alert("请选择要删除的记录！");
                } else if (data == "0") {
                    alert("删除失败，请重试！");
                } else {
                    // alert("删除成功！");
                    location.reload();
                }
            });
        }
        return true;
    });
</script>
</body>
</html>
