コード例 #1
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName,Description")] Category category, IFormFile picture)
        {
            if (ModelState.IsValid)
            {
                if (picture != null)
                {
                    using (MemoryStream ms = new MemoryStream())
                    {
                        picture.CopyTo(ms);
                        category.Picture = ms.ToArray();
                    }
                }
                //_context.Add(category);
                //await _context.SaveChangesAsync();
                category.State = Model.ModelState.Added;
                await _cR.Save(category, ns);

                if (ns.Any())
                {
                    var msg = ns[0];
                    ModelState.AddModelError("", $"{msg.Title} - {msg.Description}");

                    return(View(category));
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(category));
        }
コード例 #2
0
        private async Task MarkAllAsRead()
        {
            // Make sure theres some sort of notification
            if (!Notifications.Any())
            {
                return;
            }

            try
            {
                IsMarking = true;
                await this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.Notifications.MarkAsRead());

                Notifications.Items.Clear();
                UpdateAccountNotificationsCount();
            }
            catch
            {
                DisplayAlert("Unable to mark all notifications as read. Please try again.");
            }
            finally
            {
                IsMarking = false;
            }
        }
コード例 #3
0
        public async Task Executar(ParadaNaLinhaDto paradaNaLinhaDto)
        {
            var linha = await context.Linhas
                        .Include(x => x.Paradas)
                        .SingleOrDefaultAsync(x => x.Id == paradaNaLinhaDto.LinhaId);

            var parada = await context.Paradas.FindAsync(paradaNaLinhaDto.ParadaId);

            if (linha is null)
            {
                Notifications.Add("linha-nao-encontrada", "Linha não encontrada!");
            }

            if (parada is null)
            {
                Notifications.Add("parada-nao-encontrada", "Parada não encontrada!");
            }

            if (linha is not null && linha.Paradas.Any(x => x.Id == paradaNaLinhaDto.ParadaId))
            {
                Notifications.Add("parada-vinculada", "Esta parada já está vinculada a esta linha!");
            }

            if (!Notifications.Any())
            {
                linha.AdicionarParada(parada);

                await context.SaveChangesAsync();
            }
        }
コード例 #4
0
        public async Task Executar(VeiculoNaLinhasDto veiculoNaLinhaDto)
        {
            var linha = await context.Linhas
                        .Include(x => x.Veiculos)
                        .SingleOrDefaultAsync(x => x.Id == veiculoNaLinhaDto.LinhaId);

            var veiculo = await context.Veiculos.FindAsync(veiculoNaLinhaDto.VeiculoId);

            if (linha is null)
            {
                Notifications.Add("linha-nao-encontrada", "Linha não encontrada!");
            }

            if (veiculo is null)
            {
                Notifications.Add("veiculo-nao-encontrado", "Parada não encontrada!");
            }

            if (!Notifications.Any())
            {
                linha.AdicionarVeiculo(veiculo);

                await context.SaveChangesAsync();
            }
        }
