<%@ Page Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="MyHP.aspx.cs" Inherits="MyHP" Title="我的物品" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
   <table border=0 width="100%" cellpadding=0 cellspacing=1 bgcolor="#cdcdcd">
    <tr bgcolor="#f5f5f5" height="70">
      <td style="padding-left:8px;padding-top:5px" valign="top">
        <div>※ <span class="span2">我的物品</span></div> 
        <div style="padding-left:10px;padding-top:10px;padding-bottom:8px;">
          <asp:GridView ID="GridView1" SkinID="mygrid" Width="98%" DataKeyNames="wuid" AutoGenerateColumns="False" DataSourceID="sqldatasource1" runat="server" AllowPaging="True" PageSize="10">
            <Columns>
              <asp:BoundField DataField="wuid" HeaderText="换品编号" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:BoundField>
              <asp:HyperLinkField DataNavigateUrlFields="wuid" ControlStyle-CssClass="a2" DataNavigateUrlFormatString="view_hp.aspx?id={0}"
                DataTextField="wu_name" HeaderText="换品名称" />
              <asp:BoundField DataField="addtime" HeaderText="发布时间" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:BoundField>
              <asp:BoundField DataField="clicknum" HeaderText="点击数" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:BoundField>
              <asp:BoundField DataField="lynum" HeaderText="留言数" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:BoundField>
              <asp:BoundField DataField="state" HeaderText="当前状态" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:BoundField>          
              <asp:CommandField HeaderText="删除" ShowDeleteButton="True" >
                <ItemStyle HorizontalAlign="Center" />
              </asp:CommandField>
            </Columns>
          </asp:GridView>
        </div>
      </td>
    </tr>
    </table>    
  <asp:SqlDataSource 
        id="SqlDataSource1"
        runat="server"
        SelectCommand="select wuid,wu_name,wu_user,addtime,clicknum,(select count(*) from u_ly where wu_id=wuid) as lynum,case state when '0' then '未交换' when '1' then '已交换' end as state from wu_info where wu_user=@userid order by addtime desc"
        DeleteCommand="delete from wu_info where wuid=@wuid;delete from u_ly where wu_id=@wuid;delete from huan_info where wu_zid=@wuid or wu_bid=@wuid" 
        ConnectionString="<%$ ConnectionStrings:CnnString%>" >
    <SelectParameters>
      <asp:Parameter Name="userid" />
    </SelectParameters>
  </asp:SqlDataSource>
</asp:Content>

