<%@ page language="C#" masterpagefile="../ShopMasterPage/MyShopMasterPage.master" autoeventwireup="true" inherits="Shop_Member_Shop_Message, HoWaveVGO" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True"/>  
<script type="text/javascript">
function setButtonActive(flags)
{  
   var _flag=parseInt(flags);
   var ulObj=document.getElementById("M1");  
   for(var i=0;i<ulObj.childNodes.length;i++)
     {ulObj.childNodes[i].className="";}
   if(ulObj.childNodes.length>2)
     {_flag=_flag*2+1;} 
   ulObj.childNodes[_flag].className="active";  
}
</script> 
<div class="pageTitle">短消息管理</div>
<div id="MainMenu" style="height:100%">
	<div class="TabMenu">
		<!--一级导航-->				
       <ul id="M1" >
          <li class="active"><a href="Shop_Message.aspx?action=read&tag=R" onclick="setButtonActive(0)">收件夹</a></li>
          <li><a href="Shop_Message.aspx?action=read&tag=S" onclick="setButtonActive(1)">发件夹</a></li>
       </ul>
   </div>
    <div class="TabText">
       <asp:Panel ID="Panel1" runat="server" Width="100%" Height="100%" HorizontalAlign="Center" Visible="True"> 
           <div style="clear:both; width:98%; padding:5px 0 0 5px">
			    <div class="NewMail">
			       <a href="Shop_Message.aspx?action=send"><img src="../Images/sendmsg.gif" /></a>
              
                </div>
           </div>
           <div style="clear:both;height:3px;"></div>
           <asp:GridView ID="GridView1" runat="server" DataSourceID="MessageR" AllowPaging="True"
            AutoGenerateColumns="False" 
            PageSize="20" Width="98%" Height="100%" OnDataBound="GridViewData_DataBound"  CssClass="tableHead" >
           <Columns>                   
                    <asp:TemplateField HeaderText="发送者">                
                        <ItemTemplate>
                            <asp:HyperLink ID="Message_User" runat="server" Target="_blank"  NavigateUrl='<%#"../Shop1/Shop_ShopIntro.aspx?UserID="+ Eval("UserID")%>' Text='<%# Eval("UserName") %>'/> 
                        </ItemTemplate>
                        <HeaderStyle Width="20%" />
                    </asp:TemplateField>
                     <asp:TemplateField HeaderText="主题">   
                        <ItemTemplate>
                            <asp:HyperLink ID="Message_Title" Text='<%# Eval("Title") %>'  runat="server"    NavigateUrl='<%# Bind("MessageID") %>'  />                             
                        </ItemTemplate>  
                    </asp:TemplateField>                  
                    <asp:BoundField DataField="SendTime" HeaderText="发送日期"  HeaderStyle-Width="15%"/>
                    <asp:BoundField DataField="IsRead" HeaderText="状态" HeaderStyle-Width="10%"/>
                    <asp:TemplateField HeaderText="操作">   
                        <ItemTemplate>
                            <asp:HyperLink ID="HLRead" Text="回复"  runat="server"    NavigateUrl='<%# Bind("MessageID") %>'  /> |
                            <asp:LinkButton ID="HLDelete" Text="删除" runat="server" CommandName='<%# Eval("MessageID") %>'  OnCommand="DeleteMessage" OnClientClick="return confirm('确定要删除此站内短信吗？');"/>
                        </ItemTemplate>
                        <HeaderStyle Width="15%" />
                    </asp:TemplateField>
                 
                </Columns>
                <EmptyDataTemplate>暂无已接收短信</EmptyDataTemplate>
           </asp:GridView>
       </asp:Panel>   
       <asp:Panel ID="Panel0" runat="server" Width="100%" HorizontalAlign="Center" Visible="False">
       <div style="clear:both; width:98%; padding:5px 0 5px 0; margin:0 auto">
			<table class="ShopOrderStyle" style="width:100%">
                <caption><asp:literal ID="MessageTitle" runat="server" Text="发送站内短信" /></caption>
                <tr>
                <td class="OrderTitle">收件人：</td>
                <td>
                        <asp:TextBox ID="TxtReceiver" runat="server" Width="300px"/>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TxtReceiver"
                            ErrorMessage="收件人不能空"/>
                </td>
                </tr>
                <tr>
                <td class="OrderTitle">主题：</td>
                <td>
                        <asp:TextBox ID="TxtTitle" runat="server" Width="300px"/><span style="color:Red">(注：标题长度不能超过50个字符)</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TxtTitle"
                            ErrorMessage="主题不能空" Display="Dynamic"/>
                </td> 
                </tr>
                <tr>
                <td class="OrderTitle">内容：</td>
                <td>
                        <asp:TextBox ID="TxtContent" runat="server" Height="300px" TextMode="MultiLine" Width="400px"/><span style="color:Red">(注：内容长度不能超过1500个字符)</span>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TxtContent"
                            ErrorMessage="内容不能空" Display="Dynamic"/>
                </td>
                </tr>
                <tr>
                <td colspan="2">
                        <asp:CheckBox ID="CheckBox1" runat="server" Text="发送同时并保存"  Checked="true"/>
                        <asp:Button ID="ButdSave" runat="server" OnClick="ButdSave_Click" Text="发送" />
                        <input type="button" onclick="javascript:location.href='Shop_Message.aspx'" value="返回" />                     
                      
                    </td>
                </tr>
            </table>
        </div>
       </asp:Panel>
   
   <div class="clear" style="height:3px"></div>
   </div>
</div>
<script type="text/javascript">setButtonActive(<%=m_flag %>);</script>  
<asp:ObjectDataSource ID="MessageS" runat="server" SelectMethod="GetSenderMessage"
            TypeName="MessageBLL" UpdateMethod="SetMessageDelS" >
            <UpdateParameters>
                <asp:Parameter Name="MessageID" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:CookieParameter CookieName="Howave_UserName" Name="Sender" Type="String" />
            </SelectParameters>
 </asp:ObjectDataSource>  
 <asp:ObjectDataSource ID="MessageR" runat="server" SelectMethod="GetReceiverMessage" TypeName="MessageBLL" UpdateMethod="SetMessageDelR">
            <UpdateParameters>
                <asp:Parameter Name="MessageID" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:CookieParameter CookieName="Howave_UserName" Name="Receiver" Type="String" />
            </SelectParameters>
</asp:ObjectDataSource>
</asp:Content>