Esempio n. 1
0
 //myawesomefeature goes here
 public void SaveToFile(SRP_Report report, string directoryPath, string fileName)
 {
     if (!Directory.Exists(directoryPath))
     {
         Directory.CreateDirectory(directoryPath);
     }
     File.WriteAllText(Path.Combine(directoryPath, fileName), ToString());
 }
        static void Main(string[] args)
        {
            var report = new SRP_Report();

            report.AddEntry(new WorkReportEntry {
                ProjectCode = "pro1", ProjectName = "SRP_Report", SpentHours = 2
            });
            report.AddEntry(new WorkReportEntry {
                ProjectCode = "pro2", ProjectName = "OCP_Project", SpentHours = 1
            });
            var save = new SavingFile();

            save.SaveToFile(report, "Myfiles", "Proect1.txt");
            Console.WriteLine(report.ToString());
            Console.ReadKey();
        }