AddRecord() 공개 메소드

public AddRecord ( string t, string s, string m ) : void
t string
s string
m string
리턴 void
예제 #1
0
        static void Main(string[] args)
        {
            XmlHandler file = new XmlHandler();

            bool   loop = true;
            string iput;
            int    choice;

            while (loop)
            {
                Console.WriteLine("========================================");
                Console.WriteLine("1: Add Record");
                Console.WriteLine("2: Remove Record");
                Console.WriteLine("3: Print XML Document");
                Console.WriteLine("4: Exit");

                iput = Console.ReadLine();
                try
                {
                    choice = Int32.Parse(iput);
                }
                catch
                {
                    Console.WriteLine("Pick 1 - 4");
                    continue;
                }
                Console.WriteLine("========================================");
                switch (choice)
                {
                case 1:
                    Console.Write("Title : ");
                    string title = Console.ReadLine();
                    Console.Write("Sender : ");
                    string snder = Console.ReadLine();
                    Console.Write("Message : ");
                    string mess = Console.ReadLine();
                    file.AddRecord(title, snder, mess);
                    break;

                case 2:
                    Console.Write("Title to Delete : ");
                    file.RemoveRecord(Console.ReadLine());
                    break;

                case 3:
                    file.PrintDocument();
                    break;

                case 4:
                    return;
                }
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            XmlHandler file = new XmlHandler();

            bool loop = true;
            string iput;
            int choice;
            while(loop)
            {
                Console.WriteLine("========================================");
                Console.WriteLine("1: Add Record");
                Console.WriteLine("2: Remove Record");
                Console.WriteLine("3: Print XML Document");
                Console.WriteLine("4: Exit");

                iput = Console.ReadLine();
                try
                {
                    choice = Int32.Parse(iput);
                }
                catch
                {
                    Console.WriteLine("Pick 1 - 4");
                    continue;
                }
                Console.WriteLine("========================================");
                switch(choice)
                {
                    case 1:
                        Console.Write("Title : ");
                        string title = Console.ReadLine();
                        Console.Write("Sender : ");
                        string snder = Console.ReadLine();
                        Console.Write("Message : ");
                        string mess = Console.ReadLine();
                        file.AddRecord(title, snder, mess);
                        break;
                    case 2:
                        Console.Write("Title to Delete : ");
                        file.RemoveRecord(Console.ReadLine());
                        break;
                    case 3:
                        file.PrintDocument();
                        break;
                    case 4:
                        return;
                }
            }
        }