コード例 #5
0
        private async Task RefreshData()
        {
            try
            {
                if (!_intruderMode)
                {
                    var data = await userService.GetNotifications();

                    if (data != null && data.Any())
                    {
                        var result = entityMapper.Map <IEnumerable <MessageDto>, IEnumerable <NotificationModel> >(data);
                        var toAdd  = result.Where(x => !Notifications.Any(y => y.Guid == x.Guid)).OrderBy(x => x.Date);
                        foreach (var element in toAdd)
                        {
                            Notifications.Insert(0, element);
                        }
                        if (toAdd.Count() > 0)
                        {
                            _messageService.ShortAlert("Notificaciones actualizadas");
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #6
0
        public override bool IsValid()
        {
            this.ValidateFirstName();
            this.ValidateLastName();
            this.ValidateEmail();

            return(!Notifications.Any());
        }
コード例 #7
0
        private void MessageNotification_Close(object sender, EventArgs e)
        {
            var notification = (INotificationItem)sender;

            Notifications.Remove(notification);
            if (!Notifications.Any())
            {
                IsVisible = false;
            }
        }
コード例 #8
0
        public void AddNotification(Notification notification)
        {
            // If there's an existing notification with the same URL and title, skip it.
            var hasNotification = Notifications.Any(n => n.Url == notification.Url && n.Title == notification.Title);

            if (!hasNotification)
            {
                Notifications.Insert(0, notification);
                if (Notifications.Count > MaxNotifications)
                {
                    Notifications.RemoveAt(MaxNotifications);
                }
            }
        }
コード例 #9
0
ファイル: Job.cs プロジェクト: randyammar/TaskScheduler
        public void OnTriggerNotification(string result)
        {
            if (Notifications == null || !Notifications.Any() || NotifyCondition == NotifyCondition.None)
            {
                return;
            }

            var subject = $"{(Debugger.IsAttached ? "`DEBUG MODE`" : "")} **{Name}**\n" +
                          $"----------------------------------------";
            var body = $"\nResult: `{result}` " +
                       $"\nAction: `{ActionName}` \n";

            if (ActionParameters?.Any() == true)
            {
                body += "Arguments: ```\n";
                foreach (var arg in ActionParameters.Where((k, v) => !String.IsNullOrEmpty(v.ToString())))
                {
                    var val = string.Concat(arg.Value.ToString()
                                            .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                                            .Select(x => $"{x}\n\t"));
                    val   = val.Remove(val.LastIndexOf('\t'));
                    body += $"  • {arg.Key}: {val}";
                }

                body = body.Replace("\"", "") + "\n```";
            }

            foreach (var notify in Notifications.Where(n => CompareByNotifyCondition(result)))
            {
                try
                {
#if !TestWithoutNotify
                    notify.Notify(body, subject);
#endif
                }
                catch (Exception exp)
                {
                    Nlogger.Error(exp);
                }
            }
        }
コード例 #10
0
ファイル: Person.Binding.cs プロジェクト: sitkatech/neptune
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (AuditLogs.Any())
            {
                dependentObjects.Add(typeof(AuditLog).Name);
            }

            if (DelineationsWhereYouAreTheVerifiedByPerson.Any())
            {
                dependentObjects.Add(typeof(Delineation).Name);
            }

            if (DelineationStagingsWhereYouAreTheUploadedByPerson.Any())
            {
                dependentObjects.Add(typeof(DelineationStaging).Name);
            }

            if (FieldVisitsWhereYouAreThePerformedByPerson.Any())
            {
                dependentObjects.Add(typeof(FieldVisit).Name);
            }

            if (FileResourcesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(FileResource).Name);
            }

            if (LandUseBlockStagingsWhereYouAreTheUploadedByPerson.Any())
            {
                dependentObjects.Add(typeof(LandUseBlockStaging).Name);
            }

            if (Notifications.Any())
            {
                dependentObjects.Add(typeof(Notification).Name);
            }

            if (OnlandVisualTrashAssessmentsWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(OnlandVisualTrashAssessment).Name);
            }

            if (OrganizationsWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(Organization).Name);
            }

            if (RegionalSubbasinRevisionRequestsWhereYouAreTheClosedByPerson.Any())
            {
                dependentObjects.Add(typeof(RegionalSubbasinRevisionRequest).Name);
            }

            if (RegionalSubbasinRevisionRequestsWhereYouAreTheRequestPerson.Any())
            {
                dependentObjects.Add(typeof(RegionalSubbasinRevisionRequest).Name);
            }

            if (StormwaterJurisdictionPeople.Any())
            {
                dependentObjects.Add(typeof(StormwaterJurisdictionPerson).Name);
            }

            if (SupportRequestLogsWhereYouAreTheRequestPerson.Any())
            {
                dependentObjects.Add(typeof(SupportRequestLog).Name);
            }

            if (TrashGeneratingUnitAdjustmentsWhereYouAreTheAdjustedByPerson.Any())
            {
                dependentObjects.Add(typeof(TrashGeneratingUnitAdjustment).Name);
            }

            if (TreatmentBMPsWhereYouAreTheInventoryVerifiedByPerson.Any())
            {
                dependentObjects.Add(typeof(TreatmentBMP).Name);
            }

            if (WaterQualityManagementPlanVerifiesWhereYouAreTheLastEditedByPerson.Any())
            {
                dependentObjects.Add(typeof(WaterQualityManagementPlanVerify).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #11
0
ファイル: Person.Binding.cs プロジェクト: sitkatech/neptune
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(AuditLogs.Any() || DelineationsWhereYouAreTheVerifiedByPerson.Any() || DelineationStagingsWhereYouAreTheUploadedByPerson.Any() || FieldVisitsWhereYouAreThePerformedByPerson.Any() || FileResourcesWhereYouAreTheCreatePerson.Any() || LandUseBlockStagingsWhereYouAreTheUploadedByPerson.Any() || Notifications.Any() || OnlandVisualTrashAssessmentsWhereYouAreTheCreatedByPerson.Any() || OrganizationsWhereYouAreThePrimaryContactPerson.Any() || RegionalSubbasinRevisionRequestsWhereYouAreTheClosedByPerson.Any() || RegionalSubbasinRevisionRequestsWhereYouAreTheRequestPerson.Any() || StormwaterJurisdictionPeople.Any() || SupportRequestLogsWhereYouAreTheRequestPerson.Any() || TrashGeneratingUnitAdjustmentsWhereYouAreTheAdjustedByPerson.Any() || TreatmentBMPsWhereYouAreTheInventoryVerifiedByPerson.Any() || WaterQualityManagementPlanVerifiesWhereYouAreTheLastEditedByPerson.Any());
 }
コード例 #12
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (AgreementPeople.Any())
            {
                dependentObjects.Add(typeof(AgreementPerson).Name);
            }

            if (AuditLogs.Any())
            {
                dependentObjects.Add(typeof(AuditLog).Name);
            }

            if (FileResourcesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(FileResource).Name);
            }

            if (GisUploadAttemptsWhereYouAreTheGisUploadAttemptCreatePerson.Any())
            {
                dependentObjects.Add(typeof(GisUploadAttempt).Name);
            }

            if (GrantAllocationsWhereYouAreTheGrantManager.Any())
            {
                dependentObjects.Add(typeof(GrantAllocation).Name);
            }

            if (GrantAllocationAwardPersonnelAndBenefitsLineItems.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationAwardPersonnelAndBenefitsLineItem).Name);
            }

            if (GrantAllocationAwardTravelLineItems.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationAwardTravelLineItem).Name);
            }

            if (GrantAllocationChangeLogsWhereYouAreTheChangePerson.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationChangeLog).Name);
            }

            if (GrantAllocationNotesWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationNote).Name);
            }

            if (GrantAllocationNotesWhereYouAreTheLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationNote).Name);
            }

            if (GrantAllocationNoteInternalsWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationNoteInternal).Name);
            }

            if (GrantAllocationNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationNoteInternal).Name);
            }

            if (GrantAllocationProgramManagers.Any())
            {
                dependentObjects.Add(typeof(GrantAllocationProgramManager).Name);
            }

            if (GrantModificationNoteInternalsWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantModificationNoteInternal).Name);
            }

            if (GrantModificationNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantModificationNoteInternal).Name);
            }

            if (GrantNotesWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantNote).Name);
            }

            if (GrantNotesWhereYouAreTheLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantNote).Name);
            }

            if (GrantNoteInternalsWhereYouAreTheCreatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantNoteInternal).Name);
            }

            if (GrantNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(GrantNoteInternal).Name);
            }

            if (InteractionEventsWhereYouAreTheStaffPerson.Any())
            {
                dependentObjects.Add(typeof(InteractionEvent).Name);
            }

            if (InteractionEventContacts.Any())
            {
                dependentObjects.Add(typeof(InteractionEventContact).Name);
            }

            if (InvoicesWhereYouAreThePreparedByPerson.Any())
            {
                dependentObjects.Add(typeof(Invoice).Name);
            }

            if (Notifications.Any())
            {
                dependentObjects.Add(typeof(Notification).Name);
            }

            if (OrganizationsWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(Organization).Name);
            }

            if (PerformanceMeasureNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(PerformanceMeasureNote).Name);
            }

            if (PerformanceMeasureNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(PerformanceMeasureNote).Name);
            }

            if (PeopleWhereYouAreTheAddedByPerson.Any())
            {
                dependentObjects.Add(typeof(Person).Name);
            }

            if (PersonAllowedAuthenticators.Any())
            {
                dependentObjects.Add(typeof(PersonAllowedAuthenticator).Name);
            }

            if (PersonStewardOrganizations.Any())
            {
                dependentObjects.Add(typeof(PersonStewardOrganization).Name);
            }

            if (PersonStewardRegions.Any())
            {
                dependentObjects.Add(typeof(PersonStewardRegion).Name);
            }

            if (PersonStewardTaxonomyBranches.Any())
            {
                dependentObjects.Add(typeof(PersonStewardTaxonomyBranch).Name);
            }

            if (ProgramsWhereYouAreTheProgramCreatePerson.Any())
            {
                dependentObjects.Add(typeof(Program).Name);
            }

            if (ProgramsWhereYouAreTheProgramLastUpdatedByPerson.Any())
            {
                dependentObjects.Add(typeof(Program).Name);
            }

            if (ProgramsWhereYouAreTheProgramPrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(Program).Name);
            }

            if (ProjectsWhereYouAreTheProposingPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectsWhereYouAreTheReviewedByPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectInternalNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectInternalNote).Name);
            }

            if (ProjectInternalNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectInternalNote).Name);
            }

            if (ProjectLocationStagings.Any())
            {
                dependentObjects.Add(typeof(ProjectLocationStaging).Name);
            }

            if (ProjectLocationStagingUpdates.Any())
            {
                dependentObjects.Add(typeof(ProjectLocationStagingUpdate).Name);
            }

            if (ProjectNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNote).Name);
            }

            if (ProjectNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNote).Name);
            }

            if (ProjectNoteUpdatesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNoteUpdate).Name);
            }

            if (ProjectNoteUpdatesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNoteUpdate).Name);
            }

            if (ProjectPeople.Any())
            {
                dependentObjects.Add(typeof(ProjectPerson).Name);
            }

            if (ProjectPersonUpdates.Any())
            {
                dependentObjects.Add(typeof(ProjectPersonUpdate).Name);
            }

            if (ProjectUpdateBatchesWhereYouAreTheLastUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdateBatch).Name);
            }

            if (ProjectUpdateHistoriesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdateHistory).Name);
            }

            if (SupportRequestLogsWhereYouAreTheRequestPerson.Any())
            {
                dependentObjects.Add(typeof(SupportRequestLog).Name);
            }

            if (SystemAttributesWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(SystemAttribute).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #13
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(AgreementPeople.Any() || AuditLogs.Any() || FileResourcesWhereYouAreTheCreatePerson.Any() || GisUploadAttemptsWhereYouAreTheGisUploadAttemptCreatePerson.Any() || GrantAllocationsWhereYouAreTheGrantManager.Any() || GrantAllocationAwardPersonnelAndBenefitsLineItems.Any() || GrantAllocationAwardTravelLineItems.Any() || GrantAllocationChangeLogsWhereYouAreTheChangePerson.Any() || GrantAllocationNotesWhereYouAreTheCreatedByPerson.Any() || GrantAllocationNotesWhereYouAreTheLastUpdatedByPerson.Any() || GrantAllocationNoteInternalsWhereYouAreTheCreatedByPerson.Any() || GrantAllocationNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any() || GrantAllocationProgramManagers.Any() || GrantModificationNoteInternalsWhereYouAreTheCreatedByPerson.Any() || GrantModificationNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any() || GrantNotesWhereYouAreTheCreatedByPerson.Any() || GrantNotesWhereYouAreTheLastUpdatedByPerson.Any() || GrantNoteInternalsWhereYouAreTheCreatedByPerson.Any() || GrantNoteInternalsWhereYouAreTheLastUpdatedByPerson.Any() || InteractionEventsWhereYouAreTheStaffPerson.Any() || InteractionEventContacts.Any() || InvoicesWhereYouAreThePreparedByPerson.Any() || Notifications.Any() || OrganizationsWhereYouAreThePrimaryContactPerson.Any() || PerformanceMeasureNotesWhereYouAreTheCreatePerson.Any() || PerformanceMeasureNotesWhereYouAreTheUpdatePerson.Any() || PeopleWhereYouAreTheAddedByPerson.Any() || PersonAllowedAuthenticators.Any() || PersonStewardOrganizations.Any() || PersonStewardRegions.Any() || PersonStewardTaxonomyBranches.Any() || ProgramsWhereYouAreTheProgramCreatePerson.Any() || ProgramsWhereYouAreTheProgramLastUpdatedByPerson.Any() || ProgramsWhereYouAreTheProgramPrimaryContactPerson.Any() || ProjectsWhereYouAreTheProposingPerson.Any() || ProjectsWhereYouAreTheReviewedByPerson.Any() || ProjectInternalNotesWhereYouAreTheCreatePerson.Any() || ProjectInternalNotesWhereYouAreTheUpdatePerson.Any() || ProjectLocationStagings.Any() || ProjectLocationStagingUpdates.Any() || ProjectNotesWhereYouAreTheCreatePerson.Any() || ProjectNotesWhereYouAreTheUpdatePerson.Any() || ProjectNoteUpdatesWhereYouAreTheCreatePerson.Any() || ProjectNoteUpdatesWhereYouAreTheUpdatePerson.Any() || ProjectPeople.Any() || ProjectPersonUpdates.Any() || ProjectUpdateBatchesWhereYouAreTheLastUpdatePerson.Any() || ProjectUpdateHistoriesWhereYouAreTheUpdatePerson.Any() || SupportRequestLogsWhereYouAreTheRequestPerson.Any() || SystemAttributesWhereYouAreThePrimaryContactPerson.Any());
 }
