Esempio n. 1
0
        private void SendMessage()
        {
            while (true)
            {
                MailRepository mrepo    = new MailRepository();
                Message        message1 = new Message();
                Console.Clear();
                message1.Sender = LoggedUser;
                Console.WriteLine("Reciever username:"******"Message:");
                message1.Messages = Console.ReadLine();
                if (message1.Sender != null && message1.Reciever != null)
                {
                    int sent = mrepo.InsertMail(message1);
                    if (sent > 0)
                    {
                        Console.WriteLine("Message successfully sent!");
                        Thread.Sleep(1500);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Invalid reciever/operation!Failed sending message!");
                        Console.ReadKey(true);
                    }
                }
                else
                {
                    Console.WriteLine("Invalid sender or reciever!");
                    Console.ReadKey(true);
                }
            }
        }