[#77] Entities: Add AreaComContract to group area commitments together
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Elwig.Models.Entities;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections.Generic;
|
||||
using Elwig.Models.Dtos;
|
||||
using Elwig.Models.Entities;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace Elwig.Helpers {
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Elwig.Helpers {
|
||||
public DbSet<MemberTelNr> MemberTelephoneNrs { get; private set; }
|
||||
public DbSet<MemberEmailAddr> MemberEmailAddrs { get; private set; }
|
||||
public DbSet<MemberHistory> MemberHistory { get; private set; }
|
||||
public DbSet<AreaComContract> AreaCommitmentContracts { get; private set; }
|
||||
public DbSet<AreaCom> AreaCommitments { get; private set; }
|
||||
public DbSet<Season> Seasons { get; private set; }
|
||||
public DbSet<DeliverySchedule> DeliverySchedules { get; private set; }
|
||||
@@ -142,7 +143,7 @@ namespace Elwig.Helpers {
|
||||
}
|
||||
|
||||
public async Task<bool> FbNrExists(int fbnr) {
|
||||
return await AreaCommitments.FindAsync(fbnr) != null;
|
||||
return await AreaCommitmentContracts.FindAsync(fbnr) != null;
|
||||
}
|
||||
|
||||
public async Task<bool> SortIdExists(string sortId) {
|
||||
@@ -166,11 +167,18 @@ namespace Elwig.Helpers {
|
||||
|
||||
public async Task<int> NextFbNr() {
|
||||
int c = 0;
|
||||
(await AreaCommitments.OrderBy(ac => ac.FbNr).Select(ac => ac.FbNr).ToListAsync())
|
||||
(await AreaCommitmentContracts.OrderBy(ac => ac.FbNr).Select(ac => ac.FbNr).ToListAsync())
|
||||
.ForEach(a => { if (a <= c + 10000) c = a; });
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
public async Task<int> NextRevNr(int fbnr) {
|
||||
int c = 0;
|
||||
(await AreaCommitments.Where(c => c.FbNr == fbnr).Select(c => c.RevNr).ToListAsync())
|
||||
.ForEach(a => { if (a <= c + 100) c = a; });
|
||||
return c + 1;
|
||||
}
|
||||
|
||||
public async Task<int> NextLNr(DateOnly date, string zwstid) {
|
||||
var dateStr = date.ToString("yyyy-MM-dd");
|
||||
int c = 0;
|
||||
|
||||
Reference in New Issue
Block a user