public InvitationDto(
     string projectName,
     string title,
     string description,
     string location,
     DisciplineType type,
     IpoStatus status,
     PersonDto createdBy,
     DateTime startTimeUtc,
     DateTime endTimeUtc,
     bool canEdit,
     string rowVersion,
     bool canCancel,
     bool canDelete)
 {
     ProjectName  = projectName;
     Title        = title;
     Description  = description;
     Location     = location;
     Type         = type;
     Status       = status;
     CreatedBy    = createdBy;
     StartTimeUtc = startTimeUtc;
     EndTimeUtc   = endTimeUtc;
     CanEdit      = canEdit;
     CanCancel    = canCancel;
     CanDelete    = canDelete;
     RowVersion   = rowVersion;
 }
Exemple #2
0
 public IpoCanceledEvent(
     string plant,
     Guid objectGuid,
     IpoStatus status)
 {
     Plant      = plant;
     ObjectGuid = objectGuid;
     Status     = status;
 }
 public InvitationDto(
     int id,
     string projectName,
     string title,
     string description,
     string location,
     DisciplineType type,
     IpoStatus status,
     DateTime createdAtUtc,
     int createdById,
     DateTime startTimeUtc,
     DateTime endTimeUtc,
     DateTime?completedAtUtc,
     DateTime?acceptedAtUtc,
     string contractorRep,
     string constructionCompanyRep,
     IEnumerable <string> commissioningReps,
     IEnumerable <string> operationReps,
     IEnumerable <string> technicalIntegrityReps,
     IEnumerable <string> supplierReps,
     IEnumerable <string> externalGuests,
     IEnumerable <string> additionalContractorReps,
     IEnumerable <string> additionalConstructionCompanyReps,
     IEnumerable <string> mcPkgNos,
     IEnumerable <string> commPkgNos,
     string rowVersion)
 {
     Id                                = id;
     ProjectName                       = projectName;
     Title                             = title;
     Description                       = description;
     Location                          = location;
     Type                              = type;
     Status                            = status;
     CreatedAtUtc                      = createdAtUtc;
     CreatedById                       = createdById;
     StartTimeUtc                      = startTimeUtc;
     EndTimeUtc                        = endTimeUtc;
     CompletedAtUtc                    = completedAtUtc;
     AcceptedAtUtc                     = acceptedAtUtc;
     ContractorRep                     = contractorRep;
     ConstructionCompanyRep            = constructionCompanyRep;
     CommissioningReps                 = commissioningReps;
     OperationReps                     = operationReps;
     TechnicalIntegrityReps            = technicalIntegrityReps;
     SupplierReps                      = supplierReps;
     ExternalGuests                    = externalGuests;
     AdditionalContractorReps          = additionalContractorReps;
     AdditionalConstructionCompanyReps = additionalConstructionCompanyReps;
     McPkgNos                          = mcPkgNos;
     CommPkgNos                        = commPkgNos;
     RowVersion                        = rowVersion;
 }
Exemple #4
0
 public InvitationForMainDto(
     int id,
     string title,
     string description,
     DisciplineType type,
     IpoStatus status,
     DateTime?completedAtUtc,
     DateTime?acceptedAtUtc,
     DateTime meetingTimeUtc,
     string rowVersion)
 {
     Id             = id;
     Title          = title;
     Description    = description;
     Type           = type;
     Status         = status;
     CompletedAtUtc = completedAtUtc;
     AcceptedAtUtc  = acceptedAtUtc;
     MeetingTimeUtc = meetingTimeUtc;
     RowVersion     = rowVersion;
 }
