Пример #1
0
        //method for saving to csv file --- Not used
        //method for saving list to text for
        private void SaveToCsv()
        {
            gm.Header();

            Console.WriteLine("To save file");
            string filePath = gm.FilePath();

            if (!File.Exists(filePath))
            {
                Save(filePath);
            }
            else
            {
                Console.WriteLine("A file with this name exists.\nDo you wish to overwrite or append this file with the current working list?");

                if (gm.YesNo("Overwrite", "Append"))
                {
                    Overwrite(filePath);
                }
                else
                {
                    Append(filePath);
                }
            }

            StudentMenu();
        }
Пример #2
0
        //method for saving to csv file

        private void SaveToCsv()
        {
            generalMethod.Header();

            Console.WriteLine("To save file");

            //assign filePath (See FilePath method in General methods)

            string filePath = generalMethod.FilePath();

            // if the file doesn't exist

            if (!File.Exists(filePath))
            {
                //use save method
                Save(filePath);
            }
            else
            {
                // if the file does exist

                Console.WriteLine("A file with this name exists.\nDo you wish to overwrite or append this file with the current working list?");

                //use yesno bool method to present choice

                if (generalMethod.YesNo("Overwrite", "Append"))
                {
                    //use overwrite method
                    Overwrite(filePath);
                }
                else
                {
                    //use append method0.
                    Append(filePath);
                }
            }

            StudentMenu();
        }