<%@ Page language="c#" AutoEventWireup="false" EnableViewState="false" Inherits="SocoShop.Page.MessageAjax" %>
<%@ Import namespace="SocoShop.Entity" %>
<%@ Import namespace="SocoShop.Business" %>
<%@ Import namespace="SocoShop.Common" %>
<%@ Import namespace="SkyCES.EntLib" %>
<%@ Import namespace="System.Diagnostics" %>
<script runat="server">
protected override void OnInit(EventArgs e)
{
	/* 
		本页面代码由天易模板生成于 2011/3/6 19:11:38.
	*/
	Stopwatch sw = new Stopwatch();
	sw.Start();
	base.OnInit(e);
	sw.Stop();
	 decimal processTime=Convert.ToDecimal(sw.ElapsedMilliseconds) / 1000;
	StringBuilder document = new StringBuilder();
	switch(action)
{
	case "ReceiveMessage":
	document.Append("    <table class=\"listTable\" cellpadding=\"0\" cellpadding=\"0\">\r\n");
	document.Append("        <tr class=\"listTableHead\">                 \r\n");
	document.Append("            <td width=\"5%\"><input type=\"checkbox\" name=\"All\" onclick=\"selectAll(this)\" /></td>\r\n");
	document.Append("            <td width=\"6%\">状态</td>\r\n");
	document.Append("            <td width=\"60%\" style=\"text-align:left;padding-left:5px;\">主题</td>\r\n");
	document.Append("            <td width=\"15%\">发件人</td>\r\n");
	document.Append("            <td width=\"14%\">日期</td>\r\n");
	document.Append("        </tr>\r\n");
	foreach(ReceiveMessageInfo receiveMessage in receiveMessageList)
{
	document.Append("        <tr class=\"listTableMain\">                \r\n");
	document.Append("            <td><input type=\"checkbox\" name=\"SelectID\" value=\""+receiveMessage.ID+"|"+receiveMessage.IsRead +"\"/></td>\r\n");
	document.Append("            <td>\r\n");
	if(receiveMessage.IsRead==1)
{
	document.Append("是\r\n");
	}
else
{
	document.Append("否\r\n");
	 }
	document.Append("</td>\r\n");
	document.Append("            <td style=\"text-align:left;padding-left:5px;\"><a href=\"/User/ReadMessage.aspx?ID="+receiveMessage.ID+"\" target=\"_blank\">"+receiveMessage.Title +"</a></td>\r\n");
	document.Append("            <td>\r\n");
	if(receiveMessage.IsAdmin==1)
{
	document.Append("系统消息\r\n");
	}
else
{
	document.Append(""+receiveMessage.UserName +"\r\n");
	 }
	document.Append("</td>\r\n");
	document.Append("            <td>"+receiveMessage.Date.ToString("yyyy-MM-dd") +"</td>\r\n");
	document.Append("        </tr>\r\n");
	}
	document.Append("    </table>\r\n");
	document.Append("    <div class=\"height10\"></div>\r\n");
	document.Append("    <strong>选择：</strong><a href=\"javascript:selectMessage('All')\">全部</a> - <a href=\"javascript:selectMessage('None')\">不选</a> - <a href=\"javascript:selectMessage('HasRead')\">已读</a> - <a href=\"javascript:selectMessage('NoRead')\">未读</a>\r\n");
	document.Append("    <div class=\"height10\"></div>\r\n");
	document.Append("    <div><input type=\"button\" class=\"button\" value=\"删除\"  onclick=\"deleteMessage('Receive')\"/>"+ajaxPagerClass.ShowPage()+"</div>\r\n");
	break;
	case "SendMessage":
	document.Append("    <table class=\"listTable\" cellpadding=\"0\" cellpadding=\"0\">\r\n");
	document.Append("        <tr class=\"listTableHead\">                 \r\n");
	document.Append("            <td width=\"5%\"><input type=\"checkbox\" name=\"All\" onclick=\"selectAll(this)\" /></td>                \r\n");
	document.Append("            <td width=\"30%\" style=\"text-align:left;padding-left:5px;\">主题</td>\r\n");
	document.Append("            <td width=\"50%\">收件人</td>\r\n");
	document.Append("            <td width=\"15%\">日期</td>\r\n");
	document.Append("        </tr>\r\n");
	foreach(SendMessageInfo sendMessage in sendMessageList)
{
	document.Append("        <tr class=\"listTableMain\">                \r\n");
	document.Append("            <td><input type=\"checkbox\" name=\"SelectID\" value=\""+sendMessage.ID +"\"/></td>                \r\n");
	document.Append("            <td style=\"text-align:left;padding-left:5px;\"><a  href=\"MessageDetail.aspx?ID="+sendMessage.ID+"\" target=\"_blank\">"+sendMessage.Title +"</a></td>\r\n");
	document.Append("            <td>"+sendMessage.ToUserName +"</td>\r\n");
	document.Append("            <td>"+sendMessage.Date.ToString("yyyy-MM-dd") +"</td>\r\n");
	document.Append("        </tr>\r\n");
	}
	document.Append("    </table>\r\n");
	document.Append("    <div class=\"height10\"></div>\r\n");
	document.Append("    <strong>选择：</strong><a href=\"javascript:selectMessage('All')\">全部</a> - <a href=\"javascript:selectMessage('None')\">不选</a>\r\n");
	document.Append("    <div class=\"height10\"></div>\r\n");
	document.Append("    <div><input type=\"button\" class=\"button\" value=\"删除\"  onclick=\"deleteMessage('Send')\"/>"+ajaxPagerClass.ShowPage()+"</div>\r\n");
	break;
	case "WriteMessage":
	document.Append("    <div class=\"sendMsg\">\r\n");
	document.Append("        <dl>\r\n");
	document.Append("            <dt>收件人</dt>\r\n");
	document.Append("            <dd>&nbsp;<input type=\"hidden\" id=\"UserIDList\" /><input  id=\"UserNameList\" type=\"hidden\"><span id=\"UserNameShow\"></span></dd>\r\n");
	document.Append("        </dl>\r\n");
	document.Append("        <dl>\r\n");
	document.Append("            <dt>主题</dt>\r\n");
	document.Append("            <dd><input type=\"text\" class=\"input\" style=\"width:415px\" id=\"Title\" /> <span style=\"color:Red\">*</span></dd>\r\n");
	document.Append("        </dl>\r\n");
	document.Append("        <dl>\r\n");
	document.Append("            <dt>正文</dt>\r\n");
	document.Append("            <dd><textarea style=\"width:420px;height:180px\" class=\"textarea\" name=\"Content\" id=\"Content\"></textarea></dd>\r\n");
	document.Append("        </dl>\r\n");
	document.Append("        <dl>\r\n");
	document.Append("            <dt>&nbsp;</dt>\r\n");
	document.Append("            <dd><input type=\"button\" class=\"button\" value=\"发送\" onclick=\"sendMessage()\" /></dd>\r\n");
	document.Append("        </dl>\r\n");
	document.Append("    </div>\r\n");
	document.Append("    <div class=\"friendSide\">\r\n");
	document.Append("        <dl>\r\n");
	document.Append("            <dt>\r\n");
	document.Append("                <input type=\"text\" id=\"FriendName\"   value=\"查找好友...\" onfocus=\"if(this.value=='查找好友...'){this.value=''}\"  /> <input type=\"button\" class=\"button\" value=\"搜索\" onclick=\"searchFriends()\" />\r\n");
	document.Append("            </dt>\r\n");
	document.Append("            <dd id=\"UserList\">\r\n");
	foreach(UserFriendInfo userFriend in userFriendList)
{
	document.Append("            <a href=\"javascript:addUser("+userFriend.FriendID+",'"+userFriend.FriendName+"')\" id=\"User"+userFriend.FriendID+"\">"+userFriend.FriendName+"</a>            \r\n");
	}
	document.Append("            </dd>\r\n");
	document.Append("        </dl>\r\n");
	document.Append("    </div>\r\n");
	break;
	default:
	break;
	
 }
	Response.Write(document.ToString());
}
</script>