Example #1
0
        static void SaveStudentsListInFile(List <Student> students)
        {
            while (true)
            {
                try
                {
                    string outputFilePath = ConsoleUtils.ReadValue <string>("путь к файлу");

                    StudentsFilesUtils.SaveStudentsListInFile(outputFilePath, students);
                    break;
                }
                catch (Exception e)
                {
                }
            }

            Console.WriteLine();
        }
Example #2
0
        private void saveFileDialog1_Click(object sender, EventArgs e)
        {
            if (saveFileDialog2.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    string path = saveFileDialog2.FileName;

                    List <Student> studentsList = StudentsDGVConvert.DGVToStudentsList(grid);
                    StudentsFilesUtils.SaveStudentsListInFile(path, studentsList);

                    MessagesUtils.ShowMessage("Данные сохранены в файл");
                }
                catch (Exception ex)
                {
                    MessagesUtils.ShowError("Ошибка сохранения в файл");
                }
            }
        }