<%@ Import Namespace="System.Data" %>

 

<%@ Page Language="C#" MasterPageFile="~/SCprogram/Member_Company.Master" AutoEventWireup="true" CodeBehind="Member_Company_Product.aspx.cs" Inherits="SHICHAO.Web.SCprogram.Member_Company_Product" %>
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>
<asp:Content ID="Content1" runat="server"
    contentplaceholderid="ContentPlaceHolder1">
    <form runat="server" id="form1">
       
        <div class="r_box">
            <div class="r_content1">
                <h1>
                    产品展示</h1>
                <h1>                   
                    <asp:Button ID="butadd" runat="server" Text="发布新品"  CssClass="btn03"
                        onclick="butadd_Click" /><asp:HiddenField ID="HdnSelectedValues" runat="server" />
                    </h1>
                <asp:Repeater ID="Repeater1" runat="server"
                    onitemcommand="Repeater1_ItemCommand">
                <HeaderTemplate>
                <table border="0" cellpadding="0" cellspacing="1" class="r_table">
                    <tr>
                        <td align="center" width="5%">选择</td>
                        <td align="center" width="20%">图片</td>
                        <td align="center" width="20%">商品名称</td>
                        <td align="center" width="10%">数量</td>
                        <td align="center" width="15%">下架时间</td>
                        <td align="center" width="10%">已审</td>
                        <td align="center" width="20%">编辑</td>
                    </tr>
                </table>
                </HeaderTemplate>
                <ItemTemplate>
                <table border="0" cellspacing="1" class="r_table2">
                    <tr>
                        <td align="center" width="5%"><input id="chkid" type="checkbox" value="<%# Eval("id") %>" /></td>
                        <td align="center" width="20%"><a href="/Products/Product_<%# Eval("id") %>.html" target="_blank"><img src="<%=imgurl %>/ProImg/60X60/<%# ((DateTime)Eval("createdate")).ToString("yyyyMMdd")%>/<%# Eval("p_pic") %>" /></a></td>
                        <td align="center" width="20%"><a href="/Products/Product_<%# Eval("id") %>.html" target="_blank"><%# Eval("p_name_c")%></a></td>
                        <td align="center" width="10%"><span class="f_666"><%# Eval("p_num0") %></span></td>
                        <td align="center" width="15%"><%# ((DateTime)Eval("Date_3")).ToString("yyyy-MM-dd")%></td>
                        <td align="center" width="10%"><%# Eval("is_3_title")%></td>
                        <td align="center" width="20%">
                            [<asp:LinkButton ID="lbtCx" CommandName="Cx" CssClass="cf60" CommandArgument='<%# Eval("id") %>' runat="server">促销</asp:LinkButton>]
                            [<asp:LinkButton ID="lbtnEdit" CommandName="Mdy" CssClass="cf60" CommandArgument='<%# Eval("id") %>' runat="server">修改</asp:LinkButton>]
                            [<asp:LinkButton ID="lbtnDel" CommandName="Del" OnClientClick="return confirm('确认要删除?')" CommandArgument='<%# Eval("id") %>' CssClass="cf60" runat="server">删除</asp:LinkButton>]</td>
                    </tr>
                </table>
                </ItemTemplate>
                </asp:Repeater>   
<table width="100%" border="0" cellpadding="4" cellspacing="1">
  <tr>
    <td width="79" align="center"><input type="checkbox" name="checkbox2" value="checkbox" onclick="selectAllCheckBox()" />
        反选 </td>
    <td>
        <asp:Button ID="btnDel" runat="server" OnClientClick="return DeleteReco()"
            CssClass="btn04" Text="删除" onclick="btnDel_Click" />
        </td>
    <td><div class="shop_fy">
        <webdiyer:AspNetPager
                  ID="AspNetPager1" runat="server" NextPageText="下一页"
                  onpagechanged="AspNetPager1_PageChanged" PrevPageText="上一页"
                  ShowFirstLast="False" AlwaysShow="True" CssClass=""
                  CurrentPageButtonClass="" CurrentPageButtonStyle="shop_fy"
                  CurrentPageButtonTextFormatString="[{0}]" EnableUrlRewriting="True"
            UrlPaging="True" UrlRewritePattern="/Company/Product.html?page={0}">
              </webdiyer:AspNetPager>
           
    </div></td>
  </tr>
</table>
            </div>
    </div>
<script type="text/javascript">
function selectAllCheckBox()
{
    var obj=document.getElementsByName("chkid");
 if(obj.length)
 {
  for(var i=0;i<obj.length;i++)
  {
   obj[i].checked=!obj[i].checked
  }
 }else{
  
  obj.checked=!obj.checked
 }
}

//函数:删除

function DeleteReco()
{
                var  al = new Array();
                var chkother= document.getElementsByTagName("input");
                for(var i=0,j=0;i<chkother.length;i++)
                {
                    if( chkother[i].type =='checkbox')
                    {
                        if(chkother[i].id.indexOf('chkid')>-1)
                        {
                            if(chkother[i].checked==true)
                            {
                                al[j] =chkother[i].value;
                                j++;
                            }
                        }
                    }
                }
                if (al == "")
                {
                    alert('请选择你要[删除]的产品.');
                    return false;
                }
                else if(window.confirm("你确定要[删除]选中的("+j+")条产品?"))
                {
                    var btnDel='btnDel';
                    document.getElementById("<%=HdnSelectedValues.ClientID %>").value=al;
                    event.cancelPostBack=true;
                    window.document.all(btnDel).click();
                   
                }
                else
                {
                    return false;
                }             
}
</script>
</form>
</asp:Content>