Distribution_GL Initialization

This commit is contained in:
2026-10-20 13:07:07 +05:30
commit 3f16e0cb44
194 changed files with 35659 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
using General_Ledger_Service.Infra;
using General_Ledger_Service.Interfaces.Repositories;
using General_Ledger_Service.Models;
using Microsoft.EntityFrameworkCore;
namespace General_Ledger_Service.Repositories
{
public class BankRepository(AppDBContext context) : IBankRepository
{
private readonly AppDBContext _context = context;
public Task<BankAccount?> GetByIdAsync(long bankAccountId) =>
RepositoryHelpers.GetByIdAsync(_context.BankAccounts, bankAccountId);
public Task<BankAccount> AddAsync(BankAccount bankAccount) =>
RepositoryHelpers.AddAsync(_context.BankAccounts, bankAccount);
public async Task<List<BankAccount>> GetAllAsync() =>
await _context.BankAccounts.Include(b => b.GlAccount).OrderBy(b => b.AccountName).ToListAsync();
public Task<BankStatementLine?> GetStatementLineByIdAsync(long stmtLineId) =>
RepositoryHelpers.GetByIdAsync(_context.BankStatementLines, stmtLineId);
public async Task AddStatementLinesAsync(IEnumerable<BankStatementLine> lines) =>
await _context.BankStatementLines.AddRangeAsync(lines);
public Task<CashAccount> AddCashAccountAsync(CashAccount cashAccount) =>
RepositoryHelpers.AddAsync(_context.CashAccounts, cashAccount);
public async Task<List<CashAccount>> GetAllCashAccountsAsync() =>
await _context.CashAccounts.Include(c => c.CashAccountType).Include(c => c.GlAccount).OrderBy(c => c.AccountName).ToListAsync();
public async Task<CashAccount?> GetCashAccountByIdAsync(long cashAccountId) =>
await _context.CashAccounts.Include(c => c.CashAccountType).Include(c => c.GlAccount)
.FirstOrDefaultAsync(c => c.CashAccountId == cashAccountId);
public async Task<bool> AnyDefaultCashAccountAsync() =>
await _context.CashAccounts.AnyAsync(c => c.IsDefault);
public void RemoveCashAccount(CashAccount cashAccount) => _context.CashAccounts.Remove(cashAccount);
public async Task<bool> CashAccountNumberExistsAsync(string accountNumber) =>
await _context.CashAccounts.AnyAsync(c => c.AccountNumber == accountNumber);
public async Task<CashAccountType?> GetCashAccountTypeByNameAsync(string name) =>
await _context.CashAccountTypes.FirstOrDefaultAsync(t => t.Name.ToLower() == name.ToLower());
public Task<CashAccountType> AddCashAccountTypeAsync(CashAccountType cashAccountType) =>
RepositoryHelpers.AddAsync(_context.CashAccountTypes, cashAccountType);
public async Task<List<CashAccountType>> GetAllCashAccountTypesAsync() =>
await _context.CashAccountTypes.OrderBy(t => t.Name).ToListAsync();
}
}