コード例 #14
0
        /// <summary>
        /// Active Dependent type names of this object
        /// </summary>
        public List <string> DependentObjectNames()
        {
            var dependentObjects = new List <string>();

            if (AuditLogs.Any())
            {
                dependentObjects.Add(typeof(AuditLog).Name);
            }

            if (DocumentLibraryDocumentsWhereYouAreTheLastUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(DocumentLibraryDocument).Name);
            }

            if (EvaluationsWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(Evaluation).Name);
            }

            if (FileResourceInfosWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(FileResourceInfo).Name);
            }

            if (FirmaSessions.Any())
            {
                dependentObjects.Add(typeof(FirmaSession).Name);
            }

            if (FirmaSessionsWhereYouAreTheOriginalPerson.Any())
            {
                dependentObjects.Add(typeof(FirmaSession).Name);
            }

            if (ImportExternalProjectStagingsWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ImportExternalProjectStaging).Name);
            }

            if (Notifications.Any())
            {
                dependentObjects.Add(typeof(Notification).Name);
            }

            if (OrganizationsWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(Organization).Name);
            }

            if (PerformanceMeasureNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(PerformanceMeasureNote).Name);
            }

            if (PerformanceMeasureNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(PerformanceMeasureNote).Name);
            }

            if ((PersonLoginAccount != null))
            {
                dependentObjects.Add(typeof(PersonLoginAccount).Name);
            }

            if (PersonSettingGridColumnSettings.Any())
            {
                dependentObjects.Add(typeof(PersonSettingGridColumnSetting).Name);
            }

            if (PersonStewardGeospatialAreas.Any())
            {
                dependentObjects.Add(typeof(PersonStewardGeospatialArea).Name);
            }

            if (PersonStewardOrganizations.Any())
            {
                dependentObjects.Add(typeof(PersonStewardOrganization).Name);
            }

            if (PersonStewardTaxonomyBranches.Any())
            {
                dependentObjects.Add(typeof(PersonStewardTaxonomyBranch).Name);
            }

            if (ProjectsWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectsWhereYouAreTheProposingPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectsWhereYouAreTheReviewedByPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectsWhereYouAreTheSubmittedByPerson.Any())
            {
                dependentObjects.Add(typeof(Project).Name);
            }

            if (ProjectContactsWhereYouAreTheContact.Any())
            {
                dependentObjects.Add(typeof(ProjectContact).Name);
            }

            if (ProjectContactUpdatesWhereYouAreTheContact.Any())
            {
                dependentObjects.Add(typeof(ProjectContactUpdate).Name);
            }

            if (ProjectInternalNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectInternalNote).Name);
            }

            if (ProjectInternalNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectInternalNote).Name);
            }

            if (ProjectLocationStagings.Any())
            {
                dependentObjects.Add(typeof(ProjectLocationStaging).Name);
            }

            if (ProjectLocationStagingUpdates.Any())
            {
                dependentObjects.Add(typeof(ProjectLocationStagingUpdate).Name);
            }

            if (ProjectNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNote).Name);
            }

            if (ProjectNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNote).Name);
            }

            if (ProjectNoteUpdatesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNoteUpdate).Name);
            }

            if (ProjectNoteUpdatesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectNoteUpdate).Name);
            }

            if (ProjectProjectStatusesWhereYouAreTheProjectProjectStatusCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectProjectStatus).Name);
            }

            if (ProjectProjectStatusesWhereYouAreTheProjectProjectStatusLastEditedPerson.Any())
            {
                dependentObjects.Add(typeof(ProjectProjectStatus).Name);
            }

            if (ProjectUpdatesWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdate).Name);
            }

            if (ProjectUpdateBatchesWhereYouAreTheLastUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdateBatch).Name);
            }

            if (ProjectUpdateHistoriesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ProjectUpdateHistory).Name);
            }

            if (ReleaseNotesWhereYouAreTheCreatePerson.Any())
            {
                dependentObjects.Add(typeof(ReleaseNote).Name);
            }

            if (ReleaseNotesWhereYouAreTheUpdatePerson.Any())
            {
                dependentObjects.Add(typeof(ReleaseNote).Name);
            }

            if (SupportRequestLogsWhereYouAreTheRequestPerson.Any())
            {
                dependentObjects.Add(typeof(SupportRequestLog).Name);
            }

            if (TechnicalAssistanceRequests.Any())
            {
                dependentObjects.Add(typeof(TechnicalAssistanceRequest).Name);
            }

            if (TechnicalAssistanceRequestUpdates.Any())
            {
                dependentObjects.Add(typeof(TechnicalAssistanceRequestUpdate).Name);
            }

            if (TenantAttributesWhereYouAreThePrimaryContactPerson.Any())
            {
                dependentObjects.Add(typeof(TenantAttribute).Name);
            }
            return(dependentObjects.Distinct().ToList());
        }
