public static void CreateMessage(string senderUserName) { try { DatabaseAccess.DBConnectionOpen(); Message message = new Message(); DatabaseAccess.DBViewUsersforMessage(senderUserName); Console.WriteLine("Write the UserName of the receiver for your message!"); message.ReceiverUserName = Console.ReadLine(); DatabaseAccess.DBExistentUserToSendMessage(senderUserName, message.ReceiverUserName); message.SenderUserName = senderUserName; message.DateOfSubmission = DateTime.Now; Console.WriteLine("Write your Message:"); message.MessageData = Console.ReadLine(); DatabaseAccess.DBInsertMessage(message.DateOfSubmission, message.SenderUserName, message.ReceiverUserName, message.MessageData); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { DatabaseAccess.DBConnectionClose(); DatabaseAccess.DBConnectionDispose(); } }