Skip to content
This repository was archived by the owner on Dec 7, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Controller/ResearcherController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public static List<Researcher> FilterByLevel(string EmploymentLevel, ObservableC
tempResearcherList = new List<Researcher>(filtered);
}
else
{
var filtered = from Researcher researcher in researchers
where researcher.level == LEVEL.E
select researcher;
tempResearcherList = new List<Researcher>(filtered);
{
var filtered = from Researcher researcher in researchers
where researcher.level == LEVEL.E
select researcher;
tempResearcherList = new List<Researcher>(filtered);
}

return tempResearcherList;
}

Expand All @@ -126,11 +126,15 @@ public static List<Researcher> FilterBy(JOBLEVEL level)
public static List<Researcher> FilterByName(string name, ObservableCollection<Researcher> researchers)
{
var filteredResearchers = from researcher in researchers
where string.Equals(researcher.FullName(), name, StringComparison.OrdinalIgnoreCase)
select researcher;

return filteredResearchers.ToList();
/*var filteredResearchers = from researcher in researchers
from res in researcher.FullName() // nested LINQ as there is a list within a list
where researcher.Equals(name)
select res;

return (List<Researcher>)filteredResearchers.ToList();
return (List<Researcher>)filteredResearchers.ToList();*/
//return allResearchers.Where(r => r.givenName.Contains(name) || r.familyName.Contains(name)).ToList();
}

Expand Down
4 changes: 4 additions & 0 deletions CumulativeView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@ public CumulativeView()
{
InitializeComponent();
}

//load the data from the database for cumulative view
//GetPublicationsForResearcher()

}
}
14 changes: 7 additions & 7 deletions ResearcherListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<StackPanel Orientation="Vertical">
<TextBox Text="LevelFilter:" FontWeight="Bold" TextChanged="TextBox_TextChanged" IsReadOnly="true"/>
<ComboBox x:Name="FilterLevelComboBox" SelectionChanged="FilterLevelComboBox_SelectionChanged">
<ComboBoxItem Content="A"/>
<ComboBoxItem Content="B"/>
<ComboBoxItem Content="C"/>
<ComboBoxItem Content="D"/>
<ComboBoxItem Content="E"/>
<ComboBoxItem Content="Student"/>
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Level A"/>
<ComboBoxItem Content="Level B"/>
<ComboBoxItem Content="Level C"/>
<ComboBoxItem Content="Level D"/>
<ComboBoxItem Content="Level E"/>
<ComboBoxItem Content="Student Only"/>
<ComboBoxItem Content="Show All Researchers"/>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" RenderTransformOrigin="0.497,3.977" Height="43" Width="475">
Expand Down
12 changes: 6 additions & 6 deletions ResearcherView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<TextBox x:Name="Performance_by_funding_received" HorizontalAlignment="Left" Margin="191,234,0,0" TextWrapping="Wrap" Text="Performance by funding received" VerticalAlignment="Top" Width="238" Height="18" IsReadOnly="True"/>
<TextBox x:Name="___Title_" HorizontalAlignment="Center" Margin="0,10,0,0" TextWrapping="Wrap" Text="RESEARCHER DETAILS" VerticalAlignment="Top" Width="128" Height="20" TextDecorations="Underline" IsReadOnly="True"/>
<Button x:Name="Count" Content="View Cumulative Count:
" HorizontalAlignment="Left" Margin="618,29,0,0" VerticalAlignment="Top" Width="143" Height="29" Click="Button_Click"/>
" HorizontalAlignment="Left" Margin="618,29,0,0" VerticalAlignment="Top" Width="143" Height="29" Click="CumulativeViewButton_Click"/>
<TextBox HorizontalAlignment="Left" Margin="190,270,0,0" TextWrapping="Wrap" Text="Supervisions:" VerticalAlignment="Top" Width="239" TextDecorations="Underline" Background="#4C1E1E1E"/>
<ListView x:Name="Supervisions" d:ItemsSource="{d:SampleData ItemCount=5}" Height="NaN" Margin="190,293,372,492" Width="NaN" Grid.RowSpan="2" Background="#4C1E1E1E" >
<ListView.View>
Expand All @@ -49,17 +49,17 @@
<Rectangle HorizontalAlignment="Left" Height="453" Margin="309,86,0,0" Grid.Row="1" Stroke="Black" VerticalAlignment="Top" Width="606"/>
<TextBox x:Name="Degree" HorizontalAlignment="Left" Margin="191,28,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Degree" VerticalAlignment="Top" Width="238" IsReadOnly="True"/>
<TextBox x:Name="Supervisor" HorizontalAlignment="Left" Margin="191,45,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Supervisor" VerticalAlignment="Top" Width="238" IsReadOnly="True"/>
<TextBox HorizontalAlignment="Left" Margin="23,105,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Sort publication" VerticalAlignment="Top" Width="120" TextDecorations="Underline" IsReadOnly="True" MouseDown="SortPublicationListBox_MouseDown"/>
<TextBox HorizontalAlignment="Left" Margin="23,105,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Sort publication" VerticalAlignment="Top" Width="120" TextDecorations="Underline" IsReadOnly="True" />
<TextBox HorizontalAlignment="Left" Margin="336,105,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Publications:" VerticalAlignment="Top" Width="120" TextDecorations="Underline" IsReadOnly="True"/>
<TextBox HorizontalAlignment="Left" Margin="23,141,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Filter by year (earliest to latest):" VerticalAlignment="Top" Width="120" IsReadOnly="True"/>
<TextBox HorizontalAlignment="Left" Margin="23,199,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Start Year" VerticalAlignment="Top" Width="72" Height="26" Background="#FF646464" TextChanged="TextBox_TextChanged_4"/>
<TextBox x:Name="StartYearTextBox" HorizontalAlignment="Left" Margin="23,199,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Start Year" VerticalAlignment="Top" Width="72" Height="26" Background="#FF646464" TextChanged="StartYearTextBox_TextChanged"/>
<TextBox HorizontalAlignment="Left" Margin="102,203,0,0" Grid.Row="1" TextWrapping="Wrap" Text="-" VerticalAlignment="Top" Width="20"/>
<TextBox HorizontalAlignment="Left" Margin="127,199,0,0" Grid.Row="1" TextWrapping="Wrap" Text="End Year" VerticalAlignment="Top" Width="72" Height="26" Background="#FF646464"/>
<ListView x:Name="PublicationListBox" Grid.Row="1" d:ItemsSource="{d:SampleData ItemCount=6}" Margin="336,138,58,26" Height="NaN" Width="NaN" SelectionChanged="ListView_SelectionChanged">
<ListView x:Name="PublicationListBox" Grid.Row="1" d:ItemsSource="{Binding Publications}" SelectedItem="{Binding selectedPublications}" Margin="336,138,58,26" Height="NaN" Width="NaN" SelectionChanged="ListView_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="Year" DisplayMemberBinding="{Binding Year}" Width="50"/>
<GridViewColumn Header="Title" DisplayMemberBinding="{Binding Title}" Width="300"/>
<GridViewColumn Header="Year" DisplayMemberBinding="{Binding Path = Year}" Width="50"/>
<GridViewColumn Header="Title" DisplayMemberBinding="{Binding Path = Title}" Width="300"/>
</GridView>
</ListView.View>
</ListView>
Expand Down
72 changes: 71 additions & 1 deletion ResearcherView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public ResearcherView(Researcher r)
Performance_by_funding_received.AppendText("Performance by Funding: " + s.PerformanceByFunding());

}
//Set the publications list box to the publications of the researcher
/*List<Publication> publications = EnRDBAdapter.FetchBasicPublicationsDetails(p, id);

foreach (Publication p in publications)
{
Console.WriteLine(p.year + " " + p.title);
}

PublicationListBox.ItemsSource = publications;
*/
}


