示例#1
0
        private static ICustomerAccount CreateAccount(IEGAccount egAccount, DateTime creationDate, IAccountFamily family)
        {
            ICustomerAccount newAcc = new CustomerAccount(egAccount.Nummer, egAccount.AccountRequest.AccountName,
                                                egAccount.AssetManager, egAccount.AccountRequest.ModelPortfolio, creationDate);

            newAcc.Family = family;
            IEGAanvraag aacRequest = egAccount.AccountRequest;

            Decimal firstDeposit = 0m;
            if (decimal.TryParse(egAccount.AccountRequest.EersteInleg, out firstDeposit))
                newAcc.FirstPromisedDeposit = new B4F.TotalGiro.Instruments.Money(firstDeposit, newAcc.BaseCurrency);
            newAcc.ValuationsRequired = true;
            newAcc.IsExecOnlyCustomer = egAccount.AccountRequest.IsExecutionOnly;
            return newAcc;
        }
示例#2
0
        private static ICustomerAccount processAanvraag(IDalSession session, IEGAccount acc)
        {
            IEGAanvraag aacReq = acc.AccountRequest;

            //Most Important ... Manage Contact First
            IContact primary = null;
            IContact secondary = null;
            DateTime creationdate = session.GetServerTime();

            if (aacReq.IsPersonalAccount)
            {
                primary = CreateContactPerson(session, aacReq.SOFI,
                                                        aacReq.Voorletters,
                                                        aacReq.Tussenvoegsels,
                                                        aacReq.Naam,
                                                        aacReq.PostalAddress,
                                                        aacReq.ResidentialAddress1,
                                                        aacReq.ContactDetails1,
                                                        aacReq.PrimaryGender,
                                                        aacReq.Nationality1,
                                                        aacReq.Identification1,
                                                        aacReq.Geboortedatum,
                                                        acc.AssetManager,
                                                        creationdate);
                if (aacReq.IsDualAccount)
                    secondary = CreateContactPerson(session, aacReq.PSOFI,
                                                        aacReq.PVoorletters,
                                                        aacReq.PTussenvoegsels,
                                                        aacReq.PNaam,
                                                        aacReq.PostalAddress,
                                                        aacReq.ResidentialAddress2,
                                                        aacReq.ContactDetails2,
                                                        aacReq.SecondaryGender,
                                                        aacReq.Nationality2,
                                                        aacReq.Identification2,
                                                        aacReq.PGeboortedatum,
                                                        acc.AssetManager,
                                                        creationdate);
            }
            else
            {
                primary = CreateContactCompany(session, aacReq.KVK,
                                                        aacReq.BNaam,
                                                        aacReq.PostalAddress,
                                                        aacReq.BAddress,
                                                        aacReq.BContactDetails,
                                                        aacReq.DatumOprichting,
                                                        acc.AssetManager,
                                                        creationdate);

                // contact person on company
                secondary = CreateContactPerson(session, aacReq.SOFI,
                                                        aacReq.Voorletters,
                                                        aacReq.Tussenvoegsels,
                                                        aacReq.Naam,
                                                        aacReq.PostalAddress,
                                                        aacReq.ResidentialAddress1,
                                                        aacReq.ContactDetails1,
                                                        aacReq.PrimaryGender,
                                                        aacReq.Nationality1,
                                                        aacReq.Identification1,
                                                        aacReq.Geboortedatum,
                                                        acc.AssetManager,
                                                        creationdate);

            }
            ICounterAccount counterAccount = CreateCounterAccount(session, primary, acc);

            // store contacts
            B4F.TotalGiro.CRM.ContactMapper.Update(session, primary);
            if (secondary != null) B4F.TotalGiro.CRM.ContactMapper.Update(session, secondary);

            // check for contactperson on company
            if (!aacReq.IsPersonalAccount && secondary != null)
            {
                ICompanyContactPerson compContactPerson = new CompanyContactPerson((IContactPerson)secondary, (IContactCompany)primary);

                if (!((IContactCompany)primary).CompanyContacts.Contains(compContactPerson))
                {
                    ((IContactCompany)primary).CompanyContacts.Add(compContactPerson);
                    ContactMapper.Update(session, primary);
                }
            }

            // get the family
            IAccountFamily family = AccountFamilyMapper.GetAccountFamily(session, acc.NummerPreFix);
            ICustomerAccount newAcc = CreateAccount(acc, creationdate, family);

            //add as accountHolders
            newAcc.AccountHolders.Add(new AccountHolder(newAcc, primary));
            newAcc.AccountHolders.SetPrimaryAccountHolder(primary);

            if (secondary != null)
            {
                newAcc.AccountHolders.Add(new AccountHolder(newAcc, secondary));
                secondary.CounterAccounts.Add(newAcc.CounterAccount);
            }

            //Add CounterAccount
            newAcc.CounterAccount = counterAccount;

            //set the account on the aanvraag
            acc.TGAccount = newAcc;

            //update all
            B4F.TotalGiro.Accounts.AccountMapper.Update(session, newAcc);

            //Set the Model History
            IInternalEmployeeLogin employee = (IInternalEmployeeLogin)LoginMapper.GetCurrentLogin(session);
            IModelHistory item = new ModelHistory(newAcc, newAcc.Lifecycle, newAcc.ModelPortfolio, newAcc.IsExecOnlyCustomer, newAcc.EmployerRelationship, employee, creationdate);
            newAcc.ModelPortfolioChanges.Add(item);
            B4F.TotalGiro.Accounts.AccountMapper.Update(session, newAcc);

            return newAcc;
        }
示例#3
0
        private static ICounterAccount CreateCounterAccount(IDalSession session, IContact contact, IEGAccount egAccount)
        {
            if (contact == null)
                throw new ApplicationException("Contact is mandatory in creating a new account");

            IEGAanvraag aacRequest = egAccount.AccountRequest;

            ICounterAccount counterAcc = CounterAccountMapper.GetCounterAccount(session, aacRequest.TegenRekening);

            if (counterAcc == null)
            {
                counterAcc = new CounterAccount(aacRequest.TegenRekening,
                   aacRequest.TegenRekeningTNV,
                   aacRequest.Bank,
                   (aacRequest.Bank == null ? aacRequest.TegenRekeningBank : null),
                   new Address(aacRequest.TegenRekeningPlaats, null),
                   egAccount.AssetManager, false, null, true);
            }
            if (!contact.CounterAccounts.Contains(counterAcc))
                contact.CounterAccounts.Add(counterAcc);
            return counterAcc;
        }