Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var details = new ProjectDetails(int.Parse(Year.Text))
            {
                ConsultantName    = ConsultantName.Text,
                IsFreelancer      = IsFreelancer.Checked,
                Customer          = Customer.Text,
                CustomerReference = CustomerReference.Text,
                ProjectName       = ProjectName.Text,
            };

            var desktopPath = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
            var excel       = ExcelSheetBuilderBase.CreateBuilder(details).Build(details.Year);

            File.WriteAllBytes(details.GetFilename(desktopPath), excel);
            System.Diagnostics.Process.Start(details.GetFilename(desktopPath));
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            int           year           = DateTime.Now.Year;
            DirectoryInfo currentDllPath = new FileInfo(Environment.GetCommandLineArgs()[0]).Directory;

            IEnumerable <ProjectDetails> templates = ProjectDetailsFactory.CreateForYear(year);
            IEnumerable <ProjectDetails> projects  = ProjectDetailsFactory.CreateForProjects(currentDllPath, year);

            System.Console.WriteLine("Timesheet(s) created:");
            foreach (ProjectDetails projectDetails in templates.Union(projects))
            {
                var    builder  = ExcelSheetBuilderBase.CreateBuilder(projectDetails);
                byte[] excel    = builder.Build(projectDetails.Year);
                string fileName = projectDetails.GetFilename(currentDllPath);

                File.WriteAllBytes(fileName, excel);
                System.Console.WriteLine(fileName);
            }

            CreateKmVergoedingTemplate(year, currentDllPath);
        }