mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 14:37:16 +00:00
60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace bnhtrade.Core.Logic.Account
|
|
{
|
|
public class GetAccountCodeInfo
|
|
{
|
|
private Data.Database.Account.ReadAccountCode readAccountCode;
|
|
|
|
public GetAccountCodeInfo()
|
|
{
|
|
readAccountCode = new Data.Database.Account.ReadAccountCode();
|
|
}
|
|
|
|
public List<Model.Account.AccountCode> GetAll()
|
|
{
|
|
return readAccountCode.All();
|
|
}
|
|
|
|
public Model.Account.AccountCode ByAccountCode(int accountCode)
|
|
{
|
|
var list = ByAccountCode(new List<int> { accountCode });
|
|
if (list.Any())
|
|
{
|
|
return list[0];
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public List<Model.Account.AccountCode> ByAccountCode(List<int> accountCodeList)
|
|
{
|
|
return readAccountCode.ByAccountCode(accountCodeList);
|
|
}
|
|
|
|
public Dictionary<int, Model.Account.AccountCode> ConvertToDictionary(List<Model.Account.AccountCode> accountCodeList)
|
|
{
|
|
var returnDict = new Dictionary<int, Model.Account.AccountCode>();
|
|
|
|
if (accountCodeList == null)
|
|
{
|
|
return returnDict;
|
|
}
|
|
|
|
foreach (var accountCode in accountCodeList)
|
|
{
|
|
if (!returnDict.ContainsKey(accountCode.AccountCodeId))
|
|
{
|
|
returnDict.Add(accountCode.AccountCodeId, accountCode);
|
|
}
|
|
}
|
|
return returnDict;
|
|
}
|
|
}
|
|
} |