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 GetAll() { return readAccountCode.All(); } public Model.Account.AccountCode ByAccountCode(int accountCode) { var list = ByAccountCode(new List { accountCode }); if (list.Any()) { return list[0]; } else { return null; } } public List ByAccountCode(List accountCodeList) { return readAccountCode.ByAccountCode(accountCodeList); } public Dictionary ConvertToDictionary(List accountCodeList) { var returnDict = new Dictionary(); if (accountCodeList == null) { return returnDict; } foreach (var accountCode in accountCodeList) { if (!returnDict.ContainsKey(accountCode.AccountCodeId)) { returnDict.Add(accountCode.AccountCodeId, accountCode); } } return returnDict; } } }