/// <summary> /// Deprecated Method for adding a new object to the Messages EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMessages(Message message) { base.AddObject("Messages", message); }
void OnSaveMessage() { if ( string.IsNullOrEmpty(To) ) { ShowDialog( "Please select a recipient" ); return; } if ( string.IsNullOrEmpty(From)) { ShowDialog( "Please select a sender" ); return; } if ( string.IsNullOrEmpty( Body ) ) { ShowDialog( "Please fill in the body" ); return; } if ( string.IsNullOrEmpty( Subject ) ) { ShowDialog( "Please fill in the Subject" ); return; } var msg = new Message { Body = Body, From = From, To = To, Subject = Subject, TimeStamp = DateTime.Now }; try { _messageContext.InsertMessage(msg).Completed += MessageFinishedInserting; } catch (Exception ex) { ShowDialog(ex.Message); } ShowDialog("The message has been successfully sent"); }
/// <summary> /// Create a new Message object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="from">Initial value of the From property.</param> /// <param name="to">Initial value of the To property.</param> /// <param name="timeStamp">Initial value of the TimeStamp property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> public static Message CreateMessage(global::System.Int32 id, global::System.String from, global::System.String to, global::System.DateTime timeStamp, global::System.Boolean isDeleted) { Message message = new Message(); message.ID = id; message.From = from; message.To = to; message.TimeStamp = timeStamp; message.IsDeleted = isDeleted; return message; }