Example #1
0
 public ProjectBO Create(ProjectBO bo)
 {
     using (var unitOfWork = _uow)
     {
         var convertedEntity = _converter.Convert(bo);
         var createdEntity   = unitOfWork.ProjectRepository.Create(convertedEntity);
         unitOfWork.Complete();
         return(_converter.Convert(createdEntity));
     }
 }
 public void ConvertProjectPassTest()
 {
     foreach (var entity in projects)
     {
         var projectBO = proConv.Convert(entity);
         Assert.NotNull(projectBO);
         Assert.Equal(entity.ProjectName, projectBO.ProjectName);
         Assert.Equal(entity.CreatorName, projectBO.CreatorName);
         Assert.Equal(entity.CustomerName, projectBO.CustomerName);
         Assert.Equal(entity.Id, projectBO.Id);
     }
 }
Example #3
0
        public ProjectBO Create(ProjectBO project)
        {
            if (project == null)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var createdProject = uow.ProjectRepository.Create(_conv.ConvertBO(project));
                uow.Complete();
                return(_conv.Convert(createdProject));
            }
        }
        public PackingListBO Get(int Id)
        {
            if (Id < 1)
            {
                return(null);
            }

            using (var uow = _facade.UnitOfWork)
            {
                var packingList = _convPL.Convert(uow.PackingListRepository.Get(Id));
                if (packingList != null)
                {
                    packingList.Projects = uow.ProjectRepository.GetAllById(packingList.ProjectIds)
                                           .Select(p => _conv.Convert(p))
                                           .ToList();

                    packingList.ColliLists = uow.ColliListRepository.GetAllById(packingList.ColliListIds)
                                             .Select(cl => _convCL.Convert(cl))
                                             .ToList();

                    packingList.PackItems = uow.PackItemRepository.GetAllById(packingList.PackItemsIds)
                                            .Select(pi => _convPI.Convert(pi))
                                            .ToList();
                }
                uow.Complete();
                return(packingList);
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                System.Console.WriteLine("Please specify a project file.");
                return;
            }


#if DEBUG
            var progress = new Progress <string>(x => Debug.WriteLine(x));
#else
            var progress = new Progress <string>(System.Console.WriteLine);
#endif

            var convertedProjects = ProjectConverter.Convert(args[0], progress)
                                    .Where(x => x != null)
                                    .ToList();

            if (!args.Contains("--dry-run"))
            {
                var doBackup = !args.Contains("--no-backup");

                var writer = new Writing.ProjectWriter(x => x.Delete(), _ => { });
                foreach (var project in convertedProjects)
                {
                    writer.Write(project, doBackup, progress);
                }
            }
        }
Example #6
0
        public List <ContractGridBO> GetAll()
        {
            var contractGridBOs = new List <ContractGridBO>();

            using (var unitOfWork = _uow)
            {
                var contracts = unitOfWork.ContractRepository.GetAll();
                foreach (var contract in contracts)
                {
                    var project = _projectConverter.Convert(unitOfWork.ProjectRepository.Get(contract.ProjectId));

                    var newContractGridBO = new ContractGridBO
                    {
                        Contract = _contractConverter.Convert(contract),
                        Project  = project,
                        Company  = _companyConverter.Convert(unitOfWork.CompanyRepository.Get(contract.CompanyId))
                    };

                    if (project.WantedSupervisorId != null)
                    {
                        newContractGridBO.WantedSupervisor = _supervisorConverter.Convert(unitOfWork.SupervisorRepository.Get((int)project.WantedSupervisorId));
                    }
                    if (project.AssignedSupervisorId != null)
                    {
                        newContractGridBO.AssignedSupervisor = _supervisorConverter.Convert(unitOfWork.SupervisorRepository.Get((int)project.AssignedSupervisorId));
                    }
                    contractGridBOs.Add(newContractGridBO);
                }
                unitOfWork.Complete();
                return(contractGridBOs);
            }
        }
