Ejemplo n.º 1
0
        private static List <Contact> MergeContacts(List <OfficeContactCollection> tempOfficeContactsList, List <PipedriveContactCollection> tempPipedriveContactList)
        {
            // this will hold all the contacts
            List <Contact> contactList = new List <Contact>();

            // make a list with all the office contacts
            List <Contact> officeContactList = ContactCollection.CreateContactList(tempOfficeContactsList, tempPipedriveContactList);

            return(contactList);
        }
Ejemplo n.º 2
0
        private static async Task <Task> GetContacts(string officeLogin, string officePassword, string pipedriveAPIKey)
        {
            // get number of office contacts
            Console.WriteLine("\n\nNumber of office contacts: ");
            int numberOfOfficeContacts = await GetNumbumberOfOfficeContacts(officeLogin, officePassword);

            Console.WriteLine(numberOfOfficeContacts);

            // get all contacts from office
            Console.WriteLine("\n\nGetting Office Contacts...\n\n");
            List <OfficeContactCollection> tempOfficeContactsList = GetOfficeContacts(officeLogin, officePassword, numberOfOfficeContacts);

            // get all pipedrive contacts
            Console.WriteLine("\n\nGetting Trisha's Pipedrive Contacts...\n\n");
            List <PipedriveContactCollection> tempPipedriveContactList = GetPipedriveContacts(pipedriveAPIKey);

            // get daves contacts
            Console.WriteLine("\n\nGetting Daves's Pipedrive Contacts...\n\n");
            List <PipedriveContactCollection> tempPipedriveContactListDave = GetPipedriveContacts(davesAPIKey);

            foreach (PipedriveContactCollection davesCollection in tempPipedriveContactListDave)
            {
                tempPipedriveContactList.Add(davesCollection);
            }

            // merge into single list
            Console.WriteLine("\n\nCompare Contacts...\n\n");
            List <Contact> contactList = ContactCollection.CreateContactList(tempOfficeContactsList, tempPipedriveContactList);

            Console.WriteLine("\n\nCompare Complete...\n\n");

            // this is for debugging only
            Console.WriteLine("\n\nWriting to file...\n\n");
            await EmailLogs(contactList);

            Console.WriteLine("\n\nWrite to file Complete...\n\n");

            // add contacts
            Console.WriteLine("\n\nAdding Contacts...\n\n");
            await SyncContacts(contactList);

            return(Task.Delay(0));
        }