public void ReaderClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var s2Id = Data.ExternalSystems.S2In.Id; var extId = Data.Reader.Location1Reader1ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); extId = Data.Reader.Location1Reader2ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); extId = Data.Reader.Location2Reader1ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); extId = Data.Reader.Location2Reader2ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); extId = Data.Reader.Location2Reader3ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); extId = Data.Reader.Location2Reader4ExternalId; Factory.DeleteWithKeys <Reader>(Context, EntityType.Reader, extId, s2Id); } Context.SubmitChanges(); }
public void PortalStage(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var sysId = Data.ExternalSystems.S2In.Id; var trackId = Data.ExternalSystems.TrackOut.Id; var entityType = Enum.GetName(typeof(EntityType), EntityType.Location); // Location 1 var locId = Context.ExternalApplicationKeys.FirstOrDefault(x => x.ExternalId == Data.Locations.Location1ExternalId && x.SystemId == trackId && x.EntityType == entityType).InternalId; var entity = Data.Portal.Location1Portal1; var item = createPortal(entity.Name, locId, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Portal, Data.Portal.Location1Portal1ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); // Location 2 locId = Context.ExternalApplicationKeys.FirstOrDefault(x => x.ExternalId == Data.Locations.Location2ExternalId && x.SystemId == trackId && x.EntityType == entityType).InternalId; entity = Data.Portal.Location2Portal1; item = createPortal(entity.Name, locId, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Portal, Data.Portal.Location2Portal1ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); entity = Data.Portal.Location2Portal2; item = createPortal(entity.Name, locId, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Portal, Data.Portal.Location2Portal2ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); } Context.SubmitChanges(); }
public void PersonClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var s2Id = Data.ExternalSystems.S2In.Id; if (model.CleanAllPeople) { var entityType = Enum.GetName(typeof(EntityType), EntityType.Person); Context.ExternalApplicationKeys.DeleteAllOnSubmit(Context.ExternalApplicationKeys.Where(x => x.EntityType == entityType && x.SystemId == s2Id)); Context.Persons.DeleteAllOnSubmit(Context.Persons); } else { var extId = Data.People.R1Person1ExternalId; Factory.DeleteWithKeys <Person>(Context, EntityType.Person, extId, s2Id); extId = Data.People.R1Person2ExternalId; Factory.DeleteWithKeys <Person>(Context, EntityType.Person, extId, s2Id); } } Context.SubmitChanges(); }
public void ExternalSystemsClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.Lubrizol) { Delete(Context, Data.ExternalSystems.LubrizolIn); } if (model.PeopleSoft) { Delete(Context, Data.ExternalSystems.PsIn); } if (model.Track) { Delete(Context, Data.ExternalSystems.TrackOut); } if (model.S2) { Delete(Context, Data.ExternalSystems.S2In); Delete(Context, Data.ExternalSystems.S2Out); } if (model.R1SM) { Delete(Context, Data.ExternalSystems.R1SM); } Context.SubmitChanges(); }
public void ExternalSystemsStage(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.R1SM) { var item = Data.ExternalSystems.R1SM; item.Settings = null; item.ExternalApplicationKeys = null; Context.ExternalSystems.InsertOnSubmit(item); } if (model.S2) { if (model.S2Incoming) { var item = Data.ExternalSystems.S2In; item.Settings = null; item.ExternalApplicationKeys = null; Context.ExternalSystems.InsertOnSubmit(item); } if (model.S2Outgoing) { var item = Data.ExternalSystems.S2Out; item.Settings = null; item.ExternalApplicationKeys = null; Context.ExternalSystems.InsertOnSubmit(item); } } if (model.Track) { if (model.TrackOutgoing) { var item = Data.ExternalSystems.TrackOut; item.Settings = null; item.ExternalApplicationKeys = null; Context.ExternalSystems.InsertOnSubmit(item); } } if (model.PeopleSoft) { if (model.PsIncoming) { var item = Data.ExternalSystems.PsIn; item.Settings = null; item.ExternalApplicationKeys = null; Context.ExternalSystems.InsertOnSubmit(item); } } Context.SubmitChanges(); }
public void ExternalApplicationKeysClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if ((model.S2Incoming || model.Track) && model.CleanAllExternalAppKeys) { Context.ExternalApplicationKeys.DeleteAllOnSubmit(Context.ExternalApplicationKeys); } Context.SubmitChanges(); }
public void AccessHistoryClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if ((model.S2Incoming || model.Track) && model.CleanAllAccessHistory) { Context.AccessHistories.DeleteAllOnSubmit(Context.AccessHistories); } Context.SubmitChanges(); }
public void Run(Models.StagingTools model) { Clean(model); ExternalSystemsStage(model); SettingsStage(model); PersonStage(model); LocationStage(model); PortalStage(model); ReaderStage(model); }
public void Clean(Models.StagingTools model) { AccessHistoryClean(model); ReaderClean(model); PortalClean(model); LocationClean(model); PersonClean(model); ExternalApplicationKeysClean(model); SettingsClean(model); ExternalSystemsClean(model); }
public void LocationClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var sysId = Data.ExternalSystems.TrackOut.Id; var extId = Data.Locations.Location1ExternalId; Factory.DeleteWithKeys <Location>(Context, EntityType.Location, extId, sysId); extId = Data.Locations.Location2ExternalId; Factory.DeleteWithKeys <Location>(Context, EntityType.Location, extId, sysId); } Context.SubmitChanges(); }
public void LocationStage(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var sysId = Data.ExternalSystems.TrackOut.Id; var item = createLocation("Company A", action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Location, Data.Locations.Location1ExternalId, sysId, item.LocationID, EntityAction.InsertAndSubmit); item = createLocation("Company B", action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Location, Data.Locations.Location2ExternalId, sysId, item.LocationID, EntityAction.InsertAndSubmit); } Context.SubmitChanges(); }
public void PersonStage(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var s2Id = Data.ExternalSystems.S2In.Id; var entity = Data.People.R1Person1; var item = createPerson(entity.FirstName, entity.LastName, string.Empty, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Person, Data.People.R1Person1ExternalId, s2Id, item.PersonID, EntityAction.InsertAndSubmit); entity = Data.People.R1Person2; item = createPerson(entity.FirstName, entity.LastName, entity.MiddleName, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Person, Data.People.R1Person2ExternalId, s2Id, item.PersonID, EntityAction.InsertAndSubmit); } Context.SubmitChanges(); }
public void PortalClean(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var s2Id = Data.ExternalSystems.S2In.Id; var extId = Data.Portal.Location1Portal1ExternalId; Factory.DeleteWithKeys <Portal>(Context, EntityType.Portal, extId, s2Id); extId = Data.Portal.Location2Portal1ExternalId; Factory.DeleteWithKeys <Portal>(Context, EntityType.Portal, extId, s2Id); extId = Data.Portal.Location2Portal2ExternalId; Factory.DeleteWithKeys <Portal>(Context, EntityType.Portal, extId, s2Id); } Context.SubmitChanges(); }
public void SettingsStage(Models.StagingTools model) { if (model.R1SM) { R1SMSettings(model.ValidationKey); } if (model.S2Incoming) { S2InSettings(model.ValidationKey); } if (model.TrackOutgoing) { TrackSettings(model.ValidationKey); } Context.SubmitChanges(); }
public void ReaderStage(Models.StagingTools model) { Context.Refresh(RefreshMode.KeepCurrentValues); if (model.S2Incoming || model.Track) { var sysId = Data.ExternalSystems.S2In.Id; var entityType = Enum.GetName(typeof(EntityType), EntityType.Portal); // Location 1 Portal 1 var portalId = Context.ExternalApplicationKeys.FirstOrDefault(x => x.ExternalId == Data.Portal.Location1Portal1ExternalId && x.SystemId == sysId && x.EntityType == entityType).InternalId; var entity = Data.Reader.Location1Reader1; var item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location1Reader1ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); entity = Data.Reader.Location1Reader2; item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location1Reader2ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); // Location 2 Portal 1 portalId = Context.ExternalApplicationKeys.FirstOrDefault(x => x.ExternalId == Data.Portal.Location2Portal1ExternalId && x.SystemId == sysId && x.EntityType == entityType).InternalId; entity = Data.Reader.Location2Reader1; item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location2Reader1ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); entity = Data.Reader.Location2Reader2; item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location2Reader2ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); // Location 2 Portal 2 portalId = Context.ExternalApplicationKeys.FirstOrDefault(x => x.ExternalId == Data.Portal.Location2Portal2ExternalId && x.SystemId == sysId && x.EntityType == entityType).InternalId; entity = Data.Reader.Location2Reader3; item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location2Reader3ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); entity = Data.Reader.Location2Reader4; item = createReader(entity.Name, portalId, entity.Direction, action: EntityAction.InsertAndSubmit); createExternalApplicationKey(EntityType.Reader, Data.Reader.Location2Reader4ExternalId, sysId, item.Id, EntityAction.InsertAndSubmit); } Context.SubmitChanges(); }
public void SettingsClean(Models.StagingTools model) { Delete(Context, Context.Settings.ToList()); Context.SubmitChanges(); }