コード例 #1
0
            public void EditMessage(int messageid, string receiver)
            {
                string Sender     = Username;
                string Receiver   = receiver;
                int    idtoselect = messageid;

                bool check = Database_Access.SenderCheck(Username, idtoselect);

                if (check == true)
                {
                    Console.WriteLine("Type your new message, limit 250 characters.");
                    string newcontent = Console.ReadLine();
                    Database_Access.EditMessage(newcontent, Sender, Receiver, idtoselect);
                    Console.Clear();
                    Console.WriteLine("Message editing complete!");
                    ViewHistory(receiver);
                    Message messagetoedit = Database_Access.IdRetrieve(idtoselect);
                    File_Acess.EditMessage(messagetoedit);
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("You can't edit message you haven't sent.");
                }
            }
コード例 #2
0
            public static void SendMessage(string receiver)
            {
                Console.WriteLine("Type your message, limit 250 characters.");
                string content = Console.ReadLine();
                int    sentid  = Database_Access.MessageSend(Username, receiver, content);

                Console.Clear();
                ViewHistory(receiver);
                Message messagetosend = Database_Access.Sentid(sentid);

                File_Acess.NewMessage(messagetosend);
            }
コード例 #3
0
            public void DeleteMessage(int messageid, string receiver)
            {
                string Sender     = Username;
                string Receiver   = receiver;
                int    idtoselect = messageid;
                bool   check      = Database_Access.SenderCheck(Sender, idtoselect);

                if (check == true)
                {
                    Database_Access.MessageDeletion(Sender, Receiver, idtoselect);
                    Console.Clear();
                    Console.WriteLine("Message deletion complete!");
                    ViewHistory(receiver);
                    Message messagetodelete = Database_Access.IdRetrieve(idtoselect);
                    File_Acess.DeleteMessage(messagetodelete);
                }

                else
                {
                    Console.Clear();
                    Console.WriteLine("You can't delete messages you haven't sent.");
                }
            }