コード例 #15
0
 /// <summary>
 /// Does this object have any dependent objects? (If it does have dependent objects, these would need to be deleted before this object could be deleted.)
 /// </summary>
 /// <returns></returns>
 public bool HasDependentObjects()
 {
     return(AuditLogs.Any() || DocumentLibraryDocumentsWhereYouAreTheLastUpdatePerson.Any() || EvaluationsWhereYouAreTheCreatePerson.Any() || FileResourceInfosWhereYouAreTheCreatePerson.Any() || FirmaSessions.Any() || FirmaSessionsWhereYouAreTheOriginalPerson.Any() || ImportExternalProjectStagingsWhereYouAreTheCreatePerson.Any() || Notifications.Any() || OrganizationsWhereYouAreThePrimaryContactPerson.Any() || PerformanceMeasureNotesWhereYouAreTheCreatePerson.Any() || PerformanceMeasureNotesWhereYouAreTheUpdatePerson.Any() || (PersonLoginAccount != null) || PersonSettingGridColumnSettings.Any() || PersonStewardGeospatialAreas.Any() || PersonStewardOrganizations.Any() || PersonStewardTaxonomyBranches.Any() || ProjectsWhereYouAreThePrimaryContactPerson.Any() || ProjectsWhereYouAreTheProposingPerson.Any() || ProjectsWhereYouAreTheReviewedByPerson.Any() || ProjectsWhereYouAreTheSubmittedByPerson.Any() || ProjectContactsWhereYouAreTheContact.Any() || ProjectContactUpdatesWhereYouAreTheContact.Any() || ProjectInternalNotesWhereYouAreTheCreatePerson.Any() || ProjectInternalNotesWhereYouAreTheUpdatePerson.Any() || ProjectLocationStagings.Any() || ProjectLocationStagingUpdates.Any() || ProjectNotesWhereYouAreTheCreatePerson.Any() || ProjectNotesWhereYouAreTheUpdatePerson.Any() || ProjectNoteUpdatesWhereYouAreTheCreatePerson.Any() || ProjectNoteUpdatesWhereYouAreTheUpdatePerson.Any() || ProjectProjectStatusesWhereYouAreTheProjectProjectStatusCreatePerson.Any() || ProjectProjectStatusesWhereYouAreTheProjectProjectStatusLastEditedPerson.Any() || ProjectUpdatesWhereYouAreThePrimaryContactPerson.Any() || ProjectUpdateBatchesWhereYouAreTheLastUpdatePerson.Any() || ProjectUpdateHistoriesWhereYouAreTheUpdatePerson.Any() || ReleaseNotesWhereYouAreTheCreatePerson.Any() || ReleaseNotesWhereYouAreTheUpdatePerson.Any() || SupportRequestLogsWhereYouAreTheRequestPerson.Any() || TechnicalAssistanceRequests.Any() || TechnicalAssistanceRequestUpdates.Any() || TenantAttributesWhereYouAreThePrimaryContactPerson.Any());
 }
