Update models because contracts were removed
This commit is contained in:
@ -18,7 +18,7 @@ namespace Elwig.Windows {
|
||||
public AreaComAdminWindow(Member member) {
|
||||
InitializeComponent();
|
||||
this.member = member;
|
||||
Title = $"Flächenbindungen - {member.FamilyName} {member.GivenName} - Elwig";
|
||||
Title = $"Flächenbindungen - {member.AdministrativeName} - Elwig";
|
||||
ExemptInputs = new Control[] {
|
||||
MgNrInput, ContractList, AreaCommitmentList, NewContractButton, DeleteContractButton,
|
||||
ContractSaveButton, ContractCancelButton, NewAreaCommitmentButton,
|
||||
@ -40,8 +40,10 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async Task RefreshContractList() {
|
||||
/*
|
||||
await Context.Contracts.LoadAsync();
|
||||
await RefreshContractListQuery();
|
||||
*/
|
||||
}
|
||||
|
||||
private async Task RefreshAreaCommitmentList() {
|
||||
@ -50,6 +52,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async Task RefreshContractListQuery() {
|
||||
/*
|
||||
List<Contract> contracts = await Context.Contracts.Where(c => c.MgNr == member.MgNr).ToListAsync();
|
||||
|
||||
ContractList.ItemsSource = contracts;
|
||||
@ -59,9 +62,11 @@ namespace Elwig.Windows {
|
||||
// TODO notwendig?
|
||||
await RefreshAreaCommitmentList();
|
||||
RefreshInputs();
|
||||
*/
|
||||
}
|
||||
|
||||
private async Task RefreshAreaCommitmentListQuery() {
|
||||
/*
|
||||
Contract? contract = (Contract)ContractList.SelectedItem;
|
||||
|
||||
if (contract == null) {
|
||||
@ -75,9 +80,11 @@ namespace Elwig.Windows {
|
||||
if (parcels.Count == 1)
|
||||
AreaCommitmentList.SelectedIndex = 0;
|
||||
RefreshInputs();
|
||||
*/
|
||||
}
|
||||
|
||||
private void RefreshInputs(bool validate = false) {
|
||||
/*
|
||||
ClearInputStates();
|
||||
Contract? c = (Contract)ContractList.SelectedItem;
|
||||
AreaComParcel? a = (AreaComParcel)AreaCommitmentList.SelectedItem;
|
||||
@ -102,8 +109,10 @@ namespace Elwig.Windows {
|
||||
}
|
||||
if (!validate) ClearInputStates();
|
||||
GC.Collect();
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
private void FillInputs(AreaComParcel a) {
|
||||
ClearOriginalValues();
|
||||
|
||||
@ -124,6 +133,7 @@ namespace Elwig.Windows {
|
||||
|
||||
FillOriginalValues();
|
||||
}
|
||||
*/
|
||||
|
||||
private void NewAreaCommitmentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
IsCreating = true;
|
||||
@ -155,6 +165,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void DeleteAreaCommitmentButton_Click(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
AreaComParcel a = (AreaComParcel)AreaCommitmentList.SelectedItem;
|
||||
if (a == null) return;
|
||||
|
||||
@ -166,6 +177,7 @@ namespace Elwig.Windows {
|
||||
Context.SaveChanges();
|
||||
await RefreshAreaCommitmentList();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void NewContractButton_Click(object sender, RoutedEventArgs evt) {
|
||||
@ -182,6 +194,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void DeleteContractButton_Click(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
Contract c = (Contract)ContractList.SelectedItem;
|
||||
if (c == null) return;
|
||||
|
||||
@ -193,8 +206,10 @@ namespace Elwig.Windows {
|
||||
Context.SaveChanges();
|
||||
await RefreshContractList();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
private async Task<Contract> UpdateContract(Contract c) {
|
||||
int newVNr = int.Parse(VNrInput.Text);
|
||||
c.MgNr = int.Parse(MgNrInput.Text);
|
||||
@ -255,8 +270,10 @@ namespace Elwig.Windows {
|
||||
|
||||
return a;
|
||||
}
|
||||
*/
|
||||
|
||||
private async void AreaCommitmentSaveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
Contract c = await UpdateContract((Contract)ContractList.SelectedItem);
|
||||
AreaComParcel a = await UpdateaAreaComParcel(IsEditing ? (AreaComParcel)AreaCommitmentList.SelectedItem : Context.CreateProxy<AreaComParcel>());
|
||||
|
||||
@ -272,6 +289,7 @@ namespace Elwig.Windows {
|
||||
await RefreshAreaCommitmentList();
|
||||
ContractList.SelectedItem = c;
|
||||
AreaCommitmentList.SelectedItem = a;
|
||||
*/
|
||||
}
|
||||
|
||||
private void AreaCommitmentResetButton_Click(object sender, RoutedEventArgs evt) {
|
||||
@ -297,6 +315,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void ContractSaveButton_Click(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
Contract c = await UpdateContract(Context.CreateProxy<Contract>());
|
||||
AreaComParcel a = await UpdateaAreaComParcel(Context.CreateProxy<AreaComParcel>());
|
||||
|
||||
@ -312,6 +331,7 @@ namespace Elwig.Windows {
|
||||
await RefreshAreaCommitmentList();
|
||||
ContractList.SelectedItem = c;
|
||||
AreaCommitmentList.SelectedItem = a;
|
||||
*/
|
||||
}
|
||||
|
||||
private void ContractCancelButton_Click(object sender, RoutedEventArgs evt) {
|
||||
@ -336,10 +356,12 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void InitInputs() {
|
||||
/*
|
||||
VNrInput.Text = ContractList.SelectedItem == null ? (await Context.NextVNr()).ToString() : ((Contract)ContractList.SelectedItem).VNr.ToString();
|
||||
MgNrInput.Text = member.MgNr.ToString();
|
||||
FillOriginalValues();
|
||||
ValidateRequiredInputs();
|
||||
*/
|
||||
}
|
||||
|
||||
private void EnableContractNewDeleteButtons() {
|
||||
@ -439,6 +461,7 @@ namespace Elwig.Windows {
|
||||
ComboBox_SelectionChanged(sender, evt);
|
||||
}
|
||||
|
||||
/*
|
||||
protected void InputTextChanged(TextBox input, Func<TextBox, bool, AppDbContext, Contract?, ValidationResult> checker) {
|
||||
InputTextChanged(input, checker(input, SenderIsRequired(input), Context, (Contract)ContractList.SelectedItem));
|
||||
}
|
||||
@ -446,17 +469,22 @@ namespace Elwig.Windows {
|
||||
protected void InputLostFocus(TextBox input, Func<TextBox, bool, AppDbContext, Contract?, ValidationResult> checker, string? msg = null) {
|
||||
InputLostFocus(input, checker(input, SenderIsRequired(input), Context, (Contract)ContractList.SelectedItem), msg);
|
||||
}
|
||||
*/
|
||||
|
||||
private void NumericInput_TextChanged(object sender, RoutedEventArgs evt) {
|
||||
InputTextChanged((TextBox)sender, Validator.CheckInteger);
|
||||
}
|
||||
|
||||
private void VNrInput_TextChanged(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
InputTextChanged((TextBox)sender, Validator.CheckVNr);
|
||||
*/
|
||||
}
|
||||
|
||||
private void VNrInput_LostFocus(object sender, RoutedEventArgs evt) {
|
||||
/*
|
||||
InputLostFocus((TextBox)sender, Validator.CheckVNr);
|
||||
*/
|
||||
}
|
||||
|
||||
private void YearFromInput_TextChanged(object sender, RoutedEventArgs evt) {
|
||||
|
@ -409,7 +409,7 @@ namespace Elwig.Windows {
|
||||
ContactPostalInput.IsChecked = m.ContactViaPost;
|
||||
ContactEmailInput.IsChecked = m.ContactViaEmail;
|
||||
|
||||
AreaCommitment.Text = $"{m.ActiveContracts.Select(c => c.Area).Sum():N0} m²";
|
||||
AreaCommitment.Text = $"{m.ActiveAreaCommitments.Select(c => c.Area).Sum():N0} m²";
|
||||
|
||||
Menu_Member_SendEmail.IsEnabled = m.Email != null;
|
||||
|
||||
|
Reference in New Issue
Block a user