Exemple #1
0
 public Repo.Core.Model.Person MapToEntity(ClanAndPeopleService clanAndPeopleService)
 {
     return(new Repo.Core.Model.Person()
     {
         Address1 = Address,
         Address2 = Address1,
         EmailAddress = EmailAddress,
         FatherID = clanAndPeopleService.People.FirstOrDefault(t => t.Id == Father.Id)?.Id,
         FirstName = FirstName,
         MiddleName = MiddleName,
         MaidenName = MaidenName,
         MotherID = clanAndPeopleService.People.FirstOrDefault(t => t.Id == Mother.Id)?.Id,
         Phone = Phone,
         LastName = LastName,
         PostCode = PostCode,
         State = State,
         SubscribeToEmail = SubscribeToEmail,
         Suburb = Suburb,
         Occupation = Occupation,
         ClandId = ClanId,
         DateOfBirth = DateOfBirth,
         YearOfBirth = YearOfBirth,
         DateOfDeath = DateOfDeath,
         YearOfDeath = YearOfDeath,
         IsSpouse = IsSpouse,
         IsClanManager = IsClanManager,
         Gender = Gender,
         ID = Id,
         ParentRelationship = ParentRelationship
     });
 }
Exemple #2
0
 public static Person FlatMap(Repo.Core.Model.Person person, ClanAndPeopleService clanAndPeopleService)
 {
     if (person == null)
     {
         return(null);
     }
     return(new Person()
     {
         Address = person.Address1,
         Address1 = person.Address2,
         EmailAddress = person.EmailAddress,
         FirstName = person.FirstName,
         MiddleName = person.MiddleName,
         MaidenName = person.MaidenName,
         Phone = person.Phone,
         LastName = person.LastName,
         PostCode = person.PostCode,
         State = person.State,
         SubscribeToEmail = person.SubscribeToEmail,
         Suburb = person.Suburb,
         Occupation = person.Occupation,
         ClanName = clanAndPeopleService.Clans.FirstOrDefault(t => t.Id == person.ClandId)?.FormattedName,
         ClanId = person.ClandId,
         Id = person.ID,
         IsSpouse = person.IsSpouse,
         DateOfBirth = person.DateOfBirth,
         DateOfDeath = person.DateOfDeath,
         YearOfBirth = person.YearOfBirth,
         YearOfDeath = person.YearOfDeath,
         Gender = person.Gender,
         ParentRelationship = person.ParentRelationship,
         IsClanManager = person.IsClanManager,
         LastUpdated = person.LastUpdated
     });
 }
Exemple #3
0
 public HistoryController(ClanAndPeopleService clanService, IWriteRepository <StoryContent, Guid> writeRepository, ContextService contextService, IStoryReadRepository storyReadRepository) : base("History", "history")
 {
     _clanService         = clanService;
     _writeRepository     = writeRepository;
     _contextService      = contextService;
     _storyReadRepository = storyReadRepository;
 }
 public PeopleController(IPersonReadRepository readModel, IWriteRepository <Repo.Core.Model.Person, int> writeModel, ClanAndPeopleService clanAndPeopleService, IUnionReadRepository unionReadRepository, IWriteRepository <Repo.Core.Model.Union, Guid> unionWriteRepository) : base("People", "people")
 {
     _readModel            = readModel;
     _writeModel           = writeModel;
     _clanAndPeopleService = clanAndPeopleService;
     _unionReadRepository  = unionReadRepository;
     _unionWriteRepository = unionWriteRepository;
 }
Exemple #5
0
 public static Story Map(StoryContent story, ClanAndPeopleService clanAndPeopleService)
 {
     return(new Story
     {
         StoryObject = story.PersonID,
         StoryTitle = story.Title,
         ID = story.ID,
         StoryContent = story.StoryContents,
         StoryPerson = clanAndPeopleService.People.FirstOrDefault(t => t.Id == story.PersonID)
     });
 }
Exemple #6
0
 public static StoryIndex MapToIndex(Repo.Core.Read.Story.StoryIndex story, ClanAndPeopleService clanAndPeopleService)
 {
     return(new StoryIndex
     {
         StoryObject = story.PersonID.HasValue && story.PersonID > 0 ?
                       clanAndPeopleService.People.FirstOrDefault(t => t.Id == story.PersonID).FullName :
                       string.Empty,
         StoryPerson = story.PersonID.HasValue && story.PersonID > 0 ?
                       clanAndPeopleService.People.FirstOrDefault(t => t.Id == story.PersonID):
                       null,
         StoryTitle = story.Title,
         ID = story.ID
     });
 }
Exemple #7
0
 public AccountController(
     UserManager <DynamoIdentityUser> userManager,
     SignInManager <DynamoIdentityUser> signInManager,
     ContextService contextService,
     ISesService sesService,
     ClanAndPeopleService clanAndPeopleService,
     DynamoRoleUsersStore <DynamoIdentityRole, DynamoIdentityUser> roleManager,
     ILogger <AccountController> logger) : base("Accounts", "accounts")
 {
     _userManager          = userManager;
     _signInManager        = signInManager;
     _contextService       = contextService;
     _sesService           = sesService;
     _clanAndPeopleService = clanAndPeopleService;
     _roleManager          = roleManager;
     _logger = logger;
 }
