Add AreaCommAdminWindow validations
This commit is contained in:
@ -295,5 +295,26 @@ namespace Elwig.Helpers {
|
||||
// TODO
|
||||
return new(true, "Not implemented yet");
|
||||
}
|
||||
|
||||
public static ValidationResult CheckVNr(TextBox input, bool required, AppDbContext ctx, Contract? c) {
|
||||
var res = CheckNumeric(input, required);
|
||||
if (!res.IsValid) {
|
||||
return res;
|
||||
} else if (!required && input.Text.Length == 0) {
|
||||
return new(true, null);
|
||||
}
|
||||
|
||||
int nr = int.Parse(input.Text);
|
||||
if (nr != c?.VNr && Utils.VNrExists(ctx, nr).GetAwaiter().GetResult()) {
|
||||
return new(false, "Vertragsnummer wird bereits verwendet");
|
||||
}
|
||||
|
||||
return new(true, null);
|
||||
}
|
||||
|
||||
public static ValidationResult CheckGstNr(TextBox input, bool required) {
|
||||
// TODO
|
||||
return new(true, "Not implemented yet");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user