Files
moadiran/Back/Services/servTaxPayer.cs

28 lines
1.2 KiB
C#
Raw Normal View History

2024-04-30 16:40:05 +03:30
using Back.Common.Enums;
using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
namespace Back.Services
{
public class servTaxPayer
{
private readonly IAsyncRepository<SentTax> _repoSentTax;
public servTaxPayer(IAsyncRepository<SentTax> repoSentTax)
{
_repoSentTax = repoSentTax;
}
public async Task<bool> ExistSuccessfulorSendorpendingInvoiceinCompanyID(int CompanyID)
{
return await _repoSentTax.Get(w => w.invoice.CompanyID == CompanyID && (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending)).AnyAsync();
}
public async Task<bool> CheckingTheCompanyKeyInformation(int CompanyID, string UniqeMemory, string PrivateKey, string EconomicCode)
{
return await _repoSentTax.Get(w => (w.invoice.company.UniqeMemory == UniqeMemory || w.invoice.company.PrivateKey == PrivateKey || w.invoice.company.EconomicCode == EconomicCode)
&& (w.SentStatus == SentStatus.Successful || w.SentStatus == SentStatus.Send || w.SentStatus == SentStatus.pending)
&& w.invoice.CompanyID != CompanyID).AnyAsync();
}
}
}