コード例 #1
0
ファイル: Account.cs プロジェクト: DonaldAirey/quasar
        /// <summary>
        /// Initializes a Account.
        /// </summary>
        /// <param name="configurationId">Defines which external fields are used to identify an object.</param>
        /// <param name="accountId">The account identifier.</param>
        /// <returns>A account record, null if the identifier doesn't exist.</returns>
        protected override void Initialize(int accountId)
        {
            // Use the specified configuration to find the internal account identifier.
            ClientMarketData.AccountRow accountRow = ClientMarketData.Account.FindByAccountId(accountId);
            if (accountRow == null)
            {
                throw new Exception(String.Format("Account {0} doesn't exist", accountId));
            }

            // Initialize the base class.
            base.Initialize(accountId);

            // Initialize the record from the data model.
            this.accountType  = (AccountType)accountRow.AccountTypeCode;
            this.baseCurrency = Security.Make(accountRow.CurrencyId);
            this.mnemonic     = accountRow.IsMnemonicNull() ? string.Empty : accountRow.Mnemonic;
        }