Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DbUtil/SqlScripts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public SqlScripts()
new Script("Restructure Locations",RestructureLocations),
new Script("Add 3 columns to Phones", Add3ColumnsToPhones),
new Script("Create SIMs Table", CreateSIMsTable),
new Script("Add eSIM to SIMs Table", "ALTER TABLE Sims ADD COLUMN eSIM INTEGER;")
];
}

Expand Down
1 change: 1 addition & 0 deletions PhoneAssistant.Model/Entities/Sim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class Sim
public required ulong BroadbandData { get; set; }
public required uint TextMessages { get; set; }
public required uint VoiceCalls { get; set; }
public bool? Esim { get; set; }
}
8 changes: 6 additions & 2 deletions PhoneAssistant.Model/PhoneAssistantDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.HasIndex(e => e.ScriptName, "IX_SchemaVersion_ScriptName").IsUnique();
});

modelBuilder.Entity<Sim>()
.HasKey(s => new { s.PhoneNumber, s.BillingPeriod});
modelBuilder.Entity<Sim>( s =>
{
s.HasKey(s => new { s.PhoneNumber, s.BillingPeriod});

s.Property(s => s.Esim).HasColumnName("eSIM");
});

OnModelCreatingPartial(modelBuilder);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
Header="Phone Number" />
<DataGridTextColumn Binding="{Binding BillingPeriod}" Header="Billing Period" />
<DataGridTextColumn Binding="{Binding SIMNumber}" Header="SIM Number" />
<DataGridCheckBoxColumn Binding="{Binding Esim, UpdateSourceTrigger=PropertyChanged, TargetNullValue=False}"
Header="eSIM"
IsThreeState="False" />
<DataGridTextColumn Binding="{Binding UserName}" Header="User Name" />
<DataGridTemplateColumn Header="Broadband Data">
<DataGridTemplateColumn.CellTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public partial class BaseReportMainViewModel(ISimRepository repository) : ViewMo

public ObservableCollection<BaseReportSim> BaseReportSims { get; } = [];

[ObservableProperty]
public partial bool? Esim { get; set; }

[ObservableProperty]
public partial string LatestImport { get; set; } = string.Empty;

Expand Down Expand Up @@ -65,6 +68,7 @@ public BaseReportSim(Sim sim, ulong maxBroadbandData)
BroadbandData = sim.BroadbandData;
TextMessages = sim.TextMessages;
VoiceCalls = sim.VoiceCalls;
Esim = sim.Esim;

BroadbandDataText = FormatBytes(sim.BroadbandData);
if (BroadbandData == 0)
Expand Down
19 changes: 11 additions & 8 deletions PhoneAssistant.WPF/Features/Users/UsersMainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ await Task.Run(() =>

ProgressVisibility = Visibility.Collapsed;
}
private SearchResultCollection PersonSearch(string name)
private static SearchResultCollection PersonSearch(string name)
{
using DirectoryEntry entry = new DirectoryEntry("LDAP://DC=ds2,DC=devon,DC=gov,DC=uk");
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = $"(&(objectClass=user)(objectCategory=person)(CN=*{name}*))";
using DirectoryEntry entry = new("LDAP://ds2.devon.gov.uk");
entry.AuthenticationType = AuthenticationTypes.Secure;
DirectorySearcher searcher = new(entry)
{
Filter = $"(&(objectClass=user)(objectCategory=person)(CN=*{name}*))"
};
searcher.PropertiesToLoad.Add("displayName");
searcher.PropertiesToLoad.Add("description");
searcher.PropertiesToLoad.Add("lastLogon");
Expand All @@ -90,19 +93,19 @@ private SearchResultCollection PersonSearch(string name)
}

[ObservableProperty]
private Visibility _progressVisibility = Visibility.Collapsed;
public partial Visibility ProgressVisibility { get; set; } = Visibility.Collapsed;

[ObservableProperty]
private bool _noResultsFound;
public partial bool NoResultsFound { get; set; }

private string ParsePropertyString(ResultPropertyValueCollection resultPropertyValueCollection)
private static string ParsePropertyString(ResultPropertyValueCollection resultPropertyValueCollection)
{
if (resultPropertyValueCollection is null) return string.Empty;
if (resultPropertyValueCollection.Count == 0) return string.Empty;
return resultPropertyValueCollection[0].ToString() ?? string.Empty;
}

private string ParsePropertyDateTime(ResultPropertyValueCollection resultPropertyValueCollection)
private static string ParsePropertyDateTime(ResultPropertyValueCollection resultPropertyValueCollection)
{
if (resultPropertyValueCollection is null) return string.Empty;
if (resultPropertyValueCollection.Count == 0) return string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion PhoneAssistant.WPF/PhoneAssistant.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<StartupObject>PhoneAssistant.WPF.App</StartupObject>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<Version>1.606.23</Version>
<Version>1.606.24</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

Expand Down
Loading