public static StudentsInformation Instance()
        {
            if (studentsInformation == null)
            {
                studentsInformation = new StudentsInformation();
            } // end if

            return(studentsInformation);
        } // end public static FriendsInformation Instance()
Example #2
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)//this class is useless

            {
                PrintUsage();
            }
            else
            {
                //Info st = new Info();
                StudentsInformation fi = StudentsInformation.Instance();
                fi.Load();

                String command = args[0].ToLower();

                if (command == "list")
                {
                    fi.Print();
                }
                else if (command == "add")
                {
                    if (args.Length >= 3)
                    {
                        int    id   = int.Parse(Console.ReadLine());
                        String name = args[2];
                        fi.AddStudent(id, name);
                        fi.Save();
                    }
                    else
                    {
                        PrintUsage();
                        return;
                    } // end if
                }
                else if (command == "remove")
                {
                    if (args.Length >= 2)
                    {
                        String name = args[1];
                        fi.RemoveStudent(name);
                        fi.Save();
                    }
                    else
                    {
                        PrintUsage();
                        return;
                    } // end if
                }
                else
                {
                    Console.WriteLine("Command not found: " + command);
                    PrintUsage();
                } // end if
            }
            // end if
            Console.ReadLine();
        } // end public static void Main(string[] args)