<%@ page language="C#" masterpagefile="MyShopMasterPage.master" autoeventwireup="true" inherits="Member_Shop_Message, mallz" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script type="text/javascript">
function setButtonActive(flags)
{  
    if(flags=="")
        flags = 1;
    var _flag=parseInt(flags);
    var ulObj=document.getElementById("M1");
    if(_flag==1)
    {
        ulObj.childNodes[0].className="active";
        ulObj.childNodes[1].className="";
    }
    else if(_flag==2){
        ulObj.childNodes[0].className="";
        ulObj.childNodes[1].className="active";
    }
    else{
        ulObj.childNodes[0].className="";
        ulObj.childNodes[1].className="";
    }
}
</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?tag=R" >收件夹</a></li><li><a href="Shop_Message.aspx?tag=S" >发件夹</a></li></ul>
    </div>
    
    <div class="TabText">
    
       <asp:PlaceHolder ID="Panel1" runat="server" Visible="True"> 
           <div style="clear:both; width:98%; padding:5px 0 0 5px">
			    <div class="NewMail">
			       <a href="Shop_Message.aspx?action=send"><img alt="" src="/Images/Member/sendmsg.gif" /></a>
                </div>
           </div>
           <div style="clear:both;height:3px;"></div>
           
           <asp:GridView ID="GridView_R" runat="server" AllowPaging="True" AutoGenerateColumns="False"  PageSize="20" Width="98%" Height="100%"  CssClass="tableHead" Visible="false" >
                <Columns>
                     <asp:TemplateField HeaderText="主题" ItemStyle-HorizontalAlign="Left">
                        <ItemTemplate>
                            &nbsp;<b><asp:HyperLink ID="Message_Title" Text='<%# Eval("Title") %>' runat="server" NavigateUrl='<%# "?action=read&tag=R&re=true&MessageID="+Eval("MessageID") %>'  /></b>
                        </ItemTemplate>  
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="发送者">
                        <ItemTemplate>
                            <asp:HyperLink ID="Message_User" runat="server" Target="_blank" Text='<%#Eval("Sender") %>' /> 
                        </ItemTemplate>
                        <HeaderStyle Width="20%" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="SendTime" HeaderText="发送日期"  HeaderStyle-Width="15%"/>
                    <asp:TemplateField HeaderText="状态" HeaderStyle-Width="10%">
                        <ItemTemplate>
                            <asp:Literal ID="txtIsRead" runat="server" Text='<%# (Eval("IsRead").ToString()=="1")?"已读":"未读" %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <asp:HyperLink ID="HLRead" Text="打开"  runat="server"    NavigateUrl='<%# "?action=read&MessageID="+Eval("MessageID") %>'  /> |
                            <asp:LinkButton ID="HLDelete" Text="删除" runat="server" CommandName='<%# Eval("MessageID") %>'  OnCommand="DeleteMessage" OnClientClick="return confirm('确定要删除此站内短信吗？');"/>
                        </ItemTemplate>
                        <HeaderStyle Width="15%" />
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                        <table class="tableHeader" style="width:98%"><th>主题</th><th>发送者</th><th>发送日期</th><th>状态</th><th>操作</th>
                        <tr><td colspan="5">暂无短消息！</td></tr></table>
                </EmptyDataTemplate>
           </asp:GridView>
           
           <asp:GridView ID="GridView_S" runat="server" AllowPaging="True" AutoGenerateColumns="False" PageSize="20" Width="98%" Height="100%" CssClass="tableHead" Visible="false">
                <Columns>
                     <asp:TemplateField HeaderText="主题" ItemStyle-HorizontalAlign="Left" ItemStyle-Font-Bold="true">   
                        <ItemTemplate>
                            &nbsp;<b><asp:HyperLink ID="Message_Title" Text='<%# Eval("Title") %>' runat="server" NavigateUrl='<%# "?action=read&MessageID="+Eval("MessageID") %>'/></b>
                        </ItemTemplate>  
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="接收者">
                        <ItemTemplate>
                            <asp:HyperLink ID="Message_User" runat="server" Target="_blank" Text='<%#Eval("Receiver") %>' /> 
                        </ItemTemplate>
                        <HeaderStyle Width="20%" />
                    </asp:TemplateField>                
                    <asp:BoundField DataField="SendTime" HeaderText="发送日期"  HeaderStyle-Width="15%"/>
                    <asp:TemplateField HeaderText="状态" HeaderStyle-Width="10%">
                        <ItemTemplate>
                            <asp:Literal ID="txtIsRead" runat="server" Text='<%# (Eval("IsRead").ToString()=="1")?"已读":"未读" %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <asp:HyperLink ID="HLRead" Text="查看" runat="server" NavigateUrl='<%# "?action=read&MessageID="+Eval("MessageID") %>'/> |
                            <asp:LinkButton ID="HLDelete" Text="删除" runat="server" CommandName='<%# Eval("MessageID") %>'  OnCommand="DeleteMessage" OnClientClick="return confirm('确定要删除此站内短信吗？');"/>
                        </ItemTemplate>
                        <HeaderStyle Width="15%" />
                    </asp:TemplateField>
                 
                </Columns>
                <EmptyDataTemplate><table class="tableHeader" style="width:98%"><th>主题</th><th>接收者</th><th>发送日期</th><th>状态</th><th>操作</th>
                <tr><td colspan="5">暂无短消息！</td></tr>
                </table></EmptyDataTemplate>
           </asp:GridView>
       </asp:PlaceHolder>
       

        <asp:FormView ID="FormView1" DataKeyNames="MessageID" runat="server" Width="100%" Visible="false"  OnModeChanging="FormView1_ModeChanging" >
           <InsertItemTemplate>
			<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="history.back()" value="返 回" />                     
                    </td>
                </tr>
            </table>
            </InsertItemTemplate>
            
            <ItemTemplate>
			<table class="ShopOrderStyle" style="width:100%">
                <caption><asp:literal ID="Literal1" runat="server" Text="查看短消息" /></caption>
                <tr>
                <td class="OrderTitle">收件人：</td>
                <td>
                      <asp:Literal ID="TextReceiver" runat="server" Text='<% #Eval("Sender") %>'/>
                </td>
                </tr>
                <tr>
                <td class="OrderTitle">主题：</td>
                <td>
                        <asp:Literal ID="TextTitle" runat="server" Text='<%#Eval("Title") %>'/>
                </td> 
                </tr>
                <tr>
                <td class="OrderTitle">内容：</td>
                <td>
                        <asp:TextBox ID="TextContent" ReadOnly="true" runat="server" Height="300px" TextMode="MultiLine" Width="400px" Text='<%#Eval("Content") %>' />
                </td>
                </tr>
                <tr>
                <td>&nbsp;</td>
                <td>
                        <asp:Button ID="Button1" runat="server" Text="回 复" OnClientClick='<%# "javascript:{location.href=\"?action=send&MessageID=" + Eval("MessageID") + "\";return false;}" %>' />
                        <input type="button" onclick="history.back()" value="返 回" />
                      
                    </td>
                </tr>
            </table>
            </ItemTemplate>
            
            
       </asp:FormView>
        
   </div>
</div>
<script type="text/javascript">setButtonActive('<%=m_flag %>');</script>  
</asp:Content>