本文整理汇总了C#中MessageHandler.GetMessageDetails方法的典型用法代码示例。如果您正苦于以下问题:C# MessageHandler.GetMessageDetails方法的具体用法?C# MessageHandler.GetMessageDetails怎么用?C# MessageHandler.GetMessageDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageHandler
的用法示例。
在下文中一共展示了MessageHandler.GetMessageDetails方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//Check whether the proper message is being passed or not
if (Request.QueryString["id"] == null)
{
Response.Redirect("Default.aspx");
}
MessageHandler msgHandler = new MessageHandler();
Message msg = msgHandler.GetMessageDetails(CookiesWrapper.thisUserID.ToString(), Convert.ToInt32(Request.QueryString["id"]));
//Some one is trying to access a mail that is not supposed to see so kick him out
if (msg == null)
{
Response.Redirect("Default.aspx");
}
lblSender.Text = msg.SenderId;
lblReciever.Text = msg.RecieverId;
lblSubject.Text = msg.Subject;
lblBody.Text = Server.HtmlDecode(msg.Body);
lblDate.Text = msg.Date.ToString();
Session["Message"] = msg;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!(HttpContext.Current.User.Identity.IsAuthenticated))
{
FormsAuthentication.SignOut();
Session.Clear();
Response.Redirect("~/Default");
}
messageList = new List<Message>();
String currentlyLoggedUserName = HttpContext.Current.User.Identity.Name;
currentlyLoggedUserID = Membership.GetUser(currentlyLoggedUserName).ProviderUserKey.ToString();
if (currentlyLoggedUserID == null)
{
Response.Redirect("~/Default");
}
//Check whether the proper message is being passed or not
//the id here is the messageId
if (Request.QueryString["id"] == null)
{
Response.Redirect("Default.aspx");
}
MessageID = Convert.ToInt32(Request.QueryString["id"]);
MessageHandler msgHandler = new MessageHandler();
Message msg = msgHandler.GetMessageDetails(MessageID);
//Some one is trying to access a mail that is not supposed to see so kick him out
if (msg == null)
{
Response.Redirect("Default.aspx");
}
//give me a list of all messages where the SenderId=him and RecieverId=me or SenderId=me and RecieverId=him order by datentime ASC
recieverID = msg.RecieverId;
senderID = msg.SenderId;
//get all conversations between the reciever(currentlyLoggedUserID) and the sender
//the sender is gotten from the messageID that is gotten when ther clicks on the message in Inbox
DataTable dt = msgHandler.getConversation(recieverID, senderID);
if (dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
int msgID = Convert.ToInt32(dr["MessageID"].ToString());
System.Diagnostics.Debug.WriteLine("MessageID is = " + msgID);
Message msgTemp = msgHandler.GetMessageDetails(msgID);
System.Diagnostics.Debug.WriteLine("msgTemp is = " + msgTemp);
this.messageList.Add(msgTemp);
}
}
else
{
Console.WriteLine("No rows found.");
}
createTable();
}