当前位置: 首页>>代码示例>>C#>>正文


C# Message.Save方法代码示例

本文整理汇总了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"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:29,代码来源:Fetch.cs

示例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();
               

            }
        }
开发者ID:WereDouglas,项目名称:amHealth,代码行数:41,代码来源:Messenger.cs

示例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();
        }
开发者ID:japi,项目名称:hmailserver,代码行数:14,代码来源:MessageIndexing.cs

示例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;
            }
开发者ID:nkm2k,项目名称:VersionOne.SDK.NET.ObjectModel,代码行数:24,代码来源:V1InstanceCreate.cs

示例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();
     }
 }
开发者ID:xingfudaiyan,项目名称:OA,代码行数:34,代码来源:MessageInfo.cs

示例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"));
        }
开发者ID:jrallo,项目名称:hMailServer,代码行数:30,代码来源:Fetch.cs


注:本文中的Message.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。