public static void AddContactPerson(int compID, int persID)
        {
            IDalSession session = NHSessionFactory.CreateSession();
            IContactCompany comp = (IContactCompany)ContactMapper.GetContact(session, compID);
            IContactPerson pers = (IContactPerson)ContactMapper.GetContact(session, persID);
            ICompanyContactPerson contactPerson = new CompanyContactPerson(pers, comp);

            if (!comp.CompanyContacts.Contains(contactPerson))
            {
                comp.CompanyContacts.Add(contactPerson);
                ContactMapper.Update(session, comp);
            }
            session.Close();
        }
Ejemplo n.º 2
0
        private static ICompanyContactPerson CreateCompanyContactPerson(IDalSession session,
                                                        IContactCompany company,
                                                        string BurgerServiceNummer,
                                                        string Voorletters,
                                                        string Tussenvoegsels,
                                                        string Naam,
                                                        Address PostalAddress,
                                                        Address ResidentialAddress,
                                                        IContactDetails ContactDetails,
                                                        Gender ContactGender,
                                                        INationality ContactNationality,
                                                        IIdentification Id,
                                                        DateTime Dob,
                                                        IManagementCompany AssetManager,
                                                        DateTime creationdate)
        {
            ICompanyContactPerson cmpcp = null;
            IContactPerson contact = null;

            if (company != null && !string.IsNullOrEmpty(Naam))
            {
                if (!LookupContactPersonByBSN(session, BurgerServiceNummer, out contact))
                {
                    contact = new ContactPerson(Voorletters,
                                                    Tussenvoegsels,
                                                    ContactGender,
                                                    ContactNationality,
                                                    Naam,
                                                    PostalAddress,
                                                    ResidentialAddress,
                                                    ContactDetails);
                    contact.BurgerServiceNummer = BurgerServiceNummer;
                    contact.AssetManager = (IAssetManager)AssetManager;
                    contact.Identification = Id;
                    contact.DateOfBirth = Dob;
                    contact.CreationDate = creationdate;
                }
                cmpcp = new CompanyContactPerson(contact, company);
            }
            return cmpcp;
        }
Ejemplo n.º 3
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;
        }