Example #7
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Projects.Clear();

                var client   = new WebClient();
                var response = await client.GetProjects();

                IsVisibleProjects = response.Response.Items.Count > 0;

                foreach (var item in response.Response.Items)
                {
                    Projects.Add(ProjectConverter.Convert(item));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #8
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                System.Console.WriteLine($"Please specify a project file.");
                return;
            }

            var writer = new Project2015To2017.Writing.ProjectWriter();

            foreach (var definition in ProjectConverter.Convert(args[0], new Progress <string>(System.Console.WriteLine)))
            {
                writer.Write(definition);
            }
        }
        public void Money_Budget_Type_Should_Be_Mapped_From_Xml()
        {
            string input = @"<?xml version=""1.0"" encoding=""UTF-8""?>
                        <project>
                           <id type=""integer"">123</id>
                           <name>Website Konzeption</name>
                           <note></note>
                           <budget type=""integer"">0</budget>
                           <budget-type>cents</budget-type>
                           <archived type=""boolean"">false</archived>
                           <customer-id type=""integer"">2</customer-id>
                           <customer-name>LilaLaune GmbH</customer-name>
                           <updated-at type=""datetime"">2007-12-13T12:12:00+01:00</updated-at>
                           <created-at type=""datetime"">2007-12-13T12:12:00+01:00</created-at>
                        </project>
                        ";

            ProjectConverter projectConverter = new ProjectConverter();
            Project project = projectConverter.Convert(input);

            Assert.That(project.BudgetType, Is.EqualTo(BudgetType.cents));
        }
Example #10
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                System.Console.WriteLine("Please specify a project file.");
                return;
            }

            var writer = new Writing.ProjectWriter();

            var progress = new Progress <string>(System.Console.WriteLine);

            var convertedProjects = ProjectConverter.Convert(args[0], progress)
                                    .Where(x => x != null)
                                    .ToList();

            if (!args.Contains("--dry-run"))
            {
                foreach (var project in convertedProjects)
                {
                    writer.Write(project, progress);
                }
            }
        }
Example #11
0
        public void Money_Budget_Type_Should_Be_Written_To_Xml()
        {
            Project project = new Project();
           // project.Name = "test";
            project.BudgetType = BudgetType.cents;

            ProjectConverter projectConverter = new ProjectConverter();
            string xml = projectConverter.Convert(project);

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(xml);

            XmlNode value = xmlDocument.SelectSingleNode("/project/budget-type");

            Assert.That(value.InnerText, Is.EqualTo("cents"));
        }
Example #12
0
        private static void ConvertProject(Options options)
        {
#if DEBUG
            var progress = new Progress <string>(x => Debug.WriteLine(x));
#else
            var progress = new Progress <string>(System.Console.WriteLine);
#endif

            var conversionOptions = options.ConversionOptions;

            var convertedProjects = new List <Project>();

            foreach (var file in options.Files)
            {
                var projects = ProjectConverter
                               .Convert(file, conversionOptions, progress)
                               .Where(x => x != null)
                               .ToList();
                convertedProjects.AddRange(projects);
            }

            System.Console.Out.Flush();

            var analyzer = new Analyzer <ConsoleReporter, ConsoleReporterOptions>(ConsoleReporter.Instance);
            foreach (var project in convertedProjects)
            {
                analyzer.Analyze(project);
            }

            if (options.DryRun)
            {
                return;
            }

            var doBackup = !options.NoBackup;

            var writer = new Writing.ProjectWriter(x => x.Delete(), _ => { });
            foreach (var project in convertedProjects)
            {
                if (project.IsModernProject)
                {
                    if (progress is IProgress <string> progressImpl)
                    {
                        progressImpl.Report($"Skipping CPS project '{project.FilePath.Name}'...");
                    }

                    continue;
                }

                writer.Write(project, doBackup, progress);
            }

            System.Console.Out.Flush();

            if (progress is IProgress <string> progressInterface)
            {
                progressInterface.Report("### Performing 2nd pass to analyze converted projects...");
            }

            ProjectReader.PurgeCache();
            convertedProjects.Clear();

            foreach (var file in options.Files)
            {
                var projects = ProjectConverter
                               .Convert(file, conversionOptions, progress)
                               .Where(x => x != null)
                               .ToList();
                convertedProjects.AddRange(projects);
            }

            System.Console.Out.Flush();

            foreach (var project in convertedProjects)
            {
                analyzer.Analyze(project);
            }
        }
Example #13
0
        public static void Main(string[] args)
        {
            ProjectConverter projectConverter = new ProjectConverter(args[0], args.Length > 1 ? args[1] : "out");

            projectConverter.Convert();
        }
Example #14
0
        public void ConvertEntity()
        {
            var bo = _converter.Convert(_mockProject);

            Assert.Contains(_mockProject.Title, bo.Title);
        }
Example #15
0
 static void Main(string[] args)
 {
     ProjectConverter.Convert(args[0], args[1]);
 }