/// <summary>
        /// Construct
        /// </summary>
        /// <param name="coreDriver">Core Driver</param>
        /// <param name="management">Matadata management</param>
        /// <param name="id"></param>
        /// <param name="descp"></param>
        /// <param name="accNumber"></param>
        /// <param name="bankKey"></param>
        /// <param name="type"></param>
        /// <exception cref="ArgumentNullException">Arguments null</exception>
        /// <exception cref="MasterDataIdentityNotDefined">Master data identity is not defined.</exception>
        public BankAccountMasterData(CoreDriver coreDriver, MasterDataManagement management,
                                     MasterDataIdentity id, String descp, BankAccountNumber accNumber,
                                     MasterDataIdentity bankKey, BankAccountType type)
            : base(coreDriver, management, id, descp)
        {
            _accNumber   = accNumber;
            _bankAccType = type;

            MasterDataBase bankKeyId = management.GetMasterData(bankKey,
                                                                MasterDataType.BANK_KEY);

            if (bankKeyId == null)
            {
                throw new MasterDataIdentityNotDefined(bankKey,
                                                       MasterDataType.BANK_KEY);
            }
            _bankKey = bankKeyId.GetIdentity();
        }
        /// <summary>
        /// set bank key
        /// </summary>
        /// <param name="bankKey"></param>
        /// <exception cref="ArgumentNullException">Arguments null</exception>
        /// <exception cref="MasterDataIdentityNotDefined">Master data identity is not defined.</exception>
        public void SetBankKey(MasterDataIdentity bankKey)
        {
            if (bankKey == null)
            {
                throw new ArgumentNullException("Bank Key");
            }

            MasterDataManagement management = this._management;
            MasterDataBase       bankKeyId  = management.GetMasterData(bankKey,
                                                                       MasterDataType.BANK_KEY);

            if (bankKeyId == null)
            {
                throw new MasterDataIdentityNotDefined(bankKey,
                                                       MasterDataType.BANK_KEY);
            }

            this.SetDirtyData();
            _bankKey = bankKeyId.GetIdentity();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="coreDriver"></param>
        /// <param name="management"></param>
        /// <param name="id"></param>
        /// <param name="descp"></param>
        /// <param name="bankAccount"></param>
        /// <exception cref="ArgumentNullException">Argument is null.</exception>
        /// <exception cref="NoGLAccountGroupException">No such G\L account group exception</exception>
        public GLAccountMasterData(CoreDriver coreDriver,
                                   MasterDataManagement management, MasterDataIdentity_GLAccount id,
                                   String descp, MasterDataIdentity bankAccount)
            : base(coreDriver, management, id, descp)
        {
            // check id and get group
            String groupId = id.ToString().Substring(0, 4);

            try
            {
                _group = GLAccountGroup.Parse(groupId);
            }
            catch (GLAccountGroupFormatException)
            {
                throw new NoGLAccountGroupException(groupId);
            }

            if (bankAccount == null)
            {
                _bankAccount = null;
            }
            else
            {
                MasterDataBase bankAccountId = _management.GetMasterData(
                    bankAccount, MasterDataType.BANK_ACCOUNT);
                if (bankAccountId == null)
                {
                    throw new MasterDataIdentityNotDefined(bankAccount,
                                                           MasterDataType.BANK_ACCOUNT);
                }
                _bankAccount = bankAccountId.GetIdentity();
            }

            // init amount
            _initAmount = new CurrencyAmount();
        }