コード例 #1
0
 /// <summary>
 /// Create a new Mail object.
 /// </summary>
 /// <param name="mailId">Initial value of the MailId property.</param>
 /// <param name="mailMessage">Initial value of the MailMessage property.</param>
 /// <param name="read">Initial value of the Read property.</param>
 /// <param name="starred">Initial value of the Starred property.</param>
 /// <param name="dateSent">Initial value of the DateSent property.</param>
 public static Mail CreateMail(global::System.Guid mailId, global::System.String mailMessage, global::System.Boolean read, global::System.Boolean starred, global::System.DateTime dateSent)
 {
     Mail mail = new Mail();
     mail.MailId = mailId;
     mail.MailMessage = mailMessage;
     mail.Read = read;
     mail.Starred = starred;
     mail.DateSent = dateSent;
     return mail;
 }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Mails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMails(Mail mail)
 {
     base.AddObject("Mails", mail);
 }
コード例 #3
0
        //same as above, pero walang db.save changes
        private bool _sendMessage(MessageModel messageModel)
        {
            if (messageModel.ReceipientProfileID < 1 || messageModel.SenderProfileID < 1)
            {
                return false;
            }
            UserProfile _sender = db.UserProfiles.Where(x => x.UserProfileId == messageModel.SenderProfileID).FirstOrDefault();
            UserProfile _recipient = db.UserProfiles.Where(x => x.UserProfileId == messageModel.ReceipientProfileID).FirstOrDefault();

            if (_sender == null || _recipient == null)
            {
                return false;
            }

            Event _event = db.Events.Where(ev => ev.EventId == messageModel.EventID).FirstOrDefault();

            Mail newMail = new Mail
            {
                DateSent = DateTime.Now,
                FromUserProfile = _sender,
                MailMessage = messageModel.Message,
                Read = false,
                ReferredEvent = _event,
                Starred = false,
                ToUserProfile = _recipient
            };

            db.Mails.AddObject(newMail);
            return true;
        }