<%@ page language="C#" autoeventwireup="true" inherits="WebAdmin_Brandlist, LebiMall" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!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 id="Head1" runat="server">
    <title>品牌管理</title>
    <link rel="stylesheet" type="text/css" href="css/css.css" media="screen"/>
    <script type="text/javascript" language="javascript" src="js/topHead.js"></script>
    <script src="js/checked.js" type="text/javascript"></script>
    <script type="text/javascript">
        var page='<%=page %>';
        function updete(i){
            document.getElementById("hid_i").value=i;
            document.getElementById("hid_page").value=page;
            var rc="";
            if(document.getElementById("check_c"+i).checked){
                rc=1;
            }else{
                rc=0;
            }
            document.getElementById("hid_rc").value=rc;
            document.getElementById('form1').submit();
        }
        function eidt(id){
            window.location.href="Brandedit.aspx?id="+id;
        }
        function del(id){
            if (confirm("确认要删除？")) {
                window.location.href="Brandm.aspx?id="+id+"&type=delete&page="+page;
            }
        }
        function updates(){
            document.getElementById("hid_type").value="updates";
            document.getElementById("hid_page").value=page;
            var rlist=document.getElementsByName("check_c");
            var strcheck="";
            for(i=0;i<rlist.length;i++)
            {
                if(rlist[i].checked==true){
                    strcheck+=1+",";
                }else{
                    strcheck+=0+",";
                }
            }
            document.getElementById("hid_check").value=strcheck;
            var form =document.forms[0];
            var flag=false;
            for(i=0;i<form.elements.length;i++)
            {
                if(form.elements[i].type=="text")
                {
                    if(form.elements[i].value==""){
                        document.getElementById("msg").innerHTML="以下填写不能为空！";
                        flag=false;
                        break;
                    }else{
                        flag=true;
                    }
                }
            }
            if(flag){
                document.getElementById("form1").submit();
            }
        }
        function dels(){
            var list=document.getElementsByName("check_");
            var strid="";
            if (confirm("确认要删除？")) {
                for(i=0;i<list.length;i++)
                {
                    if(list[i].checked==true){
                        strid+=list[i].value+",";
                    }
                } 
                if(strid!=""){
                window.location.href="Brandm.aspx?strid="+strid+"&type=dels&page="+page;}
            }
        }
        function select_(){
            var s_name=document.getElementById("s_name").value;
            window.location.href="Brandlist.aspx?s_name="+escape(s_name)+"&page=1";
        }
    </script>
