public void Delete(int id) { var entity = _dbContext.Find <FacilityEntity>(id); if (entity != null) { _dbContext.Remove(entity); } }
public void Delete(Guid id) { var entity = _dbContext.Find <BreakEntity>(id); if (entity != null) { _dbContext.Remove(entity); } }
public void Delete(Guid uid) { var entity = _dbContext.Find <Entities.Tenant.Clash>(uid); if (entity != null) { _dbContext.Remove(entity); } }
public void Delete(int id) { var entity = _dbContext.Find <Entities.Tenant.DeliveryCappingGroup>(id); if (entity != null) { _dbContext.Remove(entity); } }
public void Delete(int id) { var entity = _dbContext.Find <Entities.Tenant.LengthFactor>(id); if (entity != null) { _dbContext.Remove(entity); } }
public void Update(FlexibilityLevel item) { var entity = _dbContext.Find <Entities.Tenant.FlexibilityLevel>(item.Id); if (entity != null) { _mapper.Map(item, entity); _dbContext.Update(entity, post => post.MapTo(item), _mapper); } }
public void Update(AutopilotRule item) { var entity = _dbContext.Find <Entities.Tenant.AutopilotRule>(item.Id); if (entity != null) { _mapper.Map(item, entity); _dbContext.Update(entity, post => post.MapTo(item), _mapper); } }
public void Update(BRSConfigurationTemplate item) { var entity = _dbContext.Find <Entities.Tenant.BRS.BRSConfigurationTemplate>(new object[] { item.Id }, find => find.IncludeCollection(x => x.KPIConfigurations)); if (entity is null) { return; } _mapper.Map(item, entity); _dbContext.Update(entity, post => post.MapTo(item), _mapper); }
public void Add(Channel channel) { var entity = _dbContext.Find <Entities.Tenant.Channel>(channel.Id); if (entity == null) { _dbContext.Add(_mapper.Map <Entities.Tenant.Channel>(channel), post => post.MapTo(channel), _mapper); } else { _mapper.Map(channel, entity); _dbContext.Update(entity, post => post.MapTo(channel), _mapper); } }
public void Delete(int id) { var entity = _dbContext.Find <Entities.Tenant.SpotPlacement>(id); if (entity != null) { _dbContext.Remove(entity); } }
public void Delete(int id) { var entity = _dbContext.Find <BookingPositionGroupEntity>(id); if (entity != null) { _dbContext.Remove(entity); } }
public EfficiencySettings UpdateDefault(EfficiencySettings settings) { var settingsToSave = settings.Id == default ? GetDefault().FulfillFrom(settings) : settings; var entity = _dbContext.Find <Entities.Tenant.EfficiencySettings>(settingsToSave.Id); _mapper.Map(settingsToSave, entity); _dbContext.Update(entity, post => post.MapTo(settingsToSave), _mapper); return(settingsToSave); }
public void Delete(int id) { if (_scheduleCache.TryGetValue(id, out var entity)) { _ = _scheduleCache.Remove(entity.Id); _dbContext.Remove(entity); } else { entity = _dbContext.Find <ScheduleEntity>(id); if (entity != null) { _dbContext.Remove(entity); } } }
public void Update(ISRSettings isrSettings) { if (isrSettings == null) { throw new ArgumentNullException(nameof(isrSettings)); } var entity = _dbContext.Find <ISRSettingsEntity>(new object[] { isrSettings.Id }, post => { _ = post.IncludeCollection(e => e.DemographicsSettings); }); if (entity != null) { _ = _mapper.Map(isrSettings, entity, opts => opts.UseEntityCache(_salesAreaByNameCache)); _ = _dbContext.Update(entity, post => post.MapTo(isrSettings, opts => opts.UseEntityCache(_salesAreaByIdCache)), _mapper); } }
public InventoryLockType Get(int id) => _mapper.Map <InventoryLockType>(_dbContext.Find <Entities.Tenant.InventoryStatuses.InventoryLockType>(id));
public void Execute(Guid salesAreaId) { var salesArea = _dbContext.Find <SalesArea>(salesAreaId); if (salesArea is null) { throw new InvalidOperationException($"SalesArea with id {salesAreaId} was not found"); } (Guid[] notStartedRunIds, int[] notStartedPassIds) = GetNotStartedRunPassIds(); var breaksToDelete = GatherBreaks(salesArea); var clashDiffsToDelete = GatherClashDifferences(salesArea); (List <Restriction> restrictionsToDelete, List <RestrictionSalesArea> restrictionSalesAreasToDelete) = GatherRestrictions(salesArea); var inventoryLocksToDelete = GatherInventoryLocks(salesArea); var librarySalesAreaPassPrioritiesToDelete = GatherLibrarySalesAreaPassPriorities(salesArea); var isrSettingsToDelete = GatherIsrSettings(salesArea); var rsSettingsToDelete = GatherRsSettings(salesArea); var breakExclusionsToDelete = GatherBreakExclusions(salesArea, notStartedPassIds); var passSalesAreaPrioritiesToDelete = GatherPassSalesAreaPriorities(salesArea, notStartedPassIds); (List <PassRatingPoint> passRatingPointsToDelete, List <PassRatingPoint> passRatingPointsToUpdate) = GatherPassRatingPoints(salesArea, notStartedPassIds); var ratingsPredictionSchedulesToDelete = GatherRatingsPredictionSchedules(salesArea); var runSalesAreaPrioritiesToDelete = GatherRunSalesAreaPriorities(salesArea, notStartedRunIds); var programmesToDelete = GatherProgrammes(salesArea); var salesAreaDemographicsToDelete = GatherSalesAreaDemos(salesArea); var schedulesToDelete = GatherSchedules(salesArea); var universesToDelete = GatherUniverses(salesArea); (List <SponsorshipItem> sponsorshipItemsToDelete, List <SponsorshipItem> sponsorshipItemsToUpdate) = GatherSponsorshipItems(salesArea); (List <SpotBookingRule> spotBookingRulesToDelete, List <SpotBookingRuleSalesArea> spotBookingRuleSalesAreasToDelete) = GatherSpotBookingRules(salesArea); var spotsToDelete = GatherSpots(salesArea); var totalRatingsToDelete = GatherTotalRatings(salesArea); var transaction = _dbContext.Specific.Database.BeginTransaction(); try { _dbContext.BulkInsertEngine.BulkDelete(breaksToDelete); _dbContext.BulkInsertEngine.BulkDelete(clashDiffsToDelete); _dbContext.BulkInsertEngine.BulkDelete(restrictionsToDelete); _dbContext.BulkInsertEngine.BulkDelete(restrictionSalesAreasToDelete); _dbContext.BulkInsertEngine.BulkDelete(inventoryLocksToDelete); _dbContext.BulkInsertEngine.BulkDelete(librarySalesAreaPassPrioritiesToDelete); _dbContext.BulkInsertEngine.BulkDelete(isrSettingsToDelete); _dbContext.BulkInsertEngine.BulkDelete(rsSettingsToDelete); _dbContext.BulkInsertEngine.BulkDelete(breakExclusionsToDelete); _dbContext.BulkInsertEngine.BulkDelete(passSalesAreaPrioritiesToDelete); _dbContext.RemoveRange(passRatingPointsToDelete.ToArray()); _dbContext.BulkInsertEngine.BulkDelete(ratingsPredictionSchedulesToDelete); _dbContext.BulkInsertEngine.BulkDelete(runSalesAreaPrioritiesToDelete); _dbContext.BulkInsertEngine.BulkDelete(programmesToDelete); _dbContext.BulkInsertEngine.BulkDelete(salesAreaDemographicsToDelete); _dbContext.BulkInsertEngine.BulkDelete(schedulesToDelete); _dbContext.BulkInsertEngine.BulkDelete(universesToDelete); _dbContext.BulkInsertEngine.BulkDelete(sponsorshipItemsToDelete); _dbContext.BulkInsertEngine.BulkDelete(spotBookingRulesToDelete); _dbContext.BulkInsertEngine.BulkDelete(spotBookingRuleSalesAreasToDelete); _dbContext.BulkInsertEngine.BulkDelete(spotsToDelete); _dbContext.BulkInsertEngine.BulkDelete(totalRatingsToDelete); _dbContext.BulkInsertEngine.BulkUpdate(passRatingPointsToUpdate); _dbContext.BulkInsertEngine.BulkUpdate(sponsorshipItemsToUpdate); _dbContext.Remove(salesArea); _dbContext.SaveChanges(); transaction.Commit(); } catch { transaction.Rollback(); throw; } finally { transaction.Dispose(); } }
public Domain.Shared.SalesAreas.SalesArea Find(Guid id) => _mapper.Map <Domain.Shared.SalesAreas.SalesArea>(_dbContext.Find <Entities.Tenant.SalesAreas.SalesArea>(new object[] { id }, find => find.IncludeCollection(sa => sa.ChannelGroups).IncludeCollection(sa => sa.Holidays)));
public TotalRating Get(int id) => _mapper.Map <TotalRating>(_dbContext.Find <TotalRatingEntity>(id), opts => opts.UseEntityCache(_salesAreaByIdCache));
public StandardDayPartGroup Get(int id) => _mapper.Map <StandardDayPartGroup>(_dbContext.Find <StandardDayPartGroupEntity>(new object[] { id }, find => find.IncludeCollection(x => x.Splits)), opts => opts.UseEntityCache(_salesAreaByIdCache));
public ProgrammeDictionary Find(int id) => _mapper.Map <ProgrammeDictionary>(_dbContext.Find <Entities.Tenant.ProgrammeDictionary>(id));
public Universe Find(Guid id) => _mapper.Map <Universe>(_dbContext.Find <Entities.Tenant.Universe>(id), opts => opts.UseEntityCache(_salesAreaByIdCache));
public InventoryLock Get(int id) => _mapper.Map <InventoryLock>(_dbContext.Find <Entities.Tenant.InventoryStatuses.InventoryLock>(id), opts => opts.UseEntityCache(_salesAreaByIdCache));
public BookingPosition Get(int id) => _mapper.Map <BookingPosition>(_dbContext.Find <BookingPositionEntity>(id));
public void Delete(int id) { _dbContext.Remove(_dbContext.Find <PassEntity>(id)); }
public ProgrammeCategoryHierarchy Get(int id) => _mapper.Map <ProgrammeCategoryHierarchy>(_dbContext.Find <Entities.Tenant.ProgrammeCategoryHierarchy>(id));
private RunTypeEntity GetEntity(int id) => _dbContext.Find <RunTypeEntity>(id);
public IndexType Find(int id) => _mapper.Map <IndexType>(_dbContext.Find <Entities.Tenant.IndexType>(id), opts => opts.UseEntityCache(_salesAreaByIdCache));
public SpotBookingRule Get(int id) => _mapper.Map <SpotBookingRule>(_dbContext.Find <SpotBookingRuleEntity>(new object[] { id }, post => post.IncludeCollection(e => e.SalesAreas)), opts => opts.UseEntityCache(_salesAreaByIdCache));
public AWSInstanceConfiguration Get(int id) { return(_mapper.Map <AWSInstanceConfiguration>(_dbContext.Find <Entities.Tenant.AWSInstanceConfiguration>(id))); }
public ClearanceCode Find(int id) => _mapper.Map <ClearanceCode>(_dbContext.Find <Entities.Tenant.ClearanceCode>(id));