private Vacancy GetOlderVersionSameVacancy(HeadHunterVacancy headHunterVacancy, HeadHunterSnippet headHunterSnippet) { var vacancy = GetVacancy(headHunterVacancy, headHunterSnippet); vacancy.SourceUpdatedDate = vacancy.SourceUpdatedDate.AddDays(-1); return(vacancy); }
private async Task <Area> GetOrCreateAreaAsync(SourceType sourceType, HeadHunterVacancy headHunterVacancy) { var sourceArea = await _storageBroker.SelectSourceAreaByIdAndTypeIdAsync(sourceType.Id, headHunterVacancy.Area.Id) ?? await AddSourceAreaAsync(sourceType, headHunterVacancy.Area); return(sourceArea.Area); }
private Employment GetEmployment(HeadHunterVacancy headHunterVacancyResponse) { var returnedEmployment = new Employment { Id = 1, Code = headHunterVacancyResponse.Employment.Id, Name = headHunterVacancyResponse.Employment.Name }; return(returnedEmployment); }
private Vacancy GetVacancy(HeadHunterVacancy headHunterVacancy, HeadHunterSnippet headHunterSnippet) { var vacancy = GetRandomVacancy(); vacancy.SourceId = headHunterVacancy.Id; vacancy.SourceUpdatedDate = headHunterSnippet.UpdateDate; vacancy.IsArchived = false; return(vacancy); }
private async Task <Employment> GetOrCreateEmploymentAsync(HeadHunterVacancy headHunterVacancy) { if (headHunterVacancy.Employment == null) { return(null); } return(_storageBroker.SelectAllEmployments().FirstOrDefault(e => e.Code.ToLower().Equals(headHunterVacancy.Employment.Id.ToLower())) ?? await AddEmploymentAsync(headHunterVacancy.Employment)); }
public async Task <Schedule> GetOrCreateScheduleAsync(HeadHunterVacancy headHunterVacancy) { if (headHunterVacancy.Schedule == null) { return(null); } return(_storageBroker.SelectAllSchedules().FirstOrDefault(s => s.Code.ToLower().Equals(headHunterVacancy.Schedule.Id.ToLower())) ?? await AddScheduleAsync(headHunterVacancy.Schedule)); }
private SourceEmployer GetSourceEmployer(Employer employer, HeadHunterVacancy headHunterVacancy, SourceType sourceType) { return(new() { EmployerId = employer.Id, SourceId = headHunterVacancy.Employer.Id, SourceTypeId = sourceType.Id, Employer = employer }); }
private SourceArea GetSourceArea(Area returnedArea, HeadHunterVacancy vacancyResponse, SourceType returnedSourceType) { return(new() { Id = 1, AreaId = returnedArea.Id, Area = returnedArea, SourceId = vacancyResponse.Area.Id, SourceTypeId = returnedSourceType.Id, SourceType = returnedSourceType }); }
private async Task <Vacancy> CreateVacancyAsync(SourceType sourceType, HeadHunterSnippet snippet, HeadHunterVacancy headHunterVacancy) { var currencyName = headHunterVacancy.Salary?.Currency?.Trim(); var vacancy = CreateVacancy(snippet, headHunterVacancy); vacancy.EmployerId = (await GetOrCreateEmployerAsync(sourceType, headHunterVacancy)).Id; vacancy.AreaId = (await GetOrCreateAreaAsync(sourceType, headHunterVacancy))?.Id; vacancy.CurrencyId = currencyName == null ? null : (await GetOrCreateCurrencyAsync(currencyName)).Id; vacancy.SourceTypeId = sourceType.Id; vacancy.ScheduleId = (await GetOrCreateScheduleAsync(headHunterVacancy))?.Id; vacancy.EmploymentId = (await GetOrCreateEmploymentAsync(headHunterVacancy))?.Id; vacancy.IsRemote = headHunterVacancy.Schedule?.Id == "remote"; return(vacancy); }
private async Task <Employer> GetOrCreateEmployerAsync(SourceType sourceType, HeadHunterVacancy headHunterVacancy) { var hhEmployer = new HeadHunterEmployer { Name = headHunterVacancy.Employer.Name, Id = headHunterVacancy.Employer.Id, Url = headHunterVacancy.Url }; hhEmployer.Id ??= "-999"; var sourceEmployer = await _storageBroker.SelectSourceEmployerByIdAndTypeIdAsync(sourceType.Id, hhEmployer.Id) ?? await AddSourceEmployerAsync(sourceType, hhEmployer); return(sourceEmployer.Employer); }
private static Vacancy CreateVacancy(HeadHunterSnippet snippet, HeadHunterVacancy headHunterVacancy) { var vacancy = new Vacancy { SourceId = headHunterVacancy.Id, Title = headHunterVacancy.Name, Descriptions = headHunterVacancy.Description, Responsibilities = snippet.Responsibility, SalaryFrom = headHunterVacancy.Salary?.From, SalaryTo = headHunterVacancy.Salary?.To, IsSalaryGross = headHunterVacancy.Salary?.IsGross, Url = headHunterVacancy.Url, RawData = headHunterVacancy.RawData, IsArchived = snippet.Archived, SourceCreatedDate = headHunterVacancy.CreatedDate, SourceUpdatedDate = headHunterVacancy.UpdateDate, ContentUpdatedDate = headHunterVacancy.UpdateDate }; return(vacancy); }
private Schedule GetSchedule(HeadHunterVacancy headHunterVacancyResponse) { return(new() { Id = 1, Code = headHunterVacancyResponse.Schedule.Id, Name = headHunterVacancyResponse.Schedule.Name }); }
private Currency GetCurrency(HeadHunterVacancy headHunterVacancy) { return(new() { Id = 1, Name = headHunterVacancy.Salary.Currency }); }