Expand All @@ -69,9 +79,13 @@ private void TextBox_TextChanged_4(object sender, TextChangedEventArgs e)

}

private void Button_Click(object sender, RoutedEventArgs e)
private void CumulativeViewButton_Click(object sender, RoutedEventArgs e)
{
// Create an instance of the CumulativeView window
CumulativeView cumulativeView = new CumulativeView();

// Show the CumulativeView window
cumulativeView.Show();
}

/*private void SortPublicationTextBox_MouseDown(object sender, MouseButtonEventArgs e)
Expand All @@ -80,6 +94,62 @@ private void Button_Click(object sender, RoutedEventArgs e)
SortByYear();
}*/

//Filter publications by year

private void StartYearTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
FilterPublicationsByYearRange();
}

private void EndYearTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
FilterPublicationsByYearRange();
}

private void FilterPublicationsByYearRange()
{
// Check if both start and end year text boxes have valid values
if (int.TryParse(StartYearTextBox.Text, out int startYear) && int.TryParse(EndYearTextBox.Text, out int endYear))
{
// Filter publications based on the year range
int researcherId = 1; //?
var filteredPublications = PublicationsController.FilterByYearRange(researcherId, startYear, endYear);

// Update the items in the PublicationListBox
PublicationListBox.ItemsSource = filteredPublications;
}
}

//Sort publications by year
private void SortPublicationsButton_Click(object sender, RoutedEventArgs e)
{
// Assuming you have a collection of publications as the item source of PublicationListBox
List<Publication> publications = (List<Publication>)PublicationListBox.ItemsSource;

// Check if there are publications to sort
if (publications != null && publications.Count > 0)
{
// Determine the sort order (ascending or descending) based on a condition
//bool ascendingOrder = /* true or false */;

// Sort the publications using your existing function
//publications = SortByYear(researcherId, ascendingOrder);

// Update the ListBox with the sorted publications
PublicationListBox.ItemsSource = publications;
}

/*if (publications != null)
{
// Sort publications by year and title
publications = publications.OrderBy(p => p.year).ThenBy(p => p.title).ToList();

// Update the item source of PublicationListBox
PublicationListBox.ItemsSource = publications;
}*/

}

private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (PublicationListBox.SelectedItem != null)
Expand Down
Binary file modified obj/Debug/RAP_Assignment.csproj.AssemblyReference.cache
Binary file not shown.