</head>
<body>
    <div id="dhtmltooltip"><img src=""></div>
    <script type="text/javascript" language="javascript" src="js/js_link.js"></script>
        <script>header(2,2,"images/");</script>
        <div class="blank clearfix"></div>
        <!--功能区-->
        <div class="tabmenus mainwidth">
            <ul>
                <li class="current"><a href="#"><span>品牌管理</span></a></li>
                <li><a href="Brandadd.aspx"><span>品牌添加</span></a></li>
            </ul>
        </div>
        <div class="tab-mainbody">
            <div class="tab-mainbody2">
                <div class="functionHandleArea clearfix" style="padding:3px 0 3px 4px" >
                    <table cellpadding="0" cellspacing="0">
                        <tr><td><input type="text" class="input" id="s_name" runat="server" style="width:150px"><input type="button" title="查询" class="btn-search" onclick="select_();"></td>
                        </tr>
                        <tr>
                            <td colspan="6" style="height:30px;"> 
                                <input type="image" title=" 保存 " onclick="updates();return false;" src="images/bt_app.gif" align="absmiddle">
                                <input type="image" title=" 删除 " onClick="dels();return false;" src="images/bt_delete.gif" align="absmiddle">
                                <input type="image" title=" 添加 " onclick="location.href='Brandadd.aspx';return false;" src="images/bt_add.gif" align="absmiddle"> 
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="datalist">
                    <table cellspacing="0" border="0" id="list" style="width: 100%; border-collapse: collapse;">
                    <!-- table 导航 --> <form id="form1" name="form1" method="post" action="Brandm.aspx" enctype="multipart/form-data">
                        <tr>
                            <th style="width: 5%; cursor: pointer;" title="全选" onclick="AllChecked()">
                                <input type="hidden" id="hid_i" name="hid_i"/>
                                <input type="hidden" id="hid_rc" name="hid_rc"/>
                                <input type="hidden" id="hid_page" name="hid_page"/>
                                <input type="hidden" id="hid_type" name="hid_type"/>
                                <input type="hidden" id="hid_check" name="hid_check"/>
                                选择</th>
                            <th style="width: 27%">
                                品牌名称</th>
                            <th style="width:8%">
                                首字母
                            </th>
                            <th style="width: 5%">
                                排序
                            </th>
                            <th style="width: 5%">
                                推荐
                            </th>
                            <th style="width: 5%">
                                图标
                            </th>
                            <th style="width: 30%">
                                上传
                            </th>
                            <th style="width: 15%">
                                基本操作
                            </th>
                        </tr>
                        <%for (int i = 0; i < ds.Tables[0].Rows.Count; i++){%>
                        <tr>
                            <td>
                                <input type="checkbox" value="<%=ds.Tables[0].Rows[i]["id"] %>" name="check_" />
                                <input type="hidden" id="hidden_id<%=i %>" name="hidden_id<%=i %>" value="<%=ds.Tables[0].Rows[i]["id"] %>" />
                            </td>
                            <td>
                                <input type="text" id="txt_name<%=i %>" name="txt_name<%=i %>" value="<%=ds.Tables[0].Rows[i]["bname"] %>"
                                    class="input" style="width:250px;"  />
                            </td>
                            <td>
                                <input type="text" id="txt_s<%=i %>" name="txt_s<%=i %>" value="<%=ds.Tables[0].Rows[i]["binitial"] %>"
                                    class="input" style="width:20px;" />
                            </td>
                            <td>
                                <input type="text" id="txt_sort<%=i %>" name="txt_sort<%=i %>" value="<%=ds.Tables[0].Rows[i]["bsort"] %>"
                                    class="input"  style="width:20px;" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
                            </td>
                            <td>
                                <input type="checkbox" name="check_c" id="check_c<%=i %>" <%if (ds.Tables[0].Rows[i]["brecommend"].ToString()=="1"){%> checked <%} %>/>
                            </td>
                            <td>
                            <%if(ds.Tables[0].Rows[i]["bimg"].ToString()!=""){ %>
                                <img src="../images/kind-pic001.jpg" align='absmiddle' onmouseover="javascript:ddrivetip('<div class=hideimg><img src=../Upload/brand/<%=ds.Tables[0].Rows[i]["bimg"] %>></div>', '#ffffff', '150')"
                                    onmouseout="hideddrivetip()" /><%} %>&nbsp;
                            </td>
                            <td>
                                <input type="file" class="input"  style="width:250px;" id="file_<%=i %>" name="file_<%=i %>" />
                            </td>
                            <td>
                                <a href="javascript:eidt(<%=ds.Tables[0].Rows[i]["id"] %>)">编辑</a>&nbsp;|&nbsp;
                                <a href="javascript:del(<%=ds.Tables[0].Rows[i]["id"] %>)">删除</a>&nbsp;|&nbsp; <a href="#" onclick="updete(<%=i %>);">
                                    修改</a>
                            </td>
                        </tr>
                        <%} %>
                        </form>
                        <tr>
                            <td class="list-foot" colspan="8">
                                <div style="float: left; padding-top: 3px;">
                                </div>
                                <div id="divAsp" runat="server" style="float: right; padding-top: 3px;"><form id="form2" runat="server">
                                    <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1"
                                        runat="server" RecordCount="228" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页"
                                        PrevPageText="上一页" PageSize="20" UrlPaging="True" CustomInfoClass="pages1" CurrentPageButtonPosition="Center" ShowBoxThreshold="50"
                                        ShowFirstLast="true" NumericButtonCount="4" BackColor="Transparent" ShowDisabledButtons="False" EnableViewState="False">
                                    </webdiyer:AspNetPager></form>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <script type="text/javascript">tdshowm("list");</script>
                    
                </div>
            </div>
        </div>
</body>
</html>
