/// <summary> /// Delete private message. /// </summary> /// <param name="messageID">Message identifier.</param> /// <param name="type">Type of message (sended or received).</param> public static void DeletePrivateMessage(Guid messageID, MessageType type) { ObjectParameter pkMessageID = new ObjectParameter("pkMessageID", messageID); using (SocialNetworkDBEntities record = new SocialNetworkDBEntities()) { if (type == MessageType.Posted) { record.spMessage(pkMessageID, null, null, null, null, null, true, null); } else { record.spMessage(pkMessageID, null, null, null, null, null, null, true); } } }
/// <summary> /// Set status 'read' to current message. /// </summary> /// <param name="messageID">Message identifier.</param> public static void SetReadStatus(Guid messageID) { ObjectParameter pkMessageID = new ObjectParameter("pkMessageID", messageID); using (SocialNetworkDBEntities record = new SocialNetworkDBEntities()) { record.spMessage(pkMessageID, null, null, null, null, true, null, null); } }
/// <summary> /// Send message to another user. /// </summary> /// <param name="senderID">Sender identifier.</param> /// <param name="receiverID">Receiver identifier.</param> /// <param name="header">Message title.</param> /// <param name="text">Message text.</param> public static void SendPrivateMessage(Guid senderID, Guid receiverID, String header, String text) { ObjectParameter pkMessageID = new ObjectParameter("pkMessageID", typeof(Guid)); using (SocialNetworkDBEntities record = new SocialNetworkDBEntities()) { record.spMessage(pkMessageID, senderID, receiverID, header, text, true, false, false); } }