} // StoreCompanyData private void StoreUsersData( MP_FreeAgentRequest mpRequest, List<FreeAgentUsers> freeAgentUsers, ElapsedTimeInfo elapsedTimeInfo, int mpId ) { if (mpRequest == null) return; log.Info("Saving {0} user(s) in DB...", freeAgentUsers.Count); var mpFreeAgentUsersList = new List<MP_FreeAgentUsers>(); foreach (FreeAgentUsers user in freeAgentUsers) { var mpFreeAgentUsers = new MP_FreeAgentUsers { Request = mpRequest, url = user.url, first_name = user.first_name, last_name = user.last_name, email = user.email, role = user.role, permission_level = user.permission_level, opening_mileage = user.opening_mileage, updated_at = user.updated_at, created_at = user.created_at }; mpFreeAgentUsersList.Add(mpFreeAgentUsers); } // for ElapsedTimeHelper.CalculateAndStoreElapsedTimeForCallInSeconds( elapsedTimeInfo, mpId, ElapsedDataMemberType.StoreDataToDatabase, () => Helper.StoreFreeAgentUsersData(mpFreeAgentUsersList) ); } // StoreUsersData
} // RetrieveAndAggregate private void StoreCompanyData( MP_FreeAgentRequest mpRequest, FreeAgentCompany freeAgentCompany, ElapsedTimeInfo elapsedTimeInfo, int mpId ) { if (mpRequest == null) return; log.Info("Saving company to DB..."); var mpFreeAgentCompany = new MP_FreeAgentCompany { Request = mpRequest, url = freeAgentCompany.url, name = freeAgentCompany.name, subdomain = freeAgentCompany.subdomain, type = freeAgentCompany.type, currency = freeAgentCompany.currency, mileage_units = freeAgentCompany.mileage_units, company_start_date = freeAgentCompany.company_start_date, freeagent_start_date = freeAgentCompany.freeagent_start_date, first_accounting_year_end = freeAgentCompany.first_accounting_year_end, company_registration_number = freeAgentCompany.company_registration_number, sales_tax_registration_status = freeAgentCompany.sales_tax_registration_status, sales_tax_registration_number = freeAgentCompany.sales_tax_registration_number, }; ElapsedTimeHelper.CalculateAndStoreElapsedTimeForCallInSeconds( elapsedTimeInfo, mpId, ElapsedDataMemberType.StoreDataToDatabase, () => { Helper.StoreFreeAgentCompanyData(mpFreeAgentCompany); Helper.UpdateMarketplaceDisplayName(mpRequest.CustomerMarketPlace, freeAgentCompany.name); } ); } // StoreCompanyData