31 lines
891 B
C#
31 lines
891 B
C#
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();
|
|
}
|
|
}
|
|
}
|