public Account GetParent() { if (this.Level == 1) { return(Account.Empty); } var accountNumberSeparator = this.AccountsChart.MasterData.AccountNumberSeparator; var parentAccountNumber = this.Number.Substring(0, this.Number.LastIndexOf(accountNumberSeparator)); return(AccountsChart.GetAccount(parentAccountNumber)); }
public StandardAccount GetParent() { if (!this.HasParent) { return(StandardAccount.Empty); } var accountNumberSeparator = this.AccountsChart.MasterData.AccountNumberSeparator; var parentAccountNumber = this.Number.Substring(0, this.Number.LastIndexOf(accountNumberSeparator)); var parent = AccountsChart.GetAccount(parentAccountNumber); return(StandardAccount.Parse(parent.StandardAccountId)); }