本文整理汇总了C#中Message.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Message.Save方法的具体用法?C# Message.Save怎么用?C# Message.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestBodyStructureWithNonLatinCharacter
public void TestBodyStructureWithNonLatinCharacter()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string attachmentName = "本本本.zip";
string filename = Path.Combine(Path.GetTempPath(), attachmentName);
File.WriteAllText(filename, "tjena moss");
var message = new Message();
message.Charset = "utf-8";
message.AddRecipient("test", account.Address);
message.From = "Test";
message.FromAddress = account.Address;
message.Body = "hejsan";
message.Attachments.Add(filename);
message.Save();
TestSetup.AssertFolderMessageCount(account.IMAPFolders[0], 1);
var oSimulator = new IMAPSimulator();
oSimulator.ConnectAndLogon(account.Address, "test");
oSimulator.SelectFolder("INBOX");
string result = oSimulator.Fetch("1 BODYSTRUCTURE");
oSimulator.Disconnect();
// utf-8 representation of 本本本.zip:
Assert.IsTrue(result.Contains("=?utf-8?B?5pys5pys5pys?=.zip"));
}
示例2: Send
public static void Send(DBObject parent, string message, string number)
{
try
{
SmsSubmitPdu pdu;
byte dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);
int times = 1;
for (int i = 0; i < times; i++)
{
comm.SendMessage(pdu);
}
_message = new Message(parent);
_message.Org = "test";
_message.Type = "sms";
_message.Content = message;
_message.Contact = number;
_message.Dor = DateTime.Now.ToString();
_message.Sync = "F";
_message.Sent = "T";
_message.Save();
}
catch
{
_message = new Message(parent);
_message.Org = "test";
_message.Type = "sms";
_message.Content = message;
_message.Contact = number;
_message.Dor = DateTime.Now.ToString();
_message.Sync = "F";
_message.Sent = "F";
_message.Save();
}
}
示例3: SendMessage
private void SendMessage(string subject, string body, string to, string cc)
{
var message = new Message();
message.Charset = "UTF-8";
message.AddRecipient("test", "meta'[email protected]");
message.From = "Test";
message.FromAddress = "meta'[email protected]";
message.Subject = subject;
message.set_HeaderValue("To", to);
message.set_HeaderValue("cc", cc);
message.Body = body;
message.Save();
}
示例4: Message
///<summary>
/// Create a new Message with a subject and recipient.
///</summary>
///<param name="subject">Message subject.</param>
///<param name="messageBody">Message body.</param>
///<param name="recipients">Who this message will go to. May be null.</param>
///<param name="attributes">Required attributes.</param>
///<returns>A newly minted Message that exists in the VersionOne system.</returns>
public Message Message(string subject, string messageBody, ICollection<Member> recipients,
IDictionary<string, object> attributes) {
var message = new Message(instance) {
Name = subject,
Description = messageBody
};
if(recipients != null) {
foreach(var recipient in recipients) {
message.Recipients.Add(recipient);
}
}
AddAttributes(message, attributes);
message.Save();
return message;
}
示例5: SaveToDb
//数据持久化
internal static void SaveToDb(MessageInfo pMessageInfo, Message pMessage,bool pIsNew)
{
pMessage.MessageId = pMessageInfo.messageId;
pMessage.Memo = pMessageInfo.memo;
pMessage.RecvEmployeeId = pMessageInfo.recvEmployeeId;
pMessage.Msg = pMessageInfo.msg;
pMessage.Url = pMessageInfo.url;
pMessage.EmployeeName = pMessageInfo.employeeName;
pMessage.MsgType = pMessageInfo.msgType;
pMessage.MsgTime = pMessageInfo.msgTime;
pMessage.MsgTitle = pMessageInfo.msgTitle;
pMessage.IsNew=pIsNew;
string UserName = SubsonicHelper.GetUserName();
try
{
pMessage.Save(UserName);
}
catch(Exception ex)
{
LogManager.getInstance().getLogger(typeof(MessageInfo)).Error(ex);
if(ex.Message.Contains("插入重复键"))//违反了唯一键
{
throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
}
throw new AppException("保存失败");
}
pMessageInfo.messageId = pMessage.MessageId;
//如果缓存存在,更新缓存
if (CachedEntityCommander.IsTypeRegistered(typeof(MessageInfo)))
{
ResetCache();
}
}
示例6: TestFetchBody
public void TestFetchBody()
{
Account account = SingletonProvider<TestSetup>.Instance.AddAccount(_domain, "[email protected]", "test");
string attachmentName = "本本本.zip";
string filename = Path.Combine(Path.GetTempPath(), attachmentName);
File.WriteAllText(filename, "tjena moss");
var message = new Message();
message.Charset = "utf-8";
message.AddRecipient("test", account.Address);
message.From = "Test";
message.FromAddress = account.Address;
message.Body = "hejsan";
message.Attachments.Add(filename);
message.Save();
TestSetup.AssertFolderMessageCount(account.IMAPFolders[0], 1);
var oSimulator = new IMAPSimulator();
oSimulator.ConnectAndLogon(account.Address, "test");
oSimulator.SelectFolder("INBOX");
string bodyStructureResponse = oSimulator.Fetch("1 BODYSTRUCTURE");
string bodyResponse = oSimulator.Fetch("1 BODY");
oSimulator.Disconnect();
Assert.IsTrue(bodyStructureResponse.Contains("BOUNDARY"));
Assert.IsFalse(bodyResponse.Contains("BOUNDARY"));
}