示例#1
0
        static void Main(string[] args)
        {
            string                    pathExcel                       = @"C:\Users\Usuario\Documents\archibos proyecto capstone\costos.xlsm";
            string                    pathProject                     = @"C:\Users\Usuario\Documents\archibos proyecto capstone\Modelo de proceso.mpp";
            ExcelExtractor            excelExtractor                  = new ExcelExtractor(pathExcel);
            MicrosoftProjectExtractor projectFileExtractor            = new MicrosoftProjectExtractor(pathProject);
            Dictionary <(string, Phase), List <Material> >  materials = excelExtractor.Extract();
            Dictionary <(string, Phase, int), List <Task> > tasks     = projectFileExtractor.Extract();

            Console.WriteLine("Materials:");
            foreach (KeyValuePair <(string, Phase), List <Material> > entry in materials)
            {
                Console.WriteLine(entry.Key.Item1 + "/" + entry.Key.Item2.ToString() + ":");
                foreach (Material material in entry.Value)
                {
                    Console.WriteLine(material.Name);
                }
            }
            Console.WriteLine("Task:");
            foreach (KeyValuePair <(string, Phase, int), List <Task> > entry in tasks)
            {
                Console.WriteLine(entry.Key.Item1 + "/" + entry.Key.Item2.ToString() + "/" + entry.Key.Item3.ToString() + ":");
                foreach (Task task in entry.Value)
                {
                    Console.WriteLine(task.Name);
                }
            }

            var key = Console.ReadKey();
        }
示例#2
0
        private Result ExtractAndTransform(string excelPath, string projectPath, Document revit)
        {
            TaskDialog mainDialog = new TaskDialog("Revit Extractor");

            try
            {
                ExcelExtractor excelExtractor = new ExcelExtractor(excelPath);

                Dictionary <(string, ProjectModel.Phase), List <ProjectModel.Material> > materials = excelExtractor.Extract();
            }
            catch
            {
                mainDialog.MainInstruction = "Error leyendo el archivo Excel";
                mainDialog.Show();
                return(Result.Failed);
            }

            try
            {
                MicrosoftProjectExtractor mpp = new MicrosoftProjectExtractor(projectPath);

                Dictionary <(string, ProjectModel.Phase, int), List <Task> > tasks = mpp.Extract();
            }
            catch
            {
                mainDialog.MainInstruction = "Error leyendo el archivo Project";
                mainDialog.Show();
                return(Result.Failed);
            }

            mainDialog.MainInstruction = "Archivos integrados exitosamente";
            mainDialog.Show();

            return(Result.Succeeded);
        }