Esempio n. 1
0
        public void SaveToFile(string directoryPath, string fileName, WorkReport report)
        {
            if (!Directory.Exists(directoryPath))
            {
                Directory.CreateDirectory(directoryPath);
            }

            File.WriteAllText(Path.Combine(directoryPath, fileName), report.ToString());
        }
Esempio n. 2
0
        public static void ExecuteWithSRP()
        {
            var report = new WorkReport();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "123Ds", ProjectName = "Project1", SpentHours = 5
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "987Fc", ProjectName = "Project2", SpentHours = 3
            });

            Console.WriteLine(report.ToString());

            var saver = new FileSaver();

            saver.SaveToFile(@"Reports", "WorkReport.txt", report);
        }