mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-19 22:47:15 +00:00
Feature: stock replenishment
This commit is contained in:
@@ -10,19 +10,29 @@ namespace bnhtrade.Core.Data.Database.Account
|
||||
public class ReadAccountCode : Connection
|
||||
{
|
||||
private Data.Database.SqlWhereBuilder sqlWhere = new SqlWhereBuilder();
|
||||
private List<Model.Account.AccountCode> resultList;
|
||||
private List<Model.Account.Account> resultList;
|
||||
|
||||
public ReadAccountCode()
|
||||
{
|
||||
}
|
||||
|
||||
public List<Model.Account.AccountCode> All()
|
||||
/// <summary>
|
||||
/// Gets the full chart of accounts
|
||||
/// </summary>
|
||||
/// <returns>Dictionary where the database record id is the key</returns>
|
||||
public Dictionary<uint, Model.Account.Account> All()
|
||||
{
|
||||
Innit();
|
||||
return Execute(null, null);
|
||||
var list = Execute(null, null);
|
||||
var dictionary = new Dictionary<uint, Model.Account.Account>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
dictionary.Add(item.Id, item);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public List<Model.Account.AccountCode> ByAccountCode(List<int> accountCodeList)
|
||||
public List<Model.Account.Account> ByAccountCode(List<int> accountCodeList)
|
||||
{
|
||||
Innit();
|
||||
|
||||
@@ -35,7 +45,7 @@ namespace bnhtrade.Core.Data.Database.Account
|
||||
return Execute(sqlWhere.SqlWhereString, sqlWhere.ParameterList);
|
||||
}
|
||||
|
||||
private List<Model.Account.AccountCode> Execute(string sqlWhere, Dictionary<string, object> parameters)
|
||||
private List<Model.Account.Account> Execute(string sqlWhere, Dictionary<string, object> parameters)
|
||||
{
|
||||
//build sql query
|
||||
string sqlString = @"
|
||||
@@ -45,6 +55,7 @@ namespace bnhtrade.Core.Data.Database.Account
|
||||
,tblAccountChartOf.Description
|
||||
,tblAccountChartOfType.AccountChartOfType
|
||||
,tblAccountChartOfType.BasicType
|
||||
,tblAccountChartOfType.Multiplier
|
||||
FROM tblAccountChartOf
|
||||
INNER JOIN tblAccountChartOfType ON tblAccountChartOf.AccountChartOfTypeID = tblAccountChartOfType.AccountChartOfTypeID
|
||||
" + sqlWhere;
|
||||
@@ -69,19 +80,20 @@ namespace bnhtrade.Core.Data.Database.Account
|
||||
{
|
||||
while (reader.Read())
|
||||
{
|
||||
var result = new Model.Account.AccountCode();
|
||||
|
||||
int tablePk = reader.GetInt32(0);
|
||||
result.AccountCodeId = reader.GetInt32(1);
|
||||
result.Title = reader.GetString(2);
|
||||
if (!reader.IsDBNull(3)) { result.Description = reader.GetString(3); }
|
||||
result.Type = reader.GetString(4);
|
||||
result.BasicType = reader.GetString(5);
|
||||
uint tablePk = (uint)reader.GetInt32(0);
|
||||
uint accountCode = (uint)reader.GetInt32(1);
|
||||
string title = reader.GetString(2);
|
||||
string description = null;
|
||||
if (!reader.IsDBNull(3)) { description = reader.GetString(3); }
|
||||
string type = reader.GetString(4);
|
||||
string basicType = reader.GetString(5);
|
||||
int multiplier = reader.GetInt32(6);
|
||||
|
||||
var result = new Model.Account.Account(tablePk, accountCode, title, description, type, basicType, multiplier);
|
||||
resultList.Add(result);
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -90,7 +102,7 @@ namespace bnhtrade.Core.Data.Database.Account
|
||||
|
||||
private void Innit()
|
||||
{
|
||||
resultList = new List<Model.Account.AccountCode>();
|
||||
resultList = new List<Model.Account.Account>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user