<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="huan.aspx.cs" Inherits="huan" Title="交换换品" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table width="840" border="0" cellpadding="0" cellspacing=1 bgcolor="#cdcdcd">
    <tr bgcolor="#f5f5f5">
      <td align="left" style="padding-left:5px;padding-top:6px;" valign="top">
            <div>
                 ※ <span class="span2">将要交换的换品信息</span>
            </div>
        <div> 
        <asp:FormView ID="FormView1" Width="100%" DefaultMode="ReadOnly" DataSourceID="sqldatasource1" runat="server">
        <ItemTemplate>
            <table width="100%" border=0 cellpadding=0 cellspacing=0>
            <tr height="230">
            <td width="25%" valign="top" style="padding-top:8px;" align="center">
                <asp:Image ID="Image1" ImageUrl='<%# Bind("wu_pic","wppic/{0}")%>' width="140" height="140" runat="server" />
            </td>
            <td width="45%" align=left valign="top" style="padding-top:8px;padding-left:8px;">
              <div style="padding-bottom:8px;">
                <span class="span12">换品名称：</span>
                <asp:Label ID="Label13" CssClass="span13" runat="server" Text='<%# Bind("wu_name")%>' />
              </div>
              <div style="padding-bottom:8px;">
                <span class="span12">换品介绍：</span>
                <div style="padding-top:6px;padding-left:5px;">
                <asp:Label ID="Label14" CssClass="span13" runat="server" Text='<%# Bind("wu_descr")%>' />
                </div>     
              </div>
              <div style="padding-bottom:8px;">  
                <span class="span12">换品类别：</span>
                <asp:HyperLink ID="HyperLink5" CssClass="a11" runat="server" Text='<%# Bind("typename")%>' NavigateUrl='<%# Bind("wu_type","ss_hp.aspx?type={0}")%>' />
              </div>                  
              <div style="padding-bottom:8px;">  
                <span class="span12">换品新旧程度：</span>
                <asp:Label ID="Label5" CssClass="span13" runat="server" Text='<%# Bind("wu_xjcd")%>' />
              </div>                  
              <div style="padding-bottom:8px;">  
                <span class="span12">想换的物品：</span>
                <asp:Label ID="Label1" CssClass="span13" runat="server" Text='<%# Bind("hop_wpname")%>' />
              </div>       
              <div style="padding-bottom:8px;">  
                <span class="span12">期望交换地点：</span>
                <asp:Label ID="Label16" CssClass="span13" runat="server" Text='<%# Bind("hop_addr")%>' />
              </div>                     
              <div style="padding-bottom:2px;">  
                <span class="span12">发布时间：</span>
                <asp:Label ID="Label2" CssClass="span13" runat="server" Text='<%# Bind("addtime","{0:yyyy-MM-dd}")%>' />
              </div>    
            </td>
            <td width="30%" align=left valign="top" style="padding-top:5px;">
              <div style="padding-bottom:8px;width:200px;height:200px;background-color:White;padding-left:8px;padding-top:5px;">
                <asp:HyperLink ID="HyperLink2" NavigateUrl='<%# Eval("wu_user","view_user.aspx?id={0}") %>'  runat="server">
                  <asp:Image ID="Image2" ImageUrl='<%# Bind("face","userpic/{0}")%>' width="60" height="60" runat="server" />
                </asp:HyperLink>

                <div style="padding-top:8px;">
                <span class="span8">货主：</span>
                <asp:HyperLink ID="HyperLink3" CssClass="a11" runat="server" Text='<%# Bind("u_name")%>' NavigateUrl='<%# Bind("wu_user","view_hk.aspx?id={0}")%>' />
                </div>
                <div style="padding-top:8px;">
                  <span class="span8">所在地：</span>
                  <asp:Label ID="Label8" CssClass="span13" runat="server" Text='<%# Bind("jzarea")%>' />
                </div>
                <div style="padding-top:8px;">
                  <span class="span8">注册日期：</span>
                  <asp:Label ID="Label10" CssClass="span13" runat="server" Text='<%# Bind("regtime","{0:yyyy-MM-dd hh:mm:ss}")%>' />
                </div>
                <div style="padding-top:8px;">
                  <span class="span8">最后登录：</span>
                  <asp:Label ID="Label17" CssClass="span13" runat="server" Text='<%# Bind("lastlogin","{0:yyyy-MM-dd hh:mm:ss}")%>' />
                </div>
                <div style="padding-top:8px;">
                  <span class="span8">登录次数：</span>
                  <asp:Label ID="Label18" CssClass="span13" runat="server" Text='<%# Bind("logintimes")%>' />
                </div>
                <div style="padding-top:20px;">
                  <asp:HyperLink ID="HyperLink4" CssClass="a12" runat="server" Text="[去他/她的换铺看看？]" NavigateUrl='<%# Bind("wu_user","view_hk.aspx?id={0}")%>' />
                </div>
              </div>    
            </td>
          </tr>
          </table>            
        </ItemTemplate>
        </asp:FormView></div>
      </td>
    </tr>
    </table>
    <br/>
    <asp:FormView ID="FormView3" Width="100%" DefaultMode="Insert" DataSourceID="sqldatasource3" runat="server" OnItemInserting="FormView3_ItemInserting" OnItemInserted="FormView3_ItemInserted">    
    <InsertItemTemplate>
    <table width="840" border="0" cellpadding="0" cellspacing=1 bgcolor="#cdcdcd">
    <tr bgcolor="#f5f5f5">
      <td align="left" style="padding-left:5px;padding-top:6px;" valign="top">
        <div>※ <asp:Label ID="Label6" CssClass="span2" runat="server" Text="选择交换物品"/></div> 
        <div style="padding-left:10px;padding-top:10px;padding-bottom:12px;">
          <asp:RadioButtonList Width="95%" ID="RadioButtonList1"  RepeatLayout="table" RepeatColumns=4 RepeatDirection="horizontal" BorderStyle="none" DataSourceID="sqldatasource2" DataTextField="wu_name" DataValueField="wuid" runat="server" />
            <asp:PlaceHolder ID="PlaceHolder1" runat="server">
               <span class="span13">您的换铺中还没有任何物品，快去</span>
               <asp:HyperLink ID="HyperLink4" CssClass="a10" runat="server" Text="发布" NavigateUrl="hpfb.aspx" />
              <span class="span13">吧！</span>
            </asp:PlaceHolder>
        </div>
        <div>※ <asp:Label ID="Label3" CssClass="span2" runat="server" Text="输入交换说明"/></div>         
        <div style="padding-left:10px;padding-top:10px;">
            <asp:TextBox id="textbox1" text='<%#Bind("jhmemo") %>' TextMode="multiline" Rows="6" Columns="90" runat="server" />
        </div>
        <p align=center><asp:Button ID="Button1" CommandName="insert" runat="server" Text="发出交换申请" /></p>
      </td>
    </tr>
    </table>
    </InsertItemTemplate>
    </asp:FormView>
    
    <asp:SqlDataSource 
        id="SqlDataSource1" 
        runat="server" 
        SelectCommand="select wuid,wu_type,typename,wu_user,wu_name,wu_pic,wu_xjcd,wu_descr,hop_wpname,hop_addr,hop_memo,clicknum,addtime,u_name,jzarea,face,regtime,logintimes,lastlogin from wu_info,wu_type,u_info where wu_user=u_id and wu_type=typeid"
        FilterExpression="wuid={0}" 
        ConnectionString="<%$ ConnectionStrings:CnnString%>" >
     <FilterParameters>
       <asp:QueryStringParameter Name="wpid" QueryStringField="wuid" /> 
     </FilterParameters>   
  </asp:SqlDataSource>
  
    <asp:SqlDataSource 
        id="SqlDataSource2" 
        runat="server" 
        SelectCommand="select * from wu_info where wu_user=@userid"
        ConnectionString="<%$ ConnectionStrings:CnnString%>" >
     <SelectParameters>
       <asp:Parameter Name="userid" />
     </SelectParameters>
  </asp:SqlDataSource>   
  
  <asp:SqlDataSource 
        id="SqlDataSource3" 
        runat="server" 
        InsertCommand="insert into huan_info(jhid,wu_zid,wu_bid,jhmemo) values(@jhid,@wu_zid,@wu_bid,@jhmemo)" 
        ConnectionString="<%$ ConnectionStrings:CnnString%>" >
      <InsertParameters>
        <asp:QueryStringParameter Name="wu_bid" QueryStringField="wuid" />
        <asp:Parameter Name="jhid" Type="string" />
        <asp:Parameter Name="wu_zid" Type="string" />
      </InsertParameters>  
  </asp:SqlDataSource>    
</asp:Content>

