public async Task DeleteTrajectory() { var job = new DeleteTrajectoryJob { TrajectoryReference = new TrajectoryReference { WellUid = "fa53698b-0a19-4f02-bca5-001f5c31c0ca", WellboreUid = "eea43bf8-e3b7-42b6-b328-21b34cb505eb", TrajectoryUid = "1YJFL7" } }; await worker.Execute(job); }
public async Task <WorkerResult> Execute(DeleteTrajectoryJob job) { var wellUid = job.TrajectoryReference.WellUid; var wellboreUid = job.TrajectoryReference.WellboreUid; var trajectoryUid = job.TrajectoryReference.TrajectoryUid; var query = TrajectoryQueries.QueryById(wellUid, wellboreUid, trajectoryUid); var result = await witsmlClient.DeleteFromStoreAsync(query); if (result.IsSuccessful) { Log.Information("{JobType} - Job successful.", GetType().Name); return(new WorkerResult(witsmlClient.GetServerHostname(), true, $"Deleted trajectory: ${trajectoryUid}")); } Log.Error("Failed to delete trajectory. WellUid: {WellUid}, WellboreUid: {WellboreUid}, Uid: {TrajectoryUid}", wellUid, wellboreUid, trajectoryUid); query = TrajectoryQueries.QueryById(wellUid, wellboreUid, trajectoryUid); var queryResult = await witsmlClient.GetFromStoreAsync(query, OptionsIn.IdOnly); var trajectory = queryResult.Trajectories.First(); EntityDescription description = null; if (trajectory != null) { description = new EntityDescription { WellName = trajectory.NameWell, WellboreName = trajectory.NameWellbore, ObjectName = trajectory.Name }; } return(new WorkerResult(witsmlClient.GetServerHostname(), false, "Failed to delete trajectory", result.Reason, description)); }