Ejemplo n.º 1
0
        public static Model.ProjectDefinition ProjectDefinitionMapper(IProjectDefinition projectDefinition)
        {
            Model.ProjectDefinition p = new Model.ProjectDefinition()
            {
                Id      = (projectDefinition.Id != int.MinValue) ? projectDefinition.Id : int.MinValue,
                Enabled = projectDefinition.Enabled,
                Name    = projectDefinition.Name,
            };

            // Category definitions...
            foreach (KeyValuePair <int, ICategoryDefinition> pair in projectDefinition.Categories)
            {
                p.CategoryDefinitions.Add(CategoryDefinitionMapper(pair.Value));
            }

            // Directories...
            foreach (IDirectoryDefinition directoryDefinition in projectDefinition.Directories)
            {
                p.Directories.Add(new Model.Directory()
                {
                    Id                = (directoryDefinition.Id != int.MinValue) ? directoryDefinition.Id : int.MinValue,
                    Enabled           = directoryDefinition.Enabled,
                    Path              = directoryDefinition.Path,
                    ProjectDefinition = p,
                });
            }

            // Excluded directories...
            foreach (IDirectoryDefinition directoryDefinition in projectDefinition.ExcludedDirectories)
            {
                p.ExcludedDirectories.Add(new Model.ExcludedDirectory()
                {
                    Id                = (directoryDefinition.Id != int.MinValue) ? directoryDefinition.Id : int.MinValue,
                    Enabled           = directoryDefinition.Enabled,
                    Path              = directoryDefinition.Path,
                    ProjectDefinition = p,
                });
            }

            // Files...
            foreach (IFileDefinition fileDefinition in projectDefinition.Files)
            {
                p.Files.Add(new Model.File()
                {
                    Id                = (fileDefinition.Id != int.MinValue) ? fileDefinition.Id : int.MinValue,
                    Enabled           = fileDefinition.Enabled,
                    Path              = fileDefinition.Path,
                    ProjectDefinition = p,
                });
            }

            // Excluded files...
            foreach (var fileDefinition in projectDefinition.ExcludedFiles)
            {
                p.ExcludedFiles.Add(new Model.ExcludedFile()
                {
                    Id                = (fileDefinition.Id != int.MinValue) ? fileDefinition.Id : int.MinValue,
                    Enabled           = fileDefinition.Enabled,
                    Path              = fileDefinition.Path,
                    ProjectDefinition = p,
                });
            }

            // Owner...
            p.Owner = new Model.User()
            {
                FirstName = "Claes", MiddleName = "", LastName = "Ryom", Email = "*****@*****.**", Password = "******"
            };

            // Contributers...
            p.Contributers = new Model.User()
            {
                FirstName = "Kim", MiddleName = "Stig", LastName = "Ryom", Email = "*****@*****.**", Password = "******"
            };

            // Followers...
            p.Contributers = new Model.User()
            {
                FirstName = "Marianne", MiddleName = "", LastName = "Ryom", Email = "*****@*****.**", Password = "******"
            };

            return(p);
        }
Ejemplo n.º 2
0
        public static Model.ProjectDefinition ProjectDefinitionMapper(IProjectDefinition projectDefinition)
        {
            Model.ProjectDefinition p = new Model.ProjectDefinition()
              {
            Id      = (projectDefinition.Id != int.MinValue) ? projectDefinition.Id : int.MinValue,
            Enabled = projectDefinition.Enabled,
            Name    = projectDefinition.Name,
              };

              // Category definitions...
              foreach (KeyValuePair<int, ICategoryDefinition> pair in projectDefinition.Categories) { p.CategoryDefinitions.Add(CategoryDefinitionMapper(pair.Value)); }

              // Directories...
              foreach (IDirectoryDefinition directoryDefinition in projectDefinition.Directories)
              {
            p.Directories.Add(new Model.Directory()
            {
              Id                = (directoryDefinition.Id != int.MinValue) ? directoryDefinition.Id : int.MinValue,
              Enabled           = directoryDefinition.Enabled,
              Path              = directoryDefinition.Path,
              ProjectDefinition = p,
            });
              }

              // Excluded directories...
              foreach (IDirectoryDefinition directoryDefinition in projectDefinition.ExcludedDirectories)
              {
            p.ExcludedDirectories.Add(new Model.ExcludedDirectory()
            {
              Id                = (directoryDefinition.Id != int.MinValue) ? directoryDefinition.Id : int.MinValue,
              Enabled           = directoryDefinition.Enabled,
              Path              = directoryDefinition.Path,
              ProjectDefinition = p,
            });
              }

              // Files...
              foreach (IFileDefinition fileDefinition in projectDefinition.Files)
              {
            p.Files.Add(new Model.File()
            {
              Id                = (fileDefinition.Id != int.MinValue) ? fileDefinition.Id : int.MinValue,
              Enabled           = fileDefinition.Enabled,
              Path              = fileDefinition.Path,
              ProjectDefinition = p,
            });
              }

              // Excluded files...
              foreach (var fileDefinition in projectDefinition.ExcludedFiles)
              {
            p.ExcludedFiles.Add(new Model.ExcludedFile()
            {
              Id                = (fileDefinition.Id != int.MinValue) ? fileDefinition.Id : int.MinValue,
              Enabled           = fileDefinition.Enabled,
              Path              = fileDefinition.Path,
              ProjectDefinition = p,
            });
              }

              // Owner...
              p.Owner = new Model.User() { FirstName = "Claes", MiddleName = "", LastName = "Ryom", Email = "*****@*****.**", Password = "******" };

              // Contributers...
              p.Contributers = new Model.User() { FirstName = "Kim", MiddleName = "Stig", LastName = "Ryom", Email = "*****@*****.**", Password = "******" };

              // Followers...
              p.Contributers = new Model.User() { FirstName = "Marianne", MiddleName = "", LastName = "Ryom", Email = "*****@*****.**", Password = "******" };

              return p;
        }