UpgradeSelectionDlg/Custom, more logging in Output.DB.SensusOracle.ProcedureParams.

This commit is contained in:
Milan Hanajik 2021-03-31 08:35:42 +02:00
parent c472bfc99d
commit c86bafd779
2 changed files with 25 additions and 38 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.Serialization;
using log4net;
using Config.Entities;
using Results.Output;
using TBF.BenchControl.Generic;
@ -15,7 +16,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
{
public class ProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcedureParams) })[0];
private static readonly ILog log = LogManager.GetLogger(typeof(ProcedureParams));
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcedureParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public DBUsed DBUsed; /// 0
@ -145,11 +148,11 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
}
break;
case 2: WMTypeId = int.Parse(strValue); break;
case 3: YearOfManufacture = int.Parse(strValue); break;
case 4: SaveResults = (strValue == Strings.yes); break;
case 5: ReadStartInfo = (strValue == Strings.yes); break;
case 6: StartInfoIsRequired = (strValue == Strings.yes); 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 7:
for (DesigMode db = 0; db < DesigMode.Count; db++)
@ -272,8 +275,9 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
if (tmp != null) tmp.CopyContentTo(this);
}
catch
catch (Exception exc)
{
log.ErrorFormat("Failed to UpdateFromDbEntity({0}): {1}", dbEntity, exc.Message);
}
}

View File

@ -1049,40 +1049,23 @@ namespace TBF.UI.Settings
try
{
//ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
ISession session = Config.FluentCommon.CreateSession(Users.Entities.DBKind.Config);
//var proceduresToModify = session.QueryOver<Config.Entities.Procedure>()
// .Where(x => (x.ProcedureState == Config.Entities.ProcedureState.Active))
// .OrderBy(x => x.ItemNr).Asc
// .List<Config.Entities.Procedure>();
var proceduresToModify = session.QueryOver<Config.Entities.ComponentProcedure>()
.Where(x => x.CmpntName == "Sensus-Oracle-DB")
.List();
//foreach (var proc in proceduresToModify)
//{
// if (!string.IsNullOrEmpty(proc.ResultsWriter) && proc.ResultsWriter.Contains("IperlLogger"))
// {
// Console.WriteLine("{0} ... {1}", proc.Name, proc.ResultsWriter);
// string[] writers = proc.ResultsWriter.Split(new char[] { '~' });
// StringBuilder sb = new StringBuilder();
// for (int i = 0; i < writers.Length; i++)
// {
// if (writers[i].Contains("IperlLogger"))
// {
// sb.Append("IperlLogger");
// }
// else
// {
// sb.Append(writers[i]);
// }
foreach (var proc in proceduresToModify)
{
if (!string.IsNullOrEmpty(proc.Parameters))
{
proc.Parameters = proc.Parameters.Replace("Iperl", "iPERL");
proc.Parameters = proc.Parameters.Replace("S620", "Mechanical");
session.SaveOrUpdate(proc);
}
}
session.Flush();
// if (i != writers.Length - 1) sb.Append("~");
// }
// proc.ResultsWriter = sb.ToString();
// session.SaveOrUpdate(proc);
// }
//}
//session.Flush();
ActivityEnd();
MessageBox.Show("Upgrade completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
}