DB.SensusOracle : Automatic WMTypeId assignment in progress.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -24,42 +24,45 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
public DBUsed DBUsed; /// 0
|
||||
public WMKind WMKind; /// 1
|
||||
public int WMTypeId; /// 2
|
||||
public int YearOfManufacture; /// 3
|
||||
public bool SaveResults; /// 4
|
||||
public bool ReadStartInfo; /// 5
|
||||
public bool StartInfoIsRequired; /// 6
|
||||
public DesigMode DesigMode; /// 7
|
||||
public Results.Output.LogType DesigType; /// 8
|
||||
public int WMTypeId; /// 2 (0 = none, -1 = automatic)
|
||||
public bool CreateWztypEntryIfMissing; /// 3
|
||||
public int YearOfManufacture; /// 4
|
||||
public bool SaveResults; /// 5
|
||||
public bool ReadStartInfo; /// 6
|
||||
public bool StartInfoIsRequired; /// 7
|
||||
public DesigMode DesigMode; /// 8
|
||||
public Results.Output.LogType DesigType; /// 9
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
DBUsed = DBUsed.Production; /// 0
|
||||
WMKind = WMKind.iPERL; /// 1
|
||||
WMTypeId = 2; /// 2
|
||||
YearOfManufacture = DateTime.Now.Year; /// 3
|
||||
CreateWztypEntryIfMissing = false; /// 3
|
||||
YearOfManufacture = DateTime.Now.Year; /// 4
|
||||
#if TURA_SPECIAL
|
||||
SaveResults = false; /// 4
|
||||
SaveResults = false; /// 5
|
||||
#else
|
||||
SaveResults = true; /// 4
|
||||
SaveResults = true; /// 5
|
||||
#endif
|
||||
ReadStartInfo = true; /// 5
|
||||
StartInfoIsRequired = false; /// 6
|
||||
DesigMode = DesigMode.Auto; /// 7
|
||||
DesigType = Results.Output.LogType.Just_Q3Q2Q1; /// 8
|
||||
ReadStartInfo = true; /// 6
|
||||
StartInfoIsRequired = false; /// 7
|
||||
DesigMode = DesigMode.Auto; /// 8
|
||||
DesigType = Results.Output.LogType.Just_Q3Q2Q1; /// 9
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Database", /// 0
|
||||
"Kind of WMs", /// 1
|
||||
"WM type ID", /// 2
|
||||
"Year of manufacture", /// 3
|
||||
"Save results", /// 4
|
||||
"Read start info", /// 5
|
||||
"Start info is required", /// 6
|
||||
"Designation Mode", /// 7
|
||||
"Designation when mode is 'As_specified'", /// 8
|
||||
"WM type ID (>= 0 or 'auto')", /// 2
|
||||
"Create VT_WZTYP_SD entry if missing", /// 3
|
||||
"Year of manufacture", /// 4
|
||||
"Save results", /// 5
|
||||
"Read start info", /// 6
|
||||
"Start info is required", /// 7
|
||||
"Designation Mode", /// 8
|
||||
"Designation when mode is 'As_specified'", /// 9
|
||||
};
|
||||
public override string ParamName(int i) { return paramNames[i]; }
|
||||
public override int ParamsCount() { return paramNames.Length; }
|
||||
@@ -83,17 +86,20 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
return null;
|
||||
|
||||
case 3:
|
||||
int year = DateTime.Now.Year;
|
||||
return new string[] { year.ToString(), (year + 1).ToString() };
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
return new string[] { Strings.yes, Strings.no };
|
||||
case 7:
|
||||
return new string[] { Strings.yes, Strings.no };
|
||||
|
||||
case 4:
|
||||
int year = DateTime.Now.Year;
|
||||
return new string[] { year.ToString(), (year + 1).ToString() };
|
||||
|
||||
case 8:
|
||||
for (DesigMode md = 0; md < DesigMode.Count; md++) retVal.Add(md.ToString());
|
||||
return retVal;
|
||||
|
||||
case 8:
|
||||
case 9:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++) retVal.Add(wm.ToString());
|
||||
return retVal;
|
||||
}
|
||||
@@ -105,26 +111,27 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
{
|
||||
case 0: return DBUsed.ToString();
|
||||
case 1: return WMKind.ToString();
|
||||
case 2: return WMTypeId.ToString();
|
||||
case 3: return YearOfManufacture.ToString();
|
||||
case 4: return SaveResults ? Strings.yes : Strings.no;
|
||||
case 5: return ReadStartInfo ? Strings.yes : Strings.no;
|
||||
case 6: return StartInfoIsRequired ? Strings.yes : Strings.no;
|
||||
case 7: return DesigMode.ToString();
|
||||
case 8: return DesigType.ToString();
|
||||
case 2: return (WMTypeId == -1) ? "auto" : WMTypeId.ToString();
|
||||
case 3: return CreateWztypEntryIfMissing ? Strings.yes : Strings.no;
|
||||
case 4: return YearOfManufacture.ToString();
|
||||
case 5: return SaveResults ? Strings.yes : Strings.no;
|
||||
case 6: return ReadStartInfo ? Strings.yes : Strings.no;
|
||||
case 7: return StartInfoIsRequired ? Strings.yes : Strings.no;
|
||||
case 8: return DesigMode.ToString();
|
||||
case 9: return DesigType.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieves parameters from UI controls
|
||||
public CfgUpdateFlags UpdateParam(int i, string strValue)
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
for (DBUsed db = 0; db < DBUsed.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue)
|
||||
if (db.ToString() == str)
|
||||
{
|
||||
DBUsed = db;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -135,7 +142,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
case 1:
|
||||
for (WMKind wm = 0; wm < WMKind.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue)
|
||||
if (wm.ToString() == str)
|
||||
{
|
||||
WMKind = wm;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -143,16 +150,17 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: WMTypeId = int.Parse(strValue); return CfgUpdateFlags.None;
|
||||
case 3: YearOfManufacture = int.Parse(strValue); return CfgUpdateFlags.None;
|
||||
case 4: SaveResults = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
case 5: ReadStartInfo = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
case 6: StartInfoIsRequired = (strValue == Strings.yes); return CfgUpdateFlags.None;
|
||||
case 2: WMTypeId = str.ToLower().Contains("auto") ? -1 : int.Parse(str); break;
|
||||
case 3: CreateWztypEntryIfMissing = (str == Strings.yes); break;
|
||||
case 4: YearOfManufacture = int.Parse(str); break;
|
||||
case 5: SaveResults = (str == Strings.yes); break;
|
||||
case 6: ReadStartInfo = (str == Strings.yes); break;
|
||||
case 7: StartInfoIsRequired = (str == Strings.yes); break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
for (DesigMode db = 0; db < DesigMode.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue)
|
||||
if (db.ToString() == str)
|
||||
{
|
||||
DesigMode = db;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -160,10 +168,10 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 9:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue)
|
||||
if (wm.ToString() == str)
|
||||
{
|
||||
DesigType = wm;
|
||||
return CfgUpdateFlags.None;
|
||||
@@ -176,7 +184,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
}
|
||||
|
||||
/// Verifies whether strings in UI controls represent valid parameters
|
||||
public bool ValidateParam(int i, string strValue, out string message)
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
|
||||
@@ -186,45 +194,46 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
case 0:
|
||||
for (DBUsed db = 0; db < DBUsed.Count; db++)
|
||||
{
|
||||
if (db.ToString() == strValue) return true;
|
||||
if (db.ToString() == str) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
for (WMKind wm = 0; wm < WMKind.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue) return true;
|
||||
if (wm.ToString() == str) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (int.TryParse(strValue, out idummy) && idummy >= 0)
|
||||
if (str.ToLower().Contains("auto") || (int.TryParse(str, out idummy) && idummy >= 0))
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (int.TryParse(strValue, out idummy) && idummy >= DateTime.Now.Year && idummy <= DateTime.Now.Year + 1)
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
if (str == Strings.yes || str == Strings.no)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if (strValue == Strings.yes || strValue == Strings.no)
|
||||
if (int.TryParse(str, out idummy) && idummy >= DateTime.Now.Year && idummy <= DateTime.Now.Year + 1)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
for (DesigMode db = 0; db < DesigMode.Count; db++)
|
||||
case 8:
|
||||
for (DesigMode dm = 0; dm < DesigMode.Count; dm++)
|
||||
{
|
||||
if (db.ToString() == strValue) return true;
|
||||
if (dm.ToString() == str) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 9:
|
||||
for (Results.Output.LogType wm = 0; wm < Results.Output.LogType.Count; wm++)
|
||||
{
|
||||
if (wm.ToString() == strValue) return true;
|
||||
if (wm.ToString() == str) return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -239,15 +248,16 @@ namespace TBF.Rig.Output.DB.SensusOracle
|
||||
|
||||
void CopyContentTo(ProcedureParams prms)
|
||||
{
|
||||
prms.DBUsed = this.DBUsed;
|
||||
prms.WMKind = this.WMKind;
|
||||
prms.WMTypeId = this.WMTypeId;
|
||||
prms.YearOfManufacture = this.YearOfManufacture;
|
||||
prms.SaveResults = this.SaveResults;
|
||||
prms.ReadStartInfo = this.ReadStartInfo;
|
||||
prms.StartInfoIsRequired = this.StartInfoIsRequired;
|
||||
prms.DesigMode = this.DesigMode;
|
||||
prms.DesigType = this.DesigType;
|
||||
prms.DBUsed = DBUsed;
|
||||
prms.WMKind = WMKind;
|
||||
prms.WMTypeId = WMTypeId;
|
||||
prms.CreateWztypEntryIfMissing = CreateWztypEntryIfMissing;
|
||||
prms.YearOfManufacture = YearOfManufacture;
|
||||
prms.SaveResults = SaveResults;
|
||||
prms.ReadStartInfo = ReadStartInfo;
|
||||
prms.StartInfoIsRequired = StartInfoIsRequired;
|
||||
prms.DesigMode = DesigMode;
|
||||
prms.DesigType = DesigType;
|
||||
}
|
||||
|
||||
public IParamsProvider Clone()
|
||||
|
||||
Reference in New Issue
Block a user