-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
723 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using Microsoft.Extensions.Primitives; | ||
using Microsoft.IdentityModel.Tokens; | ||
|
||
using WitsmlExplorer.Api.Jobs.Common; | ||
using WitsmlExplorer.Api.Models; | ||
|
||
namespace WitsmlExplorer.Api.Jobs | ||
{ | ||
public record DeleteEmptyMnemonicsJob : Job | ||
{ | ||
|
||
public IEnumerable<WellReference> Wells { get; init; } | ||
public IEnumerable<WellboreReference> Wellbores { get; init; } | ||
public double NullDepthValue { get; init; } | ||
public DateTime NullTimeValue { get; init; } | ||
|
||
public DeleteEmptyMnemonicsJob() | ||
{ | ||
Wells = new List<WellReference>(); | ||
Wellbores = new List<WellboreReference>(); | ||
} | ||
|
||
public override string Description() | ||
{ | ||
return "DeleteEmptyMnemonicsJob" | ||
+ $" - WellUids: {GetWellUid()};" | ||
+ $" WellboreUids: {string.Join(", ", Wellbores.Select(w => w.WellboreUid))}"; | ||
} | ||
|
||
public override string GetObjectName() | ||
{ | ||
return null; | ||
} | ||
|
||
public override string GetWellboreName() | ||
{ | ||
return Wellbores.IsNullOrEmpty() ? null : string.Join(", ", Wellbores.Select(w => w.WellboreName)); | ||
} | ||
|
||
public override string GetWellName() | ||
{ | ||
var wellNames = new List<string>(); | ||
|
||
if (!Wellbores.IsNullOrEmpty()) | ||
{ | ||
wellNames.AddRange(Wellbores.Select(w => w.WellName).Distinct()); | ||
} | ||
|
||
if (!Wells.IsNullOrEmpty()) | ||
{ | ||
wellNames.AddRange(Wells.Select(w => w.WellName).Distinct()); | ||
} | ||
|
||
return string.Join(", ", wellNames.Distinct()); | ||
} | ||
|
||
private string GetWellUid() | ||
{ | ||
var wellUids = new List<string>(); | ||
|
||
if (!Wellbores.IsNullOrEmpty()) | ||
{ | ||
wellUids.AddRange(Wellbores.Select(w => w.WellUid).Distinct()); | ||
} | ||
|
||
if (!Wells.IsNullOrEmpty()) | ||
{ | ||
wellUids.AddRange(Wells.Select(w => w.WellUid).Distinct()); | ||
} | ||
|
||
return string.Join(", ", wellUids.Distinct()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Src/WitsmlExplorer.Api/Models/Reports/DeleteEmptyMnemonicsReport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using WitsmlExplorer.Api.Jobs.Common; | ||
|
||
namespace WitsmlExplorer.Api.Models.Reports | ||
{ | ||
public class DeleteEmptyMnemonicsReport : BaseReport | ||
{ | ||
} | ||
|
||
public class DeleteEmptyMnemonicsReportItem | ||
{ | ||
public string WellName { get; init; } | ||
public string WellUid { get; init; } | ||
public string WellboreName { get; init; } | ||
public string WellboreUid { get; init; } | ||
public string LogName { get; init; } | ||
public string LogUid { get; init; } | ||
public string LogIndexType { get; init; } | ||
public string Mnemonic { get; init; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
using Witsml; | ||
|
||
using WitsmlExplorer.Api.Models; | ||
using WitsmlExplorer.Api.Query; | ||
|
||
namespace WitsmlExplorer.Api.Services | ||
{ | ||
public interface IMnemonicService | ||
{ | ||
Task<QueryResult> DeleteMnemonic(string wellUid, string wellboreUid, string logToCheckUid, LogCurveInfo mnemonicToDelete); | ||
} | ||
|
||
public class MnemonicService : WitsmlService, IMnemonicService | ||
{ | ||
public MnemonicService(IWitsmlClientProvider witsmlClientProvider) : base(witsmlClientProvider) | ||
{ | ||
} | ||
|
||
public async Task<QueryResult> DeleteMnemonic(string wellUid, string wellboreUid, string logToCheckUid, LogCurveInfo mnemonicToDelete) | ||
{ | ||
var query = LogQueries.DeleteMnemonics(wellUid, wellboreUid, logToCheckUid, new[] { mnemonicToDelete.Mnemonic }); | ||
|
||
return await _witsmlClient.DeleteFromStoreAsync(query); | ||
} | ||
} | ||
} |
Oops, something went wrong.