Exemple #8
0
 public GalleryController(ILogger <GalleryController> logger,
                          IGalleryReadRepository readModel,
                          IFamilyEventReadRepository familyEventReadRepository,
                          IWriteRepository <Repo.Core.Model.Gallery, Guid> galleryWriteModel,
                          IWriteRepository <Repo.Core.Model.ImageReference, Guid> imageReferenceWriteModel,
                          IImageReferenceReadRepository imageReferenceReadRepository,
                          IFileService fileService,
                          ClanAndPeopleService clanAndPeopleService,
                          ContextService contextService)
     : base("Galleries", "gallery")
 {
     _logger    = logger;
     _readModel = readModel;
     _familyEventReadRepository = familyEventReadRepository;
     _writeModel = galleryWriteModel;
     _imageReferenceWriteModel     = imageReferenceWriteModel;
     _imageReferenceReadRepository = imageReferenceReadRepository;
     _fileService          = fileService;
     _clanAndPeopleService = clanAndPeopleService;
     _contextService       = contextService;
 }
Exemple #9
0
 public EventController(IFamilyEventReadRepository readmodel,
                        IWriteRepository <Repo.Core.Model.FamilyEvent, Guid> writeModel,
                        IImageReferenceReadRepository imageReferenceReadRepository,
                        IGalleryReadRepository galleryReadRepository,
                        ContextService contextService,
                        IWriteRepository <Repo.Core.Model.Gallery, Guid> galleryWriteRepository,
                        IFileService fileService,
                        IWriteRepository <Repo.Core.Model.ImageReference, Guid> imageReferenceWriteModel,
                        ISesService sesServive,
                        ClanAndPeopleService clanAndPeopleService)
     : base("Significant Events", "events")
 {
     _readmodel  = readmodel;
     _writeModel = writeModel;
     _imageReferenceReadRepository = imageReferenceReadRepository;
     _galleryReadRepository        = galleryReadRepository;
     _contextService           = contextService;
     _galleryWriteRepository   = galleryWriteRepository;
     _fileService              = fileService;
     _imageReferenceWriteModel = imageReferenceWriteModel;
     _sesServive           = sesServive;
     _clanAndPeopleService = clanAndPeopleService;
 }
        public FamilySummary(ClanAndPeopleService clanAndPeopleService)
        {
            NearByBirthdays = clanAndPeopleService
                              .People
                              .Where(person => {
                if (!person.DateOfBirth.HasValue || person.DateOfDeath.HasValue)
                {
                    return(false);
                }
                var daysToBirthday = GetDaysToBirthday(person);
                return(daysToBirthday > -15 && daysToBirthday < 30);
            })
                              .ToList();

            SignificantAnniversaries = clanAndPeopleService
                                       .People
                                       .SelectMany(x => x.Unions)
                                       .Where(t => !t.Divorced &&
                                              (t.Partner1 != null && !t.Partner1.DateOfDeath.HasValue) &&
                                              (t.Partner2 != null && !t.Partner2.DateOfDeath.HasValue) &&
                                              t.DateOfUnion.HasValue &&
                                              t.YearsMarried > 0 &&
                                              (t.YearsMarried % 10 == 0))
                                       .Distinct()
                                       .ToList();

            SignificantBirthdays = clanAndPeopleService
                                   .People
                                   .Where(person =>
                                          person.DateOfBirth.HasValue &&
                                          !person.DateOfDeath.HasValue &&
                                          person.Age + 1 == 21 ||
                                          (person.Age + 1 > 21 &&
                                           (person.Age + 1) % 10 == 0
                                          ))
                                   .ToList();
        }
        public static async Task <GalleryIndex> Map(Repo.Core.Model.Gallery sourceGallery, ClanAndPeopleService clanAndFamilyService, IFamilyEventReadRepository familyEventReadModel, CancellationToken cancellationToken)
        {
            var familyName = sourceGallery.FamilyId.HasValue ?
                             $"{clanAndFamilyService.Clans.FirstOrDefault(c => c.Id == sourceGallery.FamilyId)?.FamilyName}, {clanAndFamilyService.Clans.FirstOrDefault(c => c.Id == sourceGallery.FamilyId)?.Family}"
                                : string.Empty;

            return(await Task.FromResult(new GalleryIndex()
            {
                Title = sourceGallery.Name,
                FamilyEvent = FamilyEvent.Map(await familyEventReadModel.Load(sourceGallery.FamilyEvent, cancellationToken)),
                Owner = sourceGallery.Owner.ToString(),
                OwnerId = sourceGallery.Owner,
                Summary = sourceGallery.Summary,
                Id = sourceGallery.ID,
                DateCreated = sourceGallery.DateCreated,
                Family = familyName,
                DefaultFamilyEventGallery = sourceGallery.DefaultFamilyEventGallery,
                GalleryDate = sourceGallery.GalleryDate,
                Clan = clanAndFamilyService.Clans.FirstOrDefault(t => t.Id == sourceGallery.FamilyId)
            }
                                         ));
        }
 public ReportsController(ClanAndPeopleService clanAndPeopleService) : base("Reports", "reports")
 {
     _clanAndPeopleService = clanAndPeopleService;
 }