Exemple #5
0
        public ExportInvitationDto(
            int id,
            string projectName,
            IpoStatus status,
            string title,
            string description,
            string type,
            string location,
            DateTime startTimeUtc,
            DateTime endTimeUtc,
            IEnumerable <string> mcPkgs,
            IEnumerable <string> commPkgs,
            string contractorRep,
            string constructionCompanyRep,
            DateTime?completedAtUtc,
            DateTime?acceptedAtUtc,
            DateTime createdAtUtc,
            string createdBy)
        {
            Id                     = id;
            ProjectName            = projectName;
            Status                 = status;
            Title                  = title;
            Description            = description;
            Type                   = type;
            Location               = location;
            StartTimeUtc           = startTimeUtc;
            EndTimeUtc             = endTimeUtc;
            McPkgs                 = mcPkgs;
            CommPkgs               = commPkgs;
            ContractorRep          = contractorRep;
            ConstructionCompanyRep = constructionCompanyRep;
            CompletedAtUtc         = completedAtUtc;
            AcceptedAtUtc          = acceptedAtUtc;
            CreatedAtUtc           = createdAtUtc;
            CreatedBy              = createdBy;

            Participants = new List <ExportParticipantDto>();
            History      = new List <ExportHistoryDto>();
        }
        private async Task <IEnumerable <ParticipantDto> > ConvertToParticipantDtoAsync(IReadOnlyCollection <Participant> participants, IpoStatus ipoStatus)
        {
            var participantDtos               = new List <ParticipantDto>();
            var orderedParticipants           = participants.OrderBy(p => p.SortKey);
            var currentUserNextRequiredSigner =
                (ipoStatus == IpoStatus.Planned &&
                 await CurrentUserIsAmongParticipantsAsync(participants.Where(p => p.SortKey == 0 && p.SignedAtUtc == null).ToList())) ||
                (ipoStatus == IpoStatus.Completed &&
                 await CurrentUserIsAmongParticipantsAsync(participants.Where(p => p.SortKey == 1 && p.SignedAtUtc == null).ToList()));

            foreach (var participant in orderedParticipants)
            {
                if (participant.Type == IpoParticipantType.FunctionalRole)
                {
                    var personsInFunctionalRole = participants
                                                  .Where(p => p.FunctionalRoleCode == participant.FunctionalRoleCode &&
                                                         p.SortKey == participant.SortKey &&
                                                         p.Type == IpoParticipantType.Person);
                    var currentUserIsInFunctionalRole = await CurrentUserIsInFunctionalRoleAsync(participant);

                    var canSign = IsSigningParticipant(participant) && currentUserIsInFunctionalRole;

                    participantDtos.Add(new ParticipantDto(
                                            participant.Id,
                                            participant.Organization,
                                            participant.SortKey,
                                            participant.SignedBy != null ? ConvertToPersonDto(participant.SignedBy).Result : null,
                                            participant.SignedAtUtc,
                                            participant.Note,
                                            participant.Attended,
                                            participant.IsAttendedTouched,
                                            canSign,
                                            canSign,
                                            ipoStatus != IpoStatus.Canceled &&
                                            (currentUserNextRequiredSigner || (participant.SignedAtUtc == null && currentUserIsInFunctionalRole)),
                                            null,
                                            null,
                                            ConvertToFunctionalRoleDto(participant, personsInFunctionalRole),
                                            participant.RowVersion.ConvertToString()));
                }
                else if (ParticipantIsNotInFunctionalRole(participant) && participant.Organization != Organization.External)
                {
                    var currentUserIsParticipant = _currentUserProvider.GetCurrentUserOid() == participant.AzureOid;
                    var canSign = IsSigningParticipant(participant) && currentUserIsParticipant;
                    participantDtos.Add(new ParticipantDto(
                                            participant.Id,
                                            participant.Organization,
                                            participant.SortKey,
                                            participant.SignedBy != null ? ConvertToPersonDto(participant.SignedBy).Result : null,
                                            participant.SignedAtUtc,
                                            participant.Note,
                                            participant.Attended,
                                            participant.IsAttendedTouched,
                                            canSign,
                                            canSign,
                                            ipoStatus != IpoStatus.Canceled &&
                                            (currentUserNextRequiredSigner || (participant.SignedAtUtc == null && currentUserIsParticipant)),
                                            null,
                                            ConvertToInvitedPersonDto(participant),
                                            null,
                                            participant.RowVersion.ConvertToString()));
                }
                else if (participant.Organization == Organization.External)
                {
                    participantDtos.Add(new ParticipantDto(
                                            participant.Id,
                                            participant.Organization,
                                            participant.SortKey,
                                            participant.SignedBy != null ? ConvertToPersonDto(participant.SignedBy).Result : null,
                                            participant.SignedAtUtc,
                                            participant.Note,
                                            participant.Attended,
                                            participant.IsAttendedTouched,
                                            false,
                                            false,
                                            ipoStatus != IpoStatus.Canceled && currentUserNextRequiredSigner,
                                            new ExternalEmailDto(participant.Id, participant.Email),
                                            null,
                                            null,
                                            participant.RowVersion.ConvertToString()));
                }
            }
            return(participantDtos);
        }
Exemple #7
0
 public async Task <bool> IpoIsInStageAsync(int invitationId, IpoStatus stage, CancellationToken cancellationToken) =>
 await(from ipo in _context.QuerySet <Invitation>()
           where ipo.Id == invitationId && ipo.Status == stage
       select ipo).AnyAsync(cancellationToken);