本文整理汇总了C#中Messages.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Messages.Save方法的具体用法?C# Messages.Save怎么用?C# Messages.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessage
public static void SendMessage(Messages message)
{
message.Save();
Messages.SendPushMessageToEvent(message);
}
示例2: SendInvitations
public string SendInvitations(Account sender, string ToEmailArray, string Message)
{
string resultMessage = Message;
foreach (string s in ToEmailArray.Split(new char[] { ',', ';' }))
{
FriendInvitation friendInvitation = new FriendInvitation();
friendInvitation.AccountID = sender.AccountID;
friendInvitation.Email = s;
friendInvitation.GUID = Guid.NewGuid();
friendInvitation.BecameAccountID = 0;
FriendInvitation.SaveFriendInvitation(friendInvitation);
//add alert to existing users alerts
Account account = Account.GetAccountByEmail(s);
if (account != null)
{
_alertService.AddFriendRequestAlert(_userSession.CurrentUser, account, friendInvitation.GUID,
Message);
}
//CHAPTER 6
//TODO: MESSAGING - if this email is already in our system add a message through messaging system
//if(email in system)
//{
// add message to messaging system
//}
//else
//{
// send email
SendFriendInvitation(s, sender.FirstName, sender.LastName, friendInvitation.GUID.ToString(), Message);
//send into mailbox
Message = sender.FirstName + " " + sender.LastName +
"Muốn kết bạn với bạn!<HR><a href=\"" + _configuration.RootURL +
"Friends/ConfirmFriendInSite.aspx?InvitationKey=" + friendInvitation.GUID.ToString() + "\">" + _configuration.RootURL +
"Friends/ConfirmFriendInSite.aspx?InvitationKey=" + friendInvitation.GUID.ToString() + "</a><HR>" + Message;
Messages m = new Messages();
m.Body = Message;
m.Subject = "Thư mời kết bạn";
m.CreateDate = DateTime.Now;
m.MessageTypeID = (int)MessageTypes.FriendRequest;
m.SentByAccountID = _userSession.CurrentUser.AccountID;
m.MessageID = 0;
m.Save();
Int64 messageID = m.MessageID;
MessageRecipient sendermr = new MessageRecipient();
sendermr.AccountID = _userSession.CurrentUser.AccountID;
sendermr.MessageFolderID = (int)MessageFolders.Sent;
sendermr.MessageRecipientTypeID = (int)MessageRecipientTypes.TO;
sendermr.MessageID = messageID;
sendermr.MessageStatusTypeID = (int)MessageStatusTypes.Unread;
sendermr.MessageRecipientID = 0;
sendermr.Save();
Account toAccount = Account.GetAccountByEmail(s);
if (toAccount != null)
{
MessageRecipient mr = new MessageRecipient();
mr.AccountID = toAccount.AccountID;
mr.MessageFolderID = (int)MessageFolders.Inbox;
mr.MessageID = messageID;
mr.MessageRecipientTypeID = (int)MessageRecipientTypes.TO;
mr.MessageRecipientID = 0;
mr.MessageStatusTypeID = 1;
mr.Save();
//_email.SendNewMessageNotification(toAccount, toAccount.Email);
}
//}
resultMessage += "• " + s + "<BR>";
}
return resultMessage;
}