Exemplo n.º 1
0
        public RelatedContactsAccounts GetAllRelatedContactsAccounts()
        {
            RelatedContactsAccounts relatedContactsAccounts = new RelatedContactsAccounts();

            DataTable contacts = getContacts();

            List <string> emailaddressList = contacts.AsEnumerable()
                                             .Select(row => row.Field <string>("emailaddress")).ToList();
            DataTable relatedAccounts = getRelatedAccounts(emailaddressList);

            relatedContactsAccounts.Contacts = contacts.AsEnumerable().Select(row => new Contact()
            {
                ContactId = row.Field <string>("contactid"),
                FirstName = row.Field <string>("firstname"),
                LastName  = row.Field <string>("lastname"),
                Email     = row.Field <string>("emailaddress")
                            //Mobile
            }).ToList();

            relatedContactsAccounts.Accounts = relatedAccounts.AsEnumerable().Select(row => new Account()
            {
                AccountId     = row.Field <string>("accountid"),
                AccountName   = row.Field <string>("name"),
                AccountNumber = row.Field <string>("accountnumber")
                                //VatNumber
            }).ToList();;

            return(relatedContactsAccounts);
        }
Exemplo n.º 2
0
        public RelatedContactsAccounts GetAllRelatedContactsAccounts()
        {
            // if (OrganizationService != null)
            RelatedContactsAccounts relatedContactsAccounts = new RelatedContactsAccounts();

            DataTable contacts = getContacts();

            List <string> emailaddressList = contacts.AsEnumerable()
                                             .Select(row => row.Field <string>("emailaddress")).ToList();
            DataTable relatedAccounts = getRelatedAccounts(emailaddressList);

            relatedContactsAccounts.Contacts        = contacts;
            relatedContactsAccounts.RelatedAccounts = relatedAccounts;

            return(relatedContactsAccounts);
        }