コード例 #1
0
        /// <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();
        }
コード例 #2
0
        /// <summary>
        /// Set bank account
        /// </summary>
        /// <param name="bankAccount"></param>
        /// <exception cref="MasterDataIdentityNotDefined"></exception>
        public void SetBankAccount(MasterDataIdentity bankAccount)
        {
            if (bankAccount == null)
            {
                // clear
                _bankAccount = null;
                return;
            }
            MasterDataBase bankAccountId = this._management.GetMasterData(bankAccount,
                                                                          MasterDataType.BANK_ACCOUNT);

            if (bankAccountId == null)
            {
                throw new MasterDataIdentityNotDefined(bankAccount,
                                                       MasterDataType.BANK_ACCOUNT);
            }
            this.SetDirtyData();
            _bankAccount = bankAccountId.Identity;
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
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();
        }
コード例 #5
0
        /// <summary>
        /// parse XDocument to master data factory
        /// </summary>
        /// <param name="constructor"></param>
        /// <param name="type"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        /// <exception cref="MasterDataFileFormatException">Master data file format Exception</exception>
        /// <exception cref="SystemException">Bug</exception>
        private MasterDataFactoryBase factoryParser(
            MasterDataType type, XDocument doc)
        {
            _coreDriver.logDebugInfo(this.GetType(), 88,
                                     String.Format("Parsing XML {0}...", type), MessageType.INFO);

            // get root element
            XElement rootElem = doc.Element(MasterDataUtils.XML_ROOT);

            if (rootElem == null)
            {
                _coreDriver.logDebugInfo(this.GetType(), 112,
                                         String.Format("No root element for master data {0}", type), MessageType.ERRO);
                throw new MasterDataFileFormatException(type);
            }

            MasterDataFactoryBase newFactory;

            #region Create new factory with contructor
            switch (type)
            {
            case MasterDataType.BANK_ACCOUNT:
                newFactory = new BankAccountMasterDataFactory(_coreDriver, this);
                break;

            case MasterDataType.BANK_KEY:
                newFactory = new BankKeyMasterDataFactory(_coreDriver, this);
                break;

            case MasterDataType.BUSINESS_AREA:
                newFactory = new BusinessAreaMasterDataFactory(_coreDriver, this);
                break;

            case MasterDataType.CUSTOMER:
                newFactory = new CustomerMasterDataFactory(_coreDriver, this);
                break;

            case MasterDataType.GL_ACCOUNT:
                newFactory = new GLAccountMasterDataFactory(_coreDriver, this);
                break;

            case MasterDataType.VENDOR:
                newFactory = new VendorMasterDataFactory(_coreDriver, this);
                break;

            default:
                throw new SystemException(new NoMasterDataFactoryClass(type));
            }

            #endregion

            try
            {
                foreach (XElement xelem in rootElem.Elements())
                {
                    if (xelem.Name.LocalName.Equals(MasterDataUtils.XML_ENTITY))
                    {
                        // parse master data entity
                        MasterDataBase masterData = newFactory.ParseMasterData(
                            _coreDriver, xelem);

                        // raise load master data
                        _coreDriver.ListenerMgmt.LoadMasterData(
                            this, masterData);
                    }
                }
            }
            catch (ArgumentNullException e)
            {
                _coreDriver.logDebugInfo(this.GetType(), 133, e.Message,
                                         MessageType.ERRO);
                throw new SystemException(e);
            }

            _coreDriver.logDebugInfo(this.GetType(), 88,
                                     String.Format("Parsing XML {0} complete.", type),
                                     MessageType.INFO);
            return(newFactory);
        }