private Model(IfcStore model) { _model = model; if (_model.Instances.Count == 0) { return; } // use all means of caching to get the initial structures quickly using (var entities = model.BeginEntityCaching()) using (var cache = model.BeginInverseCaching()) { // breakdown items _breakdownStructure = BreakdownItem.GetBreakdownStructure(this).ToList(); // milestones _milestones = Milestone.GetMilestones(this).ToList(); // reasons _reasons = Reason.GetReasons(this).ToList(); // actors _actors = Actor.GetActors(this).ToList(); // all requirements in project libraries _requirements = RequirementsSet.GetRequirements(this).ToList(); } }
private void ShowTickets() { if (mResettingTicketFilters) { return; } FormUtil.Reselect <Ticket>(ticketsListView, () => { string summaryFilter = ticketSummaryTextBox.Text; var reporterFilter = (string)ticketReportersComboBox.SelectedItem; var assignedFilter = (string)ticketAssignedToComboBox.SelectedItem; string milestoneFilter = (string)ticketMilestoneComboBox.SelectedItem; var stateFilter = FormUtil.CastBoxToEnum <MetaTicketState>(ticketStateComboBox); var severityFilter = FormUtil.CastBoxToEnum <TicketSeverity>(ticketSeverityComboBox); var priorityFilter = FormUtil.CastBoxToEnum <TicketPriority>(ticketPriorityComboBox); var typeFilter = FormUtil.CastBoxToEnum <TicketType>(ticketTypeComboBox); Ticket[] tickets = Project.GetTickets(mContext); tickets = tickets.Where(t => { bool satisfiesSummaryFilter = FormUtil.SatisfiesFilterContains(t.Summary, summaryFilter); bool satisfiesReporterFilter = FormUtil.SatisfiesFilterMatch(t.ReportedBy, reporterFilter); bool satisfiesAssignedFilter = FormUtil.SatisfiesFilterMatch(t.AssignedTo, assignedFilter); bool satisfiesMilestoneFilter = FormUtil.SatisfiesFilterMatch(t.GetMilestone(mContext).Name, milestoneFilter); bool satisfiesStateFilter = stateFilter == null || stateFilter.Value.AppliesTo(t.State); bool satisfiesSeverityFilter = FormUtil.SatisfiesFilterEnum(t.Severity, severityFilter); bool satisfiesPriorityFilter = FormUtil.SatisfiesFilterEnum(t.Priority, priorityFilter); bool satisfiesTypeFilter = FormUtil.SatisfiesFilterEnum(t.Type, typeFilter); bool satisfiesCreatedFilter = FormUtil.SatisfiesFilterContains(t.CreateTimestamp, mTicketCreateFilter); bool satisfiesModifiedFilter = FormUtil.SatisfiesFilterContains(t.ModifyTimestamp, mTicketModifyFilter); return (satisfiesSummaryFilter && satisfiesReporterFilter && satisfiesAssignedFilter && satisfiesMilestoneFilter && satisfiesStateFilter && satisfiesSeverityFilter && satisfiesPriorityFilter && satisfiesTypeFilter && satisfiesCreatedFilter && satisfiesModifiedFilter); }).ToArray(); // Cache milestones. var milestoneNames = new Dictionary <int, string>(); Milestone[] milestones = Milestone.GetMilestones(mContext); foreach (Milestone milestone in milestones) { milestoneNames[milestone.ID] = milestone.Name; } ticketsListView.BeginUpdate(); ticketsListView.Items.Clear(); foreach (var ticket in tickets) { string ticketPriority = TicketChangeFormatter.Default.TranslateTicketPriority(ticket.Priority); string ticketType = TicketChangeFormatter.Default.TranslateTicketType(ticket.Type); string ticketSeverity = TicketChangeFormatter.Default.TranslateTicketSeverity(ticket.Severity); string ticketState = TicketChangeFormatter.Default.TranslateTicketState(ticket.State); var lvi = new ListViewItem(); lvi.Text = $"{ticket.TicketNumber}"; lvi.SubItems.Add(ticket.Summary); lvi.SubItems.Add(milestoneNames[ticket.MilestoneID]); lvi.SubItems.Add(ticketPriority); lvi.SubItems.Add(ticketType); lvi.SubItems.Add(ticketSeverity); lvi.SubItems.Add(ticketState); lvi.Tag = ticket; ticketsListView.Items.Add(lvi); } ticketsListView.EndUpdate(); ticketsListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); }); UpdateButtonsEnabledProperty(); }