Пример #1
0
 public override void Process(CmdTrigger trigger)
 {
     var nick = trigger.Args.NextWord();
     var messagetosend = trigger.Args.Remainder.Normalize();
     if (string.IsNullOrEmpty(nick) || string.IsNullOrEmpty(messagetosend))
     {
         trigger.Reply("Failed to parse input, please try again");
     }
     else
     {
         using (var db = new MessagesContainer())
         {
             var msg = new Message
                           {
                               DateLeft = DateTime.Now.ToString(),
                               FromIrcNick = trigger.User.Nick,
                               IrcNick = nick.ToLower(),
                               MessageText = messagetosend.ToLower()
                           };
             db.Messages.AddObject(msg);
             db.SaveChanges();
             trigger.Reply("Message saved");
             return;
         }
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Messages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMessages(Message message)
 {
     base.AddObject("Messages", message);
 }
 /// <summary>
 /// Create a new Message object.
 /// </summary>
 /// <param name="dateLeft">Initial value of the DateLeft property.</param>
 /// <param name="ircNick">Initial value of the IrcNick property.</param>
 /// <param name="messageText">Initial value of the MessageText property.</param>
 /// <param name="fromIrcNick">Initial value of the FromIrcNick property.</param>
 public static Message CreateMessage(global::System.String dateLeft, global::System.String ircNick, global::System.String messageText, global::System.String fromIrcNick)
 {
     Message message = new Message();
     message.DateLeft = dateLeft;
     message.IrcNick = ircNick;
     message.MessageText = messageText;
     message.FromIrcNick = fromIrcNick;
     return message;
 }