コード例 #1
0
        private void ExportToCsvFile(string filename, List <Faculty> faculties)
        {
            TextFileUtil.CreateOrEmptyFile(filename);

            var separator     = ",";
            var exportStrings = new List <string>();

            exportStrings.Add("FacultyId" + separator + "Name");
            foreach (var faculty in faculties)
            {
                exportStrings.Add(faculty.FacultyId + separator + faculty.Name);
            }

            TextFileUtil.WriteStringList(filename, exportStrings);
        }
コード例 #2
0
        private void ExportToCsvFile(string filename, List <Student> students)
        {
            TextFileUtil.CreateOrEmptyFile(filename);

            var separator     = ",";
            var exportStrings = new List <string>();

            exportStrings.Add("StudentId" + separator + "Fio" + separator + "Address" + separator + "Phone" + separator + "AdmissionYear" + separator + "SpecialityId");
            foreach (var student in students)
            {
                exportStrings.Add(student.StudentId + separator + student.Fio + separator + student.Address + separator + student.Phone + separator + student.AdmissionYear + separator + student.SpecialityId);
            }

            TextFileUtil.WriteStringList(filename, exportStrings);
        }
コード例 #3
0
        private void ExportToCsvFile(string filename, List <Specialty> specialities)
        {
            TextFileUtil.CreateOrEmptyFile(filename);

            var separator     = ",";
            var exportStrings = new List <string>();

            exportStrings.Add("SpecialtyId" + separator + "Name" + separator + "FacultyId");
            foreach (var speciality in specialities)
            {
                exportStrings.Add(speciality.SpecialtyId + separator + speciality.Name + separator + speciality.FacultyId);
            }

            TextFileUtil.WriteStringList(filename, exportStrings);
        }
コード例 #4
0
        private void ExportToCsvFile(string filename, IEnumerable <ReportItem> reportItems)
        {
            TextFileUtil.CreateOrEmptyFile(filename);

            var separator     = ",";
            var exportStrings = new List <string>();

            exportStrings.Add("Year" + separator + "Faculty" + separator + "StudentsCount");
            foreach (var reportItem in reportItems)
            {
                exportStrings.Add(reportItem.Year + separator + reportItem.Faculty + separator + reportItem.StudentsCount);
            }

            TextFileUtil.WriteStringList(filename, exportStrings);
        }