Rename solution directory to Elwig
This commit is contained in:
30
Elwig/Windows/ContractListWindow.xaml.cs
Normal file
30
Elwig/Windows/ContractListWindow.xaml.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Models;
|
||||
|
||||
namespace Elwig.Windows {
|
||||
public partial class ContractListWindow : Window {
|
||||
private readonly AppDbContext Context = new();
|
||||
|
||||
public ContractListWindow(Member member) {
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RefreshContractList() {
|
||||
Context.Members.Load();
|
||||
List<Contract> contracts = Context.Contracts.OrderBy(c => c.MgNr).ToList();
|
||||
|
||||
ContractList.ItemsSource = contracts;
|
||||
if (contracts.Count == 1)
|
||||
ContractList.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void ContractList_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
|
||||
RefreshContractList();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user