/// <summary> /// Set business area /// </summary> /// <param name="businessArea"></param> /// <returns></returns> /// <exception cref="MasterDataIdentityNotDefined"></exception> public bool SetBusinessArea(MasterDataIdentity businessArea) { if (_isSaved) { return(false); } if (businessArea == null) { _businessArea = null; return(true); } MasterDataBase accountId = _management.GetMasterData(businessArea, MasterDataType.BUSINESS_AREA); if (accountId == null) { throw new MasterDataIdentityNotDefined(businessArea, MasterDataType.BUSINESS_AREA); } _businessArea = businessArea; return(true); }
/// <summary> /// Master data load /// </summary> /// <param name="source"></param> /// <param name="masterData"></param> public void LoadMasterData(Object source, MasterDataBase masterData) { foreach (MasterDataLoad d in MasterDataLoadHandler.GetInvocationList()) { d(source, masterData); } }
/// <summary> /// Set gl account /// </summary> /// <param name="glAccount"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="MasterDataIdentityNotDefined"></exception> public bool SetGLAccount(MasterDataIdentity_GLAccount glAccount) { if (_isSaved) { return(false); } // check G/L account if (glAccount == null) { throw new ArgumentNullException("G/L account"); } MasterDataBase accountId = _management.GetMasterData(glAccount, MasterDataType.GL_ACCOUNT); if (accountId == null) { throw new MasterDataIdentityNotDefined(glAccount, MasterDataType.GL_ACCOUNT); } _type = AccountType.GL_ACCOUNT; _glAccount = glAccount; _vendor = null; _customer = null; return(true); }
/// <summary> /// Raise master data created event /// </summary> /// <param name="factory"></param> /// <param name="masterData"></param> public void CreateMasterData(MasterDataFactoryBase factory, MasterDataBase masterData) { foreach (MasterDataCreated d in MasterDataCreatedHandler.GetInvocationList()) { d(factory, masterData); } }
/// <summary> /// Set vendor /// </summary> /// <param name="vendor"></param> /// <param name="glAccount"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="MasterDataIdentityNotDefined"></exception> public bool SetVendor(MasterDataIdentity vendor, MasterDataIdentity_GLAccount glAccount) { if (_isSaved) { return(false); } // check customer if (vendor == null) { throw new ArgumentNullException("Vendor"); } MasterDataBase vendorId = _management.GetMasterData(vendor, MasterDataType.VENDOR); if (vendorId == null) { throw new MasterDataIdentityNotDefined(vendor, MasterDataType.VENDOR); } // check G/L account if (glAccount == null) { throw new ArgumentNullException("G/L account"); } MasterDataBase data = _management.GetMasterData(glAccount, MasterDataType.GL_ACCOUNT); if (data == null) { throw new MasterDataIdentityNotDefined(glAccount, MasterDataType.GL_ACCOUNT); } MasterDataIdentity accountId = data.Identity; if (accountId == null) { throw new MasterDataIdentityNotDefined(glAccount, MasterDataType.GL_ACCOUNT); } _type = AccountType.VENDOR; _glAccount = glAccount; _vendor = vendor; _customer = null; return(true); }
/// <summary> /// set report when new master data /// </summary> /// <param name="data"></param> private void newMasterdata(MasterDataBase data) { GLAccountMasterData glAcc = data as GLAccountMasterData; if (glAcc == null) { return; } if (!_items.ContainsKey(glAcc.GLIdentity)) { GLAccountBalanceItem item = new GLAccountBalanceItem(glAcc.GLIdentity); _items.Add(glAcc.GLIdentity, item); item.AddAmount(_coreDriver.StartMonthId, glAcc.InitAmount); } }
private void masterDataCreated(MasterDataFactoryBase factory, MasterDataBase master) { newMasterdata(master); }
private void masterDataLoad(Object source, MasterDataBase masterData) { newMasterdata(masterData); }