You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
using Biskilog_Accounting.Server.POSModels;
|
|
using Biskilog_Accounting.Shared.Interfaces;
|
|
using Biskilog_Accounting.Shared.POSModels;
|
|
|
|
namespace Biskilog_Accounting.Server.Services
|
|
{
|
|
public class CompanyService : ICompanyInfo
|
|
{
|
|
private readonly BiskAcdbContext m_context;
|
|
private readonly ITokenService m_tokenService;
|
|
private readonly HttpContext m_httpContext;
|
|
|
|
private Tblcompanydetail m_companyInfo { get; set; }
|
|
private IEnumerable<Tblbranch> m_companyBranches { get; set; }
|
|
public CompanyService(BiskAcdbContext a_context, ITokenService a_tokenService, IHttpContextAccessor a_httpContextAccessor)
|
|
{
|
|
m_context = a_context;
|
|
m_tokenService = a_tokenService;
|
|
m_httpContext = a_httpContextAccessor?.HttpContext;
|
|
m_companyInfo = new Tblcompanydetail();
|
|
m_companyBranches = new List<Tblbranch>();
|
|
|
|
GetCompanyInfoAsync();
|
|
GetBranches();
|
|
}
|
|
public IEnumerable<Tblbranch> FetchBranches()
|
|
{
|
|
return m_companyBranches;
|
|
}
|
|
|
|
public async Task<IEnumerable<Tblbranch>> GetBranches()
|
|
{
|
|
m_companyBranches = m_context.Tblbranches;
|
|
return await Task.FromResult(m_companyBranches);
|
|
}
|
|
|
|
public string GetBranchName(string a_branchId)
|
|
{
|
|
return m_companyBranches.FirstOrDefault(b => b.BranchId == a_branchId).BranchName;
|
|
}
|
|
|
|
public Task<Tblcompanydetail> GetCompanyInfoAsync()
|
|
{
|
|
m_companyInfo = m_context.Tblcompanydetails.First();
|
|
return Task.FromResult(m_companyInfo);
|
|
}
|
|
|
|
public string GetCompanyName()
|
|
{
|
|
return m_companyInfo.CompanyName;
|
|
}
|
|
}
|
|
}
|
|
|