FwUpdateBuilder: - prepared access to outstanding FW update safes, - prepared to access report files

This commit is contained in:
Thomas Wiedebusch 2021-10-28 17:58:29 +02:00
parent e7521eb309
commit 05ecaf61af
7 changed files with 358 additions and 83 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;

View File

@ -58,6 +58,16 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder.Const
/// </summary>
GetCordonelProductionOrdersFromDb,
/// <summary>
/// Load all Cordonel FW update safes from DB
/// </summary>
GetFwUpdateSafesFromDb,
/// <summary>
/// Load all Cordonel FW update report files from DB
/// </summary>
GetReportFilesFromDb,
/// <summary>
/// Load all Cordonel serial numbers off a specific order from DB
/// </summary>

View File

@ -176,6 +176,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
private Boolean _customersPropertyChanged;
private Boolean _cordonelsPropertyChanged;
private Boolean _fwPackagePropertyChanged;
private Boolean _fwReportFilesPropertyChanged;
private Boolean _fwUpdateSafesPropertyChanged;
private Boolean _preBuildSummaryPropertyChanged;
/// <summary>
@ -238,6 +240,9 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Jun-08" author="Roland Drabesch">
/// - Sleep on equal process state to force suspend of actual thread.
/// </remarks>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Added report files and FW-Update safes load from DB.
/// </remarks>
private void FwUpdateBuilderStateMachine()
{
while (!_processToken.IsCancellationRequested)
@ -280,6 +285,14 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
LoadDbCordonelCustomersTask();
break;
case ProcessState.GetReportFilesFromDb:
LoadDbReportFilesTask();
break;
case ProcessState.GetFwUpdateSafesFromDb:
LoadDbOutstandingFwUpdateSafesTask();
break;
case ProcessState.GetFwUpdateOperatorsFromDb:
LoadDbFwUpdateOperatorsTask();
break;
@ -360,6 +373,9 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Mar-24" author="Thomas Wiedebusch">
/// - Checks exported
/// </remarks>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Added checks for FW-update safes and report files.
/// </remarks>
private void TmrProgressUpdate_Tick(Object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
@ -379,6 +395,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
CheckCustomerChange();
CheckCordonelChange();
CheckFwPackageChange();
CheckFwUpdateSafesChange();
CheckReportFilesChange();
break;
case ProcessState.BuildFwUpdateSafe:
SetStatusProgressBar(ProgressBarStatus.Value + 1 > 100 ? 0 : ProgressBarStatus.Value + 1);
@ -389,6 +407,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
case ProcessState.GetCustomersFromDb:
case ProcessState.GetFwPackagesFromDb:
case ProcessState.GetCordonelSerialNumbersFromDb:
case ProcessState.GetFwUpdateSafesFromDb:
case ProcessState.GetReportFilesFromDb:
case ProcessState.UploadFwUpdateSafeToDb:
CheckDbConnectionTimeout();
SetStatusProgressBar(ProgressBarStatus.Value + 1 > 100 ? 0 : ProgressBarStatus.Value + 1);
@ -660,6 +680,26 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// </remarks>
private void tabControlSelection_Selected(Object sender, TabControlEventArgs e)
{
if (e.TabPage == tabPageFwUpdateSafes)
{
DisableAllControlsInvoked();
UiInvoker.ToolStripLabelInvoker(lblStatusDbConnect, ColorSuccess, Resources.StrReadingFwUpdateSafes);
SetStatusProgressBar();
_dbAccessDelayCtrMs = 0;
_processState = ProcessState.GetFwUpdateSafesFromDb;
}
if (e.TabPage == tabPageReports)
{
DisableAllControlsInvoked();
UiInvoker.ToolStripLabelInvoker(lblStatusDbConnect, ColorSuccess, Resources.StrReadingReportFiles);
SetStatusProgressBar();
_dbAccessDelayCtrMs = 0;
_processState = ProcessState.GetReportFilesFromDb;
}
if (e.TabPage == tabPageCordonelSelection)
{
// avoid reading of DB contents and reset of selection if customer remains identical
@ -1085,6 +1125,9 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-27" author="Thomas Wiedebusch">
/// - Added FwUpdateSafeDb preparation
/// </remarks>
/// <remarks date="2021-Oct-27" author="Thomas Wiedebusch">
/// - Added BuildFwUpdateSwContainerFromDb, not longer taken from locally file system!
/// </remarks>
public Boolean BuildFwUpdateSafe()
{
if (string.IsNullOrEmpty(lblUpdateOperator.Text)) return false;
@ -1769,6 +1812,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
// update output information
FillDataGridWithUpdateOperatorInfos();
}
/// <summary>
/// Check for change of customer.
/// </summary>
@ -1787,6 +1831,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
// update output information
FillDataGridWithCustomerInfos();
}
/// <summary>
/// Check for change of Cordonels.
/// </summary>
@ -1833,6 +1878,36 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
// update output information
FillDataGridWithFwPackageInfos();
}
/// <summary>
/// Check for change of report files.
/// </summary>
/// <remarks date="2021-Mar-31" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void CheckReportFilesChange()
{
if (!_fwReportFilesPropertyChanged) return;
_fwReportFilesPropertyChanged = false;
// update output information
FillDataGridWithReportFilesInfos();
}
/// <summary>
/// Check for change of Fw update safes.
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void CheckFwUpdateSafesChange()
{
if (!_fwUpdateSafesPropertyChanged) return;
_fwUpdateSafesPropertyChanged = false;
// update output information
FillDataGridWithFwUpdateSafesInfos();
}
#endregion --------------------------------------- Checks -----------------------------------------------------
#region ------------------------------------------ Tools ------------------------------------------------------
@ -1990,6 +2065,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
break;
}
}
/// <summary>
/// Common message window.
/// </summary>
@ -2381,6 +2457,66 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
});
}
/// <summary>
/// Acquire all report files from DB.
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void LoadDbReportFilesTask()
{
_invokerProcessState = _processState;
Task.Factory.StartNew(() =>
{
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
Thread.CurrentThread.CurrentCulture = _cultureInfo;
try
{
// check DB connection in advance to overcome the timing issues for DB service startup
_fwUpdateDbAccess.CheckDbConnection();
GetReportFilesFromDb();
}
catch (Exception)
{
_processState = ProcessState.Error;
}
}).ContinueWith(delegate
{
_fwReportFilesPropertyChanged = true;
_processState = ProcessState.Idle;
});
}
/// <summary>
/// Acquire all FW-Update safes from DB.
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void LoadDbOutstandingFwUpdateSafesTask()
{
_invokerProcessState = _processState;
Task.Factory.StartNew(() =>
{
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
Thread.CurrentThread.CurrentCulture = _cultureInfo;
try
{
// check DB connection in advance to overcome the timing issues for DB service startup
_fwUpdateDbAccess.CheckDbConnection();
GetOutstandingFwUpdateSafesFromDb();
}
catch (Exception)
{
_processState = ProcessState.Error;
}
}).ContinueWith(delegate
{
_fwUpdateSafesPropertyChanged = true;
_processState = ProcessState.Idle;
});
}
/// <summary>
/// Acquire all Customers specified by search mask from DB.
/// </summary>
@ -2675,9 +2811,33 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
grpLanguageSelection.Enabled = true;
}
}
#endregion --------------------------------------- Data Grid FW Packages ---------------------------------------
#region ------------------------------------------ Data Grid Update Safes --------------------------------------
/// <summary>
/// Build data grid for FW-Update update safes
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private void FillDataGridWithFwUpdateSafesInfos()
{
}
#endregion --------------------------------------- Data Grid Update Safes --------------------------------------
#region ------------------------------------------ Data Grid Report Files --------------------------------------
/// <summary>
/// Build data grid for FW-Update report files
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private void FillDataGridWithReportFilesInfos()
{
}
#endregion --------------------------------------- Data Grid Report Files --------------------------------------
#region ------------------------------------------ Data Grid Pre Build Summary --------------------------------
/// <summary>
/// Overwrite cell click, because edit of cells is denied (read only == true). This is needed for
@ -3740,10 +3900,10 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
/// - Getting orders directly from DB.
/// </remarks>
private Boolean GetAllCordonelOrdersOfCustomerFromDb()
private void GetAllCordonelOrdersOfCustomerFromDb()
{
// get the customer ID
if (_fwUpdateDbAccess == null || string.IsNullOrEmpty(lblCustomerNumber.Text)) return false;
if (_fwUpdateDbAccess == null || string.IsNullOrEmpty(lblCustomerNumber.Text)) return;
if (Int64.TryParse(lblCustomerNumber.Text, out var customerId))
{
@ -3751,14 +3911,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
}
_processState = ProcessState.Idle;
return _fwUpdateDbAccess?.DbCordonelCustomerOrders != null &&
_fwUpdateDbAccess.DbCordonelCustomerOrders.Count > 0;
}
/// <summary>
/// Get the Cordonel serial numbers from DB.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Apr-04" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
@ -3774,10 +3931,10 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-17" author="Thomas Wiedebusch">
/// - Clear search info on new search.
/// </remarks>
private Boolean GetAllCordonelSerialNumbersOfOrderFromDb()
private void GetAllCordonelSerialNumbersOfOrderFromDb()
{
// get the customer ID
if (_fwUpdateDbAccess == null || string.IsNullOrEmpty(lblCustomerNumber.Text)) return false;
if (_fwUpdateDbAccess == null || string.IsNullOrEmpty(lblCustomerNumber.Text)) return;
// remove last search infos
_cordonelProductionSearchInfos.Clear();
@ -3847,34 +4004,28 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
}// orders from customer could be acquired
_processState = ProcessState.Idle;
return _cordonelProductionSearchInfos.Count > 0;
}
/// <summary>
/// Get the Cordonel customers from DB.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Mar-31" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
/// <remarks date="2021-Ape-07" author="Thomas Wiedebusch">
/// - Search pattern added.
/// </remarks>
private Boolean GetAllCordonelCustomersFromDb()
private void GetAllCordonelCustomersFromDb()
{
var searchPattern = tbxCustomerSearchMask.Text.Replace(" ", "");
var returnValue = _fwUpdateDbAccess != null &&
_fwUpdateDbAccess.GetAllCordonelCustomersFromDb(searchPattern) &&
_fwUpdateDbAccess.DbSearchedCordonelCustomers.Count > 0;
_fwUpdateDbAccess?.GetAllCordonelCustomersFromDb(searchPattern);
_processState = ProcessState.Idle;
return returnValue;
}
/// <summary>
/// Get Cordonel FW packages from DB end extract all needed information to select a package to the
/// CordonelFwPackageInfo search list.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Apr-13" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
@ -3884,11 +4035,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Oct-15" author="Thomas Wiedebusch">
/// - Configuration files loading from DB: - MeterFwUpdateRuler, configuration.json and MeterEraseRestore.
/// </remarks>
private Boolean GetCordonelFwPackagesFromDb()
private void GetCordonelFwPackagesFromDb()
{
if (_fwUpdateDbAccess == null || !_fwUpdateDbAccess.GetAllCordonelFwInfoFilesFromDb() ||
_fwUpdateDbAccess.DbCordonelFwPackages.Count == 0 || _cordonelFwPackageInfoSearch == null)
return false;
return;
_cordonelFwPackageInfoSearch.Clear();
// The configuration files contain the latest MeterFwUpdateRuler.json (needed for the FwUpdateBuilder),
@ -3908,65 +4059,65 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
fwPackageFilesInfo != null && fwPackageFilesInfo.Count > 0)
{
// parse file information
var fwPackInfo = new CordonelFwPackageInfo
if (dbCordonelFwFile.CordonelFwFile_Dn != null)
{
ReleaseNameVersion = dbCordonelFwFile.FileName,
Region = dbCordonelFwFile.FileName.Contains("EMEA") ? "EMEA" : "NA",
RadioFrequencyMhz = dbCordonelFwFile.FileName.Contains("433") ? "433" :
dbCordonelFwFile.FileName.Contains("868") ? "868" : "-",
FileIsLatest = dbCordonelFwFile.FileIsLatest,
MeterSize = MeterSizeConverter.ConvertOrderSizeNumberToSizeName(
MeterSizeConverter.ConvertToOrder((MeterSize)dbCordonelFwFile.CordonelFwFile_Dn)),
ReleaseDate = dbCordonelFwFile.FileDate,
ReleaseVersion = $"{nameSplit[nameSplit.Length - 1].Substring(0, 3)}." +
$"{nameSplit[nameSplit.Length - 1].Substring(3, 2)}"
};
// the release version is always the last element of the name split
foreach (var binfile in fwPackageFilesInfo)
{
// extract metrology version
if (binfile.FileName.Contains("binfile0F_"))
var fwPackInfo = new CordonelFwPackageInfo
{
var msb = binfile.FileName.Substring(10, 2);
// remove leading 0
var msbMsb = msb.Substring(0, 1);
if (msbMsb == "0") msb = msb.Remove(0, 1);
var lsb = binfile.FileName.Substring(12, 2);
fwPackInfo.MetrologyVersion = $"{msb}.{lsb}";
break;
}
}
// take the meter fw update ruler to extract core min /max and released
foreach (var rule in _meterFwUpdateRuler)
{
var releaseVersion = $"{rule.Release.Substring(0, 3)}." +
$"{rule.Release.Substring(3, 2)}";
if (releaseVersion == fwPackInfo.ReleaseVersion)
ReleaseNameVersion = dbCordonelFwFile.FileName,
Region = dbCordonelFwFile.FileName.Contains("EMEA") ? "EMEA" : "NA",
RadioFrequencyMhz = dbCordonelFwFile.FileName.Contains("433") ? "433" :
dbCordonelFwFile.FileName.Contains("868") ? "868" : "-",
FileIsLatest = dbCordonelFwFile.FileIsLatest,
MeterSize = MeterSizeConverter.ConvertOrderSizeNumberToSizeName(
MeterSizeConverter.ConvertToOrder((MeterSize)dbCordonelFwFile.CordonelFwFile_Dn)),
ReleaseDate = dbCordonelFwFile.FileDate,
ReleaseVersion = $"{nameSplit[nameSplit.Length - 1].Substring(0, 3)}." +
$"{nameSplit[nameSplit.Length - 1].Substring(3, 2)}"
};
// the release version is always the last element of the name split
foreach (var binfile in fwPackageFilesInfo)
{
int.TryParse(rule.CoreVersionMin, out var x);
fwPackInfo.CoreVersionMin = x;
x = 0;
int.TryParse(rule.CoreVersionMax, out x);
fwPackInfo.CoreVersionMax = x;
fwPackInfo.FwIsReleased = !string.IsNullOrEmpty(rule.ApproverName);
// extract metrology version
if (binfile.FileName.Contains("binfile0F_"))
{
var msb = binfile.FileName.Substring(10, 2);
// remove leading 0
var msbMsb = msb.Substring(0, 1);
if (msbMsb == "0") msb = msb.Remove(0, 1);
var lsb = binfile.FileName.Substring(12, 2);
fwPackInfo.MetrologyVersion = $"{msb}.{lsb}";
break;
}
}
// take the meter fw update ruler to extract core min /max and released
foreach (var rule in _meterFwUpdateRuler)
{
var releaseVersion = $"{rule.Release.Substring(0, 3)}." +
$"{rule.Release.Substring(3, 2)}";
if (releaseVersion == fwPackInfo.ReleaseVersion)
{
int.TryParse(rule.CoreVersionMin, out var x);
fwPackInfo.CoreVersionMin = x;
int.TryParse(rule.CoreVersionMax, out x);
fwPackInfo.CoreVersionMax = x;
fwPackInfo.FwIsReleased = !string.IsNullOrEmpty(rule.ApproverName);
}
}
}
_cordonelFwPackageInfoSearch.Add(fwPackInfo);
_cordonelFwPackageInfoSearch.Add(fwPackInfo);
}
}
}
return _cordonelFwPackageInfoSearch.Count > 0;
}
/// <summary>
/// Get the license information from DB. In DEBUG mode the license of the software will be skipped,
/// but user license is of importance.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Apr-14" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private Boolean GetLicenseFromDb()
private void GetLicenseFromDb()
{
// FW-Update Builder validation with DB access
var access = false;
@ -3990,7 +4141,6 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
_licenseUnchecked = false;
CheckUserRegistration();
return true;
}
/// <summary>
@ -4006,10 +4156,38 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
return _fwUpdateDbAccess != null && _fwUpdateDbAccess.UploadFwUpdateSafeToDb(_fwUpdateSafeDb, pcbIds);
}
/// <summary>
/// Get all FW update report files from DB.
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private void GetReportFilesFromDb()
{
var fwUpdateReports = new List<FwUpdateReportDb>();
_fwUpdateDbAccess?.DownloadFwUpdateReportsFromDb(out fwUpdateReports);
}
/// <summary>
/// Get all active FW update safes from DB. Outdated safes cannot be accessed.
/// </summary>
/// <remarks date="2021-Oct-28" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private void GetOutstandingFwUpdateSafesFromDb()
{
var fwUpdateSafes= new List<FwUpdateSafeDb>();
if (_fwUpdateDbAccess != null)
{
foreach (var user in _fwUpdateDbAccess.DbFullQualifiedUpdateOperators)
{
_fwUpdateDbAccess.ListAllFwUpdateSafesOfUserFromDb(user.Id, out var fwUpdateSafesOfUser);
fwUpdateSafes.AddRange(fwUpdateSafesOfUser);
}
}
}
/// <summary>
/// Get the full qualified user information from DB to generate the primary key for encryption.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Feb-04" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
@ -4022,10 +4200,9 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Mar-22" author="Thomas Wiedebusch">
/// - Removed DB status.
/// </remarks>
private Boolean GetAllUpdateOperatorsFromDb()
private void GetAllUpdateOperatorsFromDb()
{
return _fwUpdateDbAccess != null && _fwUpdateDbAccess.GetAllUpdateOperatorsFromDb() &&
_fwUpdateDbAccess.DbFullQualifiedUpdateOperators.Count > 0;
_fwUpdateDbAccess?.GetAllUpdateOperatorsFromDb();
}
/// <summary>
@ -4034,7 +4211,6 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// HW Id, the domain, the LogInName and the users password hash.
/// The user registration has to be done in advance in the FW-Update Loader!
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Feb-04" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
@ -4044,18 +4220,16 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-08" author="Thomas Wiedebusch">
/// - Replaced userInfo by name of update operator.
/// </remarks>
private Boolean BuildPrimaryKey(String updateOperator)
private void BuildPrimaryKey(String updateOperator)
{
if (_fwUpdateDbAccess == null ||
!_fwUpdateDbAccess.GetFullQualifiedUserByFullName(updateOperator, out var userInfo))
{
return false;
return;
}
_primaryKey = FwUpdateCrypt.BuildPrimaryKey(userInfo.HardwareId, userInfo.Domain,
userInfo.LogInName, userInfo.PasswordHash);
return true;
}
/// <summary>
@ -4110,16 +4284,15 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// the latest configuration.json and the latest MeterEraseRestore.json (needed for the FwUpdateSw).
/// Copies the MeterFwUpdateRuler.json to the [exe-root] or [exe-root]/Library of the FwUpdateBuilder.
/// </summary>
/// <returns>true if successful</returns>
/// <remarks date="2021-Oct-27" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
private Boolean GetFwUpdateConfigFilesFromDb()
private void GetFwUpdateConfigFilesFromDb()
{
if (_fwUpdateDbAccess == null ||
!_fwUpdateDbAccess.DownloadFwUpdateConfigurationFilesFromDb() ||
_fwUpdateDbAccess.DbFwUpdateConfigFiles.Count == 0)
return false;
return;
try
{
@ -4147,9 +4320,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
catch (Exception)
{
return false;
// nothing to do
}
return true;
}
/// <summary>
@ -4377,13 +4549,13 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-01" author="Thomas Wiedebusch">
/// - Modified for flexible licenses.
/// </remarks>
private Boolean SetFwUpdateSwLicenseToDb(SoftwareLicense license)
private void SetFwUpdateSwLicenseToDb(SoftwareLicense license)
{
if (_fwUpdateDbAccess != null && _fwUpdateDbAccess.SetSwLicenseToDb(license))
{
LogSuccessText($"{Resources.StrSwLicenseSetSuccessfully} {license.Program} " +
$"{license.Major}.{license.Minor}.{license.Build}");
return true;
return;
}
if (_fwUpdateDbAccess != null && !_fwUpdateDbAccess.DbIsConnected)
@ -4401,7 +4573,6 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
MessageBoxShow(Resources.StrSwLicenseSetFailed, Resources.StrError, MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
return false;
}
/// <summary>
@ -4421,14 +4592,14 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
/// <remarks date="2021-Apr-15" author="Thomas Wiedebusch">
/// - Messages removed.
/// </remarks>
private Boolean GetFwUpdateSwLicenseFromDb(String programName, out SoftwareLicense license)
private void GetFwUpdateSwLicenseFromDb(String programName, out SoftwareLicense license)
{
if (_fwUpdateDbAccess != null &&
_fwUpdateDbAccess.GetSwLicenseFromDb(programName, out license)) return true;
_fwUpdateDbAccess.GetSwLicenseFromDb(programName, out license))
return;
license = null;
return false;
}
/// <summary>
@ -4623,6 +4794,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
_customersPropertyChanged = true;
_cordonelsPropertyChanged = true;
_fwPackagePropertyChanged = true;
_fwReportFilesPropertyChanged = true;
_fwUpdateSafesPropertyChanged = true;
_preBuildSummaryPropertyChanged = true;
lblFwUpdateDutyDate.Text = _datePicker.Value.ToShortDateString();

View File

@ -341,6 +341,15 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Acquiring FW Update Safes.....
/// </summary>
internal static string StrReadingFwUpdateSafes {
get {
return ResourceManager.GetString("StrReadingFwUpdateSafes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Acquiring Production Orders.....
/// </summary>
@ -350,6 +359,15 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Acquiring Report Files.....
/// </summary>
internal static string StrReadingReportFiles {
get {
return ResourceManager.GetString("StrReadingReportFiles", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Acquiring update operators.....
/// </summary>

View File

@ -153,6 +153,12 @@
<data name="StrReadingFwPackages" xml:space="preserve">
<value>Ermittelle FW-Pakete....</value>
</data>
<data name="StrReadingFwUpdateSafes" xml:space="preserve">
<value>Ermittelle FW Update Safes....</value>
</data>
<data name="StrReadingReportFiles" xml:space="preserve">
<value>Ermittelle Berichte....</value>
</data>
<data name="StrReadingCustomers" xml:space="preserve">
<value>Ermittelle Kunden....</value>
</data>

View File

@ -159,6 +159,12 @@
<data name="StrReadingFwPackages" xml:space="preserve">
<value>Acquiring FW packages....</value>
</data>
<data name="StrReadingFwUpdateSafes" xml:space="preserve">
<value>Acquiring FW Update Safes....</value>
</data>
<data name="StrReadingReportFiles" xml:space="preserve">
<value>Acquiring Report Files....</value>
</data>
<data name="StrReadingCordonels" xml:space="preserve">
<value>Acquiring Cordonels....</value>
</data>