コード例 #16
0
        public NotificationsViewModel(IApplicationService applicationService)
        {
            _applicationService = applicationService;
            _notifications      = new ReactiveList <NotificationModel>();
            Notifications       = _notifications.CreateDerivedCollection(x => x);

            LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
            {
                var req = applicationService.Client.Notifications.GetAll(all: Filter.All, participating: Filter.Participating);
                return(this.RequestModel(req, t as bool?, response => _notifications.Reset(response.Data)));
            });

            GoToNotificationCommand = ReactiveCommand.Create();
            GoToNotificationCommand.OfType <NotificationModel>().Subscribe(GoToNotification);

            ReadAllCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.ShownIndex).Select(x => x != 2), async t =>
            {
                try
                {
                    if (!Notifications.Any())
                    {
                        return;
                    }
                    await applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkAsRead());
                    _notifications.Clear();
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to mark all notifications as read. Please try again.", e);
                }
            });

            ReadRepositoriesCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                try
                {
                    var repo = t as string;
                    if (repo == null)
                    {
                        return;
                    }
                    var repoId = new RepositoryIdentifier(repo);
                    await applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkRepoAsRead(repoId.Owner, repoId.Name));
                    _notifications.RemoveAll(Notifications.Where(x => string.Equals(x.Repository.FullName, repo, StringComparison.OrdinalIgnoreCase)).ToList());
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to mark repositories' notifications as read. Please try again.", e);
                }
            });

            this.WhenAnyValue(x => x.ShownIndex).Subscribe(x =>
            {
                switch (x)
                {
                case 0:
                    Filter = NotificationsFilterModel.CreateUnreadFilter();
                    break;

                case 1:
                    Filter = NotificationsFilterModel.CreateParticipatingFilter();
                    break;

                default:
                    Filter = NotificationsFilterModel.CreateAllFilter();
                    break;
                }
            });

            this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(x => LoadCommand.ExecuteIfCan());
        }