Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c070fc635 | ||
|
|
4090bd1618 | ||
|
|
ab43cabc57 | ||
|
|
91461eb2cc | ||
|
|
aa18b75ef8 | ||
|
|
f029fdbd2e |
@@ -14,6 +14,8 @@ GraphLib/bin
|
||||
GraphLib/obj
|
||||
TracingDB/bin
|
||||
TracingDB/obj
|
||||
RestClient/bin
|
||||
RestClient/obj
|
||||
Results/bin/
|
||||
Results/obj/
|
||||
ResultsBrowser/bin/
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Config</RootNamespace>
|
||||
<AssemblyName>Config</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -23,6 +24,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -31,6 +33,7 @@
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
@@ -83,7 +86,6 @@
|
||||
<Compile Include="Entities\MetersPath.cs" />
|
||||
<Compile Include="Entities\OutputPath.cs" />
|
||||
<Compile Include="Entities\Procedure.cs" />
|
||||
<Compile Include="Entities\ProcedureHistory.cs" />
|
||||
<Compile Include="Entities\Profile.cs" />
|
||||
<Compile Include="Entities\PTest.cs" />
|
||||
<Compile Include="Entities\Test.cs" />
|
||||
@@ -93,8 +95,6 @@
|
||||
<Compile Include="Entities\User.cs" />
|
||||
<Compile Include="Entities\VirtualBenchSequence.cs" />
|
||||
<Compile Include="Entities\VirtualBenchStep.cs" />
|
||||
<Compile Include="Entities\Watermeter.cs" />
|
||||
<Compile Include="Entities\WMType.cs" />
|
||||
<Compile Include="FluentCommon.cs" />
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="Mappings\BenchPathMap.cs" />
|
||||
@@ -115,10 +115,6 @@
|
||||
<Compile Include="Mappings\TransitionStepMap.cs" />
|
||||
<Compile Include="Mappings\UncertaintyMap.cs" />
|
||||
<Compile Include="Mappings\UserMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
|
||||
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
|
||||
<Compile Include="Mappings\WatermeterMap.cs" />
|
||||
<Compile Include="Mappings\WMTypeMap.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\Strings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@@ -9,14 +10,18 @@ namespace Config.Entities
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Users.Entities.GID GID { get; set; }
|
||||
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62
|
||||
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
|
||||
|
||||
public Group()
|
||||
{
|
||||
Users = new List<User>();
|
||||
}
|
||||
|
||||
public Group(Users.Entities.GID gid)
|
||||
{
|
||||
: this()
|
||||
{
|
||||
GID = gid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace Config.Entities
|
||||
public virtual double TempLimHi { get; set; } /// Upper limit for the controlled temperature
|
||||
public virtual double PressLimLo { get; set; } /// [bar] min. water pressure
|
||||
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
|
||||
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
|
||||
public virtual bool Evaluate { get; set; }
|
||||
|
||||
public virtual sbyte E1 { get; set; } ///
|
||||
public virtual sbyte E2 { get; set; } ///
|
||||
@@ -76,6 +78,8 @@ namespace Config.Entities
|
||||
TempLimHi = 25.0; /// [°C]
|
||||
PressLimLo = 0; /// [bar]
|
||||
PressLimHi = 16.0; /// [bar]
|
||||
Publish = (sbyte)Config.Entities.Publish.Always;
|
||||
Evaluate = true;
|
||||
|
||||
E1 = 1;
|
||||
E2 = 1;
|
||||
@@ -133,6 +137,8 @@ namespace Config.Entities
|
||||
result.TempLimHi = TempLimHi;
|
||||
result.PressLimLo = PressLimLo;
|
||||
result.PressLimHi = PressLimHi;
|
||||
result.Publish = Publish;
|
||||
result.Evaluate = Evaluate;
|
||||
|
||||
result.E1 = E1;
|
||||
result.E2 = E2;
|
||||
@@ -184,6 +190,8 @@ namespace Config.Entities
|
||||
output.WriteLine(TempLimHi.ToString(ci));
|
||||
output.WriteLine(PressLimLo.ToString(ci));
|
||||
output.WriteLine(PressLimHi.ToString(ci));
|
||||
output.WriteLine(Publish.ToString());
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
|
||||
output.WriteLine(E1.ToString());
|
||||
output.WriteLine(E2.ToString());
|
||||
@@ -238,6 +246,8 @@ namespace Config.Entities
|
||||
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
|
||||
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
|
||||
tst.Publish = sbyte.Parse(input.ReadLine());
|
||||
tst.Evaluate = bool.Parse(input.ReadLine());
|
||||
|
||||
/// TODO (E1 .. E21)
|
||||
|
||||
@@ -278,8 +288,10 @@ namespace Config.Entities
|
||||
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", TempLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", TempLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", PressLimLo.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", PressLimHi.ToString(ci), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Publish.ToString()) { diff.AppendFormat(fmt, "Publish", Publish.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != Evaluate.ToString()) { diff.AppendFormat(fmt, "Evaluate", Evaluate.ToString(), ln); };
|
||||
|
||||
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
|
||||
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ProcedureHistory
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual Procedure Current { get; set; }
|
||||
public virtual IList<Procedure> OldProcedures { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public ProcedureHistory()
|
||||
{
|
||||
Current = new Procedure();
|
||||
OldProcedures = new List<Procedure>();
|
||||
}
|
||||
|
||||
public virtual ProcedureHistory Clone()
|
||||
{
|
||||
ProcedureHistory result = new ProcedureHistory();
|
||||
result.Current = Current.Clone();
|
||||
foreach (Procedure p in OldProcedures) result.OldProcedures.Add(p.Clone());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
/// This class holds the watermeter type specific data
|
||||
/// that have all watermaters of the same type in common
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class WMType
|
||||
{
|
||||
// mapped
|
||||
public virtual int Id { get; protected set; } /// primary key
|
||||
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual string CreateDescription { get; set; } /// Description\
|
||||
|
||||
public virtual string Name { get; set; } /// type name
|
||||
public virtual float PulseRate { get; set; } /// Pulses per Liter
|
||||
|
||||
// not yet mapped
|
||||
public virtual int IdentNr { get; protected set; } /// identification number of watermeter tzpe
|
||||
public virtual int Diameter { get; set; } /// nominal diameter
|
||||
public virtual int Pressure { get; set; } /// nominal pressure
|
||||
public virtual int Length { get; set; } /// construction length
|
||||
public virtual int Temperatur { get; set; } /// nominal temperature in C
|
||||
public virtual float NominalFlow { get; set; } /// nominal flow Qn
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public WMType()
|
||||
{
|
||||
}
|
||||
|
||||
public static WMType DefaultWMType()
|
||||
{
|
||||
WMType procedure = new WMType()
|
||||
{
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUserName = Users.GlobalData.CurrentUser.UserName,
|
||||
CreateDescription = "A default water meter created.",
|
||||
Name = "Watermeter",
|
||||
PulseRate = 1000,
|
||||
};
|
||||
return procedure;
|
||||
}
|
||||
|
||||
public virtual WMType Clone()
|
||||
{
|
||||
WMType result = new WMType();
|
||||
|
||||
result.CreateTime = CreateTime;
|
||||
result.CreateUserName = CreateUserName;
|
||||
result.CreateDescription = CreateDescription;
|
||||
result.Name = Name;
|
||||
result.PulseRate = PulseRate;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = "";
|
||||
result += "WMTpe: " + Environment.NewLine;
|
||||
result += " Name = " + Name + Environment.NewLine;
|
||||
result += " Created by = " + CreateUserName + Environment.NewLine;
|
||||
result += " Created on = " + CreateTime.ToString() + Environment.NewLine;
|
||||
result += " Description = " + CreateDescription + Environment.NewLine;
|
||||
result += " Pulse rate = " + PulseRate.ToString() + Environment.NewLine;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class Watermeter
|
||||
{
|
||||
public virtual int Id { get; protected set; } /// primary key
|
||||
|
||||
public virtual DateTime CreateTime { get; set; } /// Date and time of the creation or change
|
||||
public virtual string CreateUserName { get; set; } /// Name of the user who has created or changed this procedure
|
||||
public virtual string CreateDescription { get; set; } /// Description
|
||||
|
||||
/// mapped
|
||||
public virtual string Serial { get; set; } /// serial number
|
||||
public virtual WMType WMType { get; set; } /// type of watermeter
|
||||
///
|
||||
|
||||
/// <summary>
|
||||
/// Load a watermeter from the database
|
||||
/// </summary>
|
||||
public static Watermeter LoadBySerialnr(string SerialNr)
|
||||
{
|
||||
IList<Watermeter> ListOfWatermeters = FluentCommon.CreateSession(Users.Entities.DBKind.Results)
|
||||
.CreateQuery("FROM Watermeter WHERE Serial = :SerialNrParameter")
|
||||
.SetParameter("SerialNrParameter", SerialNr)
|
||||
.List<Watermeter>();
|
||||
if (ListOfWatermeters.Count > 0) return ListOfWatermeters.ElementAt(0);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-22
@@ -145,17 +145,8 @@ namespace Config
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
///
|
||||
/// Prepare all groups
|
||||
/// Create user 'admin'
|
||||
///
|
||||
var testers = new Config.Entities.Group(Users.Entities.GID.Testers);
|
||||
var testingSpecialists = new Config.Entities.Group(Users.Entities.GID.TestingSpecialists);
|
||||
var headOfLab = new Config.Entities.Group(Users.Entities.GID.HeadOfLab);
|
||||
var maintenanceSpecialists = new Config.Entities.Group(Users.Entities.GID.MaintenanceSpecialists);
|
||||
var metrologists = new Config.Entities.Group(Users.Entities.GID.Metrologists);
|
||||
var calibrationSpecialists = new Config.Entities.Group(Users.Entities.GID.CalibrationSpecialists);
|
||||
var administrators = new Config.Entities.Group(Users.Entities.GID.Administrators);
|
||||
|
||||
/// Create the user 'admin' add his groups
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = Data.AdminUsername,
|
||||
@@ -163,20 +154,35 @@ namespace Config
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(Data.AdminPassword);
|
||||
admin.AddGroup(testers);
|
||||
admin.AddGroup(testingSpecialists);
|
||||
admin.AddGroup(headOfLab);
|
||||
admin.AddGroup(maintenanceSpecialists);
|
||||
admin.AddGroup(metrologists);
|
||||
admin.AddGroup(calibrationSpecialists);
|
||||
admin.AddGroup(administrators);
|
||||
|
||||
session.SaveOrUpdate(admin);
|
||||
|
||||
///// Create the control board component
|
||||
//var cmpnt = (new BenchControl.Elde.ControlBoardCfg(new BenchControl.Elde.ControlBoardFactory())).CreateDbEntity();
|
||||
//session.SaveOrUpdate(cmpnt);
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
///
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
Config.Entities.Group group = new Config.Entities.Group(gid);
|
||||
switch (gid)
|
||||
{
|
||||
case Users.Entities.GID.Testers:
|
||||
case Users.Entities.GID.TestingSpecialists:
|
||||
case Users.Entities.GID.HeadOfLab:
|
||||
case Users.Entities.GID.MaintenanceSpecialists:
|
||||
case Users.Entities.GID.Metrologists:
|
||||
case Users.Entities.GID.CalibrationSpecialists:
|
||||
case Users.Entities.GID.Administrators:
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
case Users.Entities.GID.TraceabilityManagement:
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
|
||||
case Users.Entities.GID.MetrologicalAuthority:
|
||||
case Users.Entities.GID.WaterMeterAuthority:
|
||||
#endif
|
||||
admin.AddGroup(group);
|
||||
session.SaveOrUpdate(group); /// Save this group
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
session.SaveOrUpdate(admin); /// Save user 'admin'
|
||||
transaction.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -7,10 +7,18 @@ namespace Config.Mappings
|
||||
{
|
||||
class GroupMap : ClassMap<Entities.Group>
|
||||
{
|
||||
/// <seealso>
|
||||
/// https://stackoverflow.com/questions/9108083/fluent-nhibernate-many-to-many-mapping-way/9125059
|
||||
/// </seealso>
|
||||
public GroupMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.GID).Column("Name"); ;
|
||||
Map(x => x.GID).Column("Name");
|
||||
Map(x => x.AccessFlags);
|
||||
HasManyToMany(x => x.Users)
|
||||
.Cascade.SaveUpdate()
|
||||
.Inverse()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Config.Mappings
|
||||
Map(x => x.TempLimHi);
|
||||
Map(x => x.PressLimLo);
|
||||
Map(x => x.PressLimHi);
|
||||
Map(x => x.Publish);
|
||||
Map(x => x.Evaluate);
|
||||
Map(x => x.E1);
|
||||
Map(x => x.E2);
|
||||
Map(x => x.E3);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -19,8 +19,9 @@ namespace Config.Mappings
|
||||
Map(x => x.Password4);
|
||||
Map(x => x.FullName).Column("Description");
|
||||
Map(x => x.LastPwChange);
|
||||
HasMany(x => x.Groups)
|
||||
.Cascade.All();
|
||||
HasManyToMany(x => x.Groups)
|
||||
.Cascade.SaveUpdate()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchSequenceMap : ClassMap<VirtualBenchSequence>
|
||||
{
|
||||
public VirtualBenchSequenceMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.Description);
|
||||
HasMany(x => x.VirtualBenchSteps)
|
||||
.OrderBy("ItemNr")
|
||||
.Cascade.All();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
using Config.Entities;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class VirtualBenchStepMap : ClassMap<VirtualBenchStep>
|
||||
{
|
||||
public VirtualBenchStepMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.ItemNr);
|
||||
Map(x => x.Duration);
|
||||
|
||||
References(x => x.VirtualBenchSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WMTypeMap : ClassMap<Entities.WMType>
|
||||
{
|
||||
public WMTypeMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.CreateTime);
|
||||
Map(x => x.CreateUserName);
|
||||
Map(x => x.CreateDescription);
|
||||
Map(x => x.Name);
|
||||
Map(x => x.PulseRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Config.Mappings
|
||||
{
|
||||
class WatermeterMap : ClassMap<Entities.Watermeter>
|
||||
{
|
||||
public WatermeterMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.Serial);
|
||||
// HasOne(x => x.WMType)
|
||||
// .Cascade.All();
|
||||
References(x => x.WMType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.24.1382.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1382.0")]
|
||||
[assembly: AssemblyVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Decrypt</RootNamespace>
|
||||
<AssemblyName>Decrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Decrypt.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DeviceTest</RootNamespace>
|
||||
<AssemblyName>DeviceTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>DeviceTest.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace DeviceTest.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
@@ -10,9 +10,10 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Dirichlet.Numerics</RootNamespace>
|
||||
<AssemblyName>Dirichlet.Numerics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -22,6 +23,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -30,6 +32,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -48,4 +51,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Encrypt</RootNamespace>
|
||||
<AssemblyName>Encrypt</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>Encrypt.Program</StartupObject>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -66,6 +66,7 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
@@ -87,6 +88,7 @@
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -99,6 +101,7 @@
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
@@ -110,6 +113,7 @@
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
|
||||
@@ -10,12 +10,13 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||
<AssemblyName>GraphLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -25,6 +26,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -33,6 +35,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
+12
-12
@@ -1,10 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.18408
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace ClassLibrary1.Properties {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
@@ -33,7 +33,7 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
@@ -47,8 +47,8 @@ namespace ClassLibrary1.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class BaseClient
|
||||
{
|
||||
private string _token;
|
||||
|
||||
private string _baseUrl;
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
private readonly HttpClient client;
|
||||
private AuthenticationHeaderValue _authValue;
|
||||
|
||||
public BaseClient(string baseUrl)
|
||||
{
|
||||
this._baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public void SetToken(string token)
|
||||
{
|
||||
_authValue = new AuthenticationHeaderValue("Bearer", token);
|
||||
}
|
||||
|
||||
protected Uri GetUrl(string relativeUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + relativeUrl);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<TResult> GetResultAsync<TResult>(string relativeUrl)
|
||||
{
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = null;
|
||||
try
|
||||
{
|
||||
url = new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + relativeUrl);
|
||||
return default(TResult);
|
||||
}
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await client.GetAsync(url).ConfigureAwait(false);
|
||||
var parsedResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<TResult>(parsedResult);
|
||||
}
|
||||
if (result.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
{
|
||||
//Create not an error message, because communication is okay, only the meter is not available in database.
|
||||
return default(TResult);
|
||||
}
|
||||
try
|
||||
{
|
||||
string Messages = await result.Content.ReadAsStringAsync();
|
||||
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(Messages);
|
||||
string ServiceError = String.Empty;
|
||||
if (errors != null)
|
||||
{
|
||||
ServiceError = errors["Message"].ToString();
|
||||
}
|
||||
ErrorMessage = string.Format("Error message: {0}", ServiceError);
|
||||
}
|
||||
catch
|
||||
{
|
||||
result.EnsureSuccessStatusCode();
|
||||
}
|
||||
return default(TResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Message += ". " + ex.InnerException.Message;
|
||||
}
|
||||
Trace.TraceError(Message);
|
||||
ErrorMessage = Message;
|
||||
return default(TResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Post method.
|
||||
/// </summary>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="relativeUrl"></param>
|
||||
/// <param name="Position"></param>
|
||||
/// /// <param name="withBaseUrl"></param>
|
||||
/// <returns>The new resource</returns>
|
||||
protected async Task<string> PostWithReturnDataAsync<TResult>(string relativeUrl, bool withBaseUrl, TResult Position)
|
||||
{
|
||||
string data = string.Empty;
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = null;
|
||||
try
|
||||
{
|
||||
if (withBaseUrl)
|
||||
{
|
||||
url = new Uri(_baseUrl + relativeUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = new Uri(relativeUrl);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceError("Invalid url " + url);
|
||||
ErrorMessage = ex.Message;
|
||||
return data;
|
||||
}
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(Position);
|
||||
HttpContent content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = await client.PostAsync(url.ToString(), content).ConfigureAwait(false);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
data = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
return data;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (response.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
ErrorMessage = String.Format("Status code: {0}. Url: {1}", response.StatusCode, url);
|
||||
}
|
||||
else
|
||||
{
|
||||
string errorMessageService = string.Empty;
|
||||
string message = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
errorMessageService = response.ReasonPhrase;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var errors = JsonConvert.DeserializeObject<Dictionary<string, object>>(message);
|
||||
errorMessageService = errors["Message"].ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
errorMessageService = message;
|
||||
}
|
||||
}
|
||||
ErrorMessage = String.Format("Status code: {0}. Error message: {1}", response.StatusCode, errorMessageService);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Trace.TraceError(ex.Message);
|
||||
ErrorMessage = ex.Message;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected HttpClient GetClient()
|
||||
{
|
||||
HttpClientHandler handler = new HttpClientHandler();
|
||||
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
|
||||
HttpClient client = new HttpClient(handler);
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
client.DefaultRequestHeaders.Authorization = _authValue;
|
||||
return client;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using RestClient.Models;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class GetQ2PreCorrectionClient : BaseClient
|
||||
{
|
||||
public GetQ2PreCorrectionClient(string baseUrl)
|
||||
: base(baseUrl)
|
||||
{ }
|
||||
|
||||
public async Task GetToken(string name, string password, string urlLogin)
|
||||
{
|
||||
LoginUser user = new LoginUser { Name = name, Password = password };
|
||||
var response = await PostWithReturnDataAsync(urlLogin, false, user).ConfigureAwait(false);
|
||||
var tmp = JsonConvert.DeserializeObject<CustomJwt>(response);
|
||||
if (tmp != null)
|
||||
{
|
||||
SetToken(tmp.access_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(string.Format("No token loaded: {0}", ErrorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Q2PreCorrection> GetQ2Correction(string relativeUrl)
|
||||
{
|
||||
ErrorMessage = String.Empty;
|
||||
Uri url = GetUrl(relativeUrl);
|
||||
if (url == null) return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
|
||||
using (var client = GetClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = await client.GetAsync(url).ConfigureAwait(false);
|
||||
string jsonResult = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
Q2PreCorrection retVal = new Q2PreCorrection();
|
||||
|
||||
string pattern = "\"areDataCalculated\":";
|
||||
int position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
int length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.AreDataCalculated = bool.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
pattern = "\"right\":";
|
||||
position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.CorrLR = int.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
pattern = "\"left\":";
|
||||
position = jsonResult.IndexOf(pattern) + pattern.Length;
|
||||
length = jsonResult.Substring(position).IndexOfAny(new char[] { ',', '}', '\r', '\n' });
|
||||
retVal.CorrRL = int.Parse(jsonResult.Substring(position, length));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
string Message = ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
Message += ". " + ex.InnerException.Message;
|
||||
}
|
||||
Trace.TraceError(Message);
|
||||
ErrorMessage = Message;
|
||||
return new Q2PreCorrection { AreDataCalculated = false, CorrLR = 0, CorrRL = 0, };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RestClient.Models
|
||||
{
|
||||
public class CustomJwt
|
||||
{
|
||||
public string access_token { get; set; }
|
||||
public string token_type { get; set; }
|
||||
public int expires_in { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace RestClient.Models
|
||||
{
|
||||
public class LoginUser
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RestClient")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RestClient")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("46e3b0e1-209f-4550-b0dd-d7e2c039b3ce")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace RestClient
|
||||
{
|
||||
public class Q2PreCorrection
|
||||
{
|
||||
public bool AreDataCalculated;
|
||||
public int CorrLR;
|
||||
public int CorrRL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RestClient</RootNamespace>
|
||||
<AssemblyName>RestClient</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BaseClient.cs" />
|
||||
<Compile Include="GetQ2PreCorrectionClient.cs" />
|
||||
<Compile Include="Models\CustomJwt.cs" />
|
||||
<Compile Include="Models\LoginUser.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Q2PreCorrection.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||
</packages>
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.24.1390.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1390.0")]
|
||||
[assembly: AssemblyVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Results</RootNamespace>
|
||||
<AssemblyName>Results</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -22,6 +23,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -30,6 +32,7 @@
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -12,7 +12,7 @@ namespace ResultsBrowser.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ResultsBrowser</RootNamespace>
|
||||
<AssemblyName>ResultsBrowser</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -25,6 +25,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -34,6 +35,7 @@
|
||||
<DefineConstants>TRACE;MUNICH</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ResultsBrowser.Program</StartupObject>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace Statistics.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Statistics</RootNamespace>
|
||||
<AssemblyName>Statistics</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -24,6 +24,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +34,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -50,6 +50,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Decrypt", "Decrypt\Decrypt.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Encrypt", "Encrypt\Encrypt.csproj", "{DA9B09F3-A99D-4883-A954-537560453674}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestClient", "RestClient\RestClient.csproj", "{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -202,6 +204,18 @@ Global
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.ActiveCfg = Release|x86
|
||||
{DA9B09F3-A99D-4883-A954-537560453674}.Release|x86.Build.0 = Release|x86
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{46E3B0E1-209F-4550-B0DD-D7E2C039B3CE}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
|
||||
readonly FromHistoryCfg cfg;
|
||||
|
||||
public bool SimultWithPrevious { get { return true; } }
|
||||
public bool SimultWithPrevious { get { return false; } }
|
||||
public bool SimultWithNext { get { return false; } }
|
||||
|
||||
#region Configuration Change Handling
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
|
||||
|
||||
public bool UseWebService;
|
||||
public string BaseUrl;
|
||||
public string RelativeUrl;
|
||||
public bool UseLocalDB;
|
||||
public string ProcedureName;
|
||||
public string ProcedureNameAlt1;
|
||||
@@ -34,6 +36,8 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
ParentName = string.Empty;
|
||||
|
||||
UseWebService = false;
|
||||
BaseUrl = "https://tludockerhost1:5011/api/";
|
||||
RelativeUrl = "q2correction";
|
||||
UseLocalDB = true;
|
||||
ProcedureName = "iPERL Smart Suez DN15 Q3_2.5 R800";
|
||||
ProcedureNameAlt1 = "iPERL Suez DN15 Q3_2.5 R800";
|
||||
|
||||
@@ -10,7 +10,7 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
public partial class FromHistoryCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
public partial class FromHistoryCfgCtrl : Configs.ConfigCtrlUtils, IComponentCfgCtrl
|
||||
{
|
||||
static readonly ILog log = LogManager.GetLogger(typeof(FromHistoryCfgCtrl));
|
||||
|
||||
@@ -26,6 +26,10 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
private TextBox procedureNameAlt2TextBox;
|
||||
private CheckBox useWebServiceCheckBox;
|
||||
private CheckBox useDefaultValuesCheckBox;
|
||||
private TextBox relativeUrlTextBox;
|
||||
private Label relativeUrlLabel;
|
||||
private TextBox baseUrlTextBox;
|
||||
private Label baseUrlLabel;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
@@ -60,6 +64,8 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
useWebServiceCheckBox.Checked = config.UseWebService;
|
||||
baseUrlTextBox.Text = config.BaseUrl;
|
||||
relativeUrlTextBox.Text = config.RelativeUrl;
|
||||
useLocalDBCheckBox.Checked = config.UseLocalDB;
|
||||
procedureNameTextBox.Text = config.ProcedureName;
|
||||
procedureNameAlt1TextBox.Text = config.ProcedureNameAlt1;
|
||||
@@ -71,6 +77,8 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
useWebServiceCheckBox.Enabled = true;
|
||||
baseUrlTextBox.Enabled = true;
|
||||
relativeUrlTextBox.Enabled = true;
|
||||
useLocalDBCheckBox.Enabled = true;
|
||||
procedureNameTextBox.Enabled = true;
|
||||
procedureNameAlt1TextBox.Enabled = true;
|
||||
@@ -95,41 +103,14 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||
}
|
||||
|
||||
if (config.UseWebService != useWebServiceCheckBox.Checked)
|
||||
{
|
||||
config.UseWebService = useWebServiceCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseLocalDB != useLocalDBCheckBox.Checked)
|
||||
{
|
||||
config.UseLocalDB = useLocalDBCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureName != procedureNameTextBox.Text)
|
||||
{
|
||||
config.ProcedureName = procedureNameTextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt1 != procedureNameAlt1TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt1 = procedureNameAlt1TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.ProcedureNameAlt2 != procedureNameAlt2TextBox.Text)
|
||||
{
|
||||
config.ProcedureNameAlt2 = procedureNameAlt2TextBox.Text;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
|
||||
if (config.UseDefaultValues != useDefaultValuesCheckBox.Checked)
|
||||
{
|
||||
config.UseDefaultValues = useDefaultValuesCheckBox.Checked;
|
||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
}
|
||||
flags |= UpdateDifferent(ref config.UseWebService, useWebServiceCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.BaseUrl, baseUrlTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.RelativeUrl, relativeUrlTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.UseLocalDB, useLocalDBCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.ProcedureName, procedureNameTextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.ProcedureNameAlt1, procedureNameAlt1TextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.ProcedureNameAlt2, procedureNameAlt2TextBox.Text, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
flags |= UpdateDifferent(ref config.UseDefaultValues, useDefaultValuesCheckBox.Checked, CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||
|
||||
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||
{
|
||||
@@ -153,33 +134,37 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
this.procedureNameAlt2TextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureNameAlt2Label = new System.Windows.Forms.Label();
|
||||
this.useDefaultValuesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.relativeUrlTextBox = new System.Windows.Forms.TextBox();
|
||||
this.relativeUrlLabel = new System.Windows.Forms.Label();
|
||||
this.baseUrlTextBox = new System.Windows.Forms.TextBox();
|
||||
this.baseUrlLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// procedureNameTextBox
|
||||
//
|
||||
this.procedureNameTextBox.Enabled = false;
|
||||
this.procedureNameTextBox.Location = new System.Drawing.Point(190, 124);
|
||||
this.procedureNameTextBox.Location = new System.Drawing.Point(165, 176);
|
||||
this.procedureNameTextBox.Name = "procedureNameTextBox";
|
||||
this.procedureNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameTextBox.TabIndex = 6;
|
||||
this.procedureNameTextBox.Size = new System.Drawing.Size(217, 20);
|
||||
this.procedureNameTextBox.TabIndex = 10;
|
||||
//
|
||||
// procedureNameLabel
|
||||
//
|
||||
this.procedureNameLabel.AutoSize = true;
|
||||
this.procedureNameLabel.Location = new System.Drawing.Point(65, 127);
|
||||
this.procedureNameLabel.Location = new System.Drawing.Point(40, 179);
|
||||
this.procedureNameLabel.Name = "procedureNameLabel";
|
||||
this.procedureNameLabel.Size = new System.Drawing.Size(85, 13);
|
||||
this.procedureNameLabel.TabIndex = 5;
|
||||
this.procedureNameLabel.TabIndex = 9;
|
||||
this.procedureNameLabel.Text = "Procedure name";
|
||||
//
|
||||
// useLocalDBCheckBox
|
||||
//
|
||||
this.useLocalDBCheckBox.AutoSize = true;
|
||||
this.useLocalDBCheckBox.Enabled = false;
|
||||
this.useLocalDBCheckBox.Location = new System.Drawing.Point(38, 103);
|
||||
this.useLocalDBCheckBox.Location = new System.Drawing.Point(13, 155);
|
||||
this.useLocalDBCheckBox.Name = "useLocalDBCheckBox";
|
||||
this.useLocalDBCheckBox.Size = new System.Drawing.Size(129, 17);
|
||||
this.useLocalDBCheckBox.TabIndex = 4;
|
||||
this.useLocalDBCheckBox.TabIndex = 8;
|
||||
this.useLocalDBCheckBox.Text = "2. Use local database";
|
||||
this.useLocalDBCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -187,7 +172,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
//
|
||||
this.useWebServiceCheckBox.AutoSize = true;
|
||||
this.useWebServiceCheckBox.Enabled = false;
|
||||
this.useWebServiceCheckBox.Location = new System.Drawing.Point(38, 78);
|
||||
this.useWebServiceCheckBox.Location = new System.Drawing.Point(13, 74);
|
||||
this.useWebServiceCheckBox.Name = "useWebServiceCheckBox";
|
||||
this.useWebServiceCheckBox.Size = new System.Drawing.Size(117, 17);
|
||||
this.useWebServiceCheckBox.TabIndex = 3;
|
||||
@@ -197,15 +182,15 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(190, 45);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(165, 38);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.nameTextBox.Size = new System.Drawing.Size(217, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(132, 48);
|
||||
this.nameLabel.Location = new System.Drawing.Point(107, 41);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@@ -214,7 +199,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(187, 16);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(162, 14);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(89, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
@@ -223,50 +208,88 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
// procedureNameAlt1TextBox
|
||||
//
|
||||
this.procedureNameAlt1TextBox.Enabled = false;
|
||||
this.procedureNameAlt1TextBox.Location = new System.Drawing.Point(190, 147);
|
||||
this.procedureNameAlt1TextBox.Location = new System.Drawing.Point(165, 199);
|
||||
this.procedureNameAlt1TextBox.Name = "procedureNameAlt1TextBox";
|
||||
this.procedureNameAlt1TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt1TextBox.TabIndex = 8;
|
||||
this.procedureNameAlt1TextBox.Size = new System.Drawing.Size(217, 20);
|
||||
this.procedureNameAlt1TextBox.TabIndex = 12;
|
||||
//
|
||||
// procedureNameAlt1Label
|
||||
//
|
||||
this.procedureNameAlt1Label.AutoSize = true;
|
||||
this.procedureNameAlt1Label.Location = new System.Drawing.Point(65, 150);
|
||||
this.procedureNameAlt1Label.Location = new System.Drawing.Point(40, 202);
|
||||
this.procedureNameAlt1Label.Name = "procedureNameAlt1Label";
|
||||
this.procedureNameAlt1Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt1Label.TabIndex = 7;
|
||||
this.procedureNameAlt1Label.TabIndex = 11;
|
||||
this.procedureNameAlt1Label.Text = "Procedure name Alt1";
|
||||
//
|
||||
// procedureNameAlt2TextBox
|
||||
//
|
||||
this.procedureNameAlt2TextBox.Enabled = false;
|
||||
this.procedureNameAlt2TextBox.Location = new System.Drawing.Point(190, 170);
|
||||
this.procedureNameAlt2TextBox.Location = new System.Drawing.Point(165, 222);
|
||||
this.procedureNameAlt2TextBox.Name = "procedureNameAlt2TextBox";
|
||||
this.procedureNameAlt2TextBox.Size = new System.Drawing.Size(171, 20);
|
||||
this.procedureNameAlt2TextBox.TabIndex = 10;
|
||||
this.procedureNameAlt2TextBox.Size = new System.Drawing.Size(217, 20);
|
||||
this.procedureNameAlt2TextBox.TabIndex = 14;
|
||||
//
|
||||
// procedureNameAlt2Label
|
||||
//
|
||||
this.procedureNameAlt2Label.AutoSize = true;
|
||||
this.procedureNameAlt2Label.Location = new System.Drawing.Point(65, 173);
|
||||
this.procedureNameAlt2Label.Location = new System.Drawing.Point(40, 225);
|
||||
this.procedureNameAlt2Label.Name = "procedureNameAlt2Label";
|
||||
this.procedureNameAlt2Label.Size = new System.Drawing.Size(106, 13);
|
||||
this.procedureNameAlt2Label.TabIndex = 9;
|
||||
this.procedureNameAlt2Label.TabIndex = 13;
|
||||
this.procedureNameAlt2Label.Text = "Procedure name Alt2";
|
||||
//
|
||||
// useDefaultValuesCheckBox
|
||||
//
|
||||
this.useDefaultValuesCheckBox.AutoSize = true;
|
||||
this.useDefaultValuesCheckBox.Enabled = false;
|
||||
this.useDefaultValuesCheckBox.Location = new System.Drawing.Point(38, 202);
|
||||
this.useDefaultValuesCheckBox.Location = new System.Drawing.Point(13, 258);
|
||||
this.useDefaultValuesCheckBox.Name = "useDefaultValuesCheckBox";
|
||||
this.useDefaultValuesCheckBox.Size = new System.Drawing.Size(126, 17);
|
||||
this.useDefaultValuesCheckBox.TabIndex = 11;
|
||||
this.useDefaultValuesCheckBox.TabIndex = 15;
|
||||
this.useDefaultValuesCheckBox.Text = "3. Use default values";
|
||||
this.useDefaultValuesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// relativeUrlTextBox
|
||||
//
|
||||
this.relativeUrlTextBox.Enabled = false;
|
||||
this.relativeUrlTextBox.Location = new System.Drawing.Point(120, 119);
|
||||
this.relativeUrlTextBox.Name = "relativeUrlTextBox";
|
||||
this.relativeUrlTextBox.Size = new System.Drawing.Size(262, 20);
|
||||
this.relativeUrlTextBox.TabIndex = 7;
|
||||
//
|
||||
// relativeUrlLabel
|
||||
//
|
||||
this.relativeUrlLabel.AutoSize = true;
|
||||
this.relativeUrlLabel.Location = new System.Drawing.Point(40, 122);
|
||||
this.relativeUrlLabel.Name = "relativeUrlLabel";
|
||||
this.relativeUrlLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.relativeUrlLabel.TabIndex = 6;
|
||||
this.relativeUrlLabel.Text = "Relative URL";
|
||||
//
|
||||
// baseUrlTextBox
|
||||
//
|
||||
this.baseUrlTextBox.Enabled = false;
|
||||
this.baseUrlTextBox.Location = new System.Drawing.Point(120, 96);
|
||||
this.baseUrlTextBox.Name = "baseUrlTextBox";
|
||||
this.baseUrlTextBox.Size = new System.Drawing.Size(262, 20);
|
||||
this.baseUrlTextBox.TabIndex = 5;
|
||||
//
|
||||
// baseUrlLabel
|
||||
//
|
||||
this.baseUrlLabel.AutoSize = true;
|
||||
this.baseUrlLabel.Location = new System.Drawing.Point(40, 99);
|
||||
this.baseUrlLabel.Name = "baseUrlLabel";
|
||||
this.baseUrlLabel.Size = new System.Drawing.Size(56, 13);
|
||||
this.baseUrlLabel.TabIndex = 4;
|
||||
this.baseUrlLabel.Text = "Base URL";
|
||||
//
|
||||
// FromHistoryCfgCtrl
|
||||
//
|
||||
this.Controls.Add(this.relativeUrlTextBox);
|
||||
this.Controls.Add(this.relativeUrlLabel);
|
||||
this.Controls.Add(this.baseUrlTextBox);
|
||||
this.Controls.Add(this.baseUrlLabel);
|
||||
this.Controls.Add(this.useDefaultValuesCheckBox);
|
||||
this.Controls.Add(this.procedureNameAlt2TextBox);
|
||||
this.Controls.Add(this.procedureNameAlt2Label);
|
||||
@@ -280,7 +303,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "FromHistoryCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(400, 250);
|
||||
this.Size = new System.Drawing.Size(400, 300);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using NHibernate;
|
||||
using log4net;
|
||||
using Results.Entities;
|
||||
using RestClient;
|
||||
using TBF.UiBridge;
|
||||
|
||||
namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
@@ -44,7 +45,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
/// Populate TestResult data entity with data
|
||||
///
|
||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||
Results.Entities.TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
TestRslt tstRslt = BatchRslts.GetTestRslt(testName, test.Part);
|
||||
if (tstRslt != null)
|
||||
{
|
||||
tstRslt.StartTime = DateTime.Now;
|
||||
@@ -52,7 +53,7 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
tstRslt.TestDone = true;
|
||||
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
|
||||
{
|
||||
Results.Entities.MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
MeterTestRslt meterRslt = BatchRslts.GetMeterTestRslt(testName, i, Config.Entities.CompoundMeterId.Single);
|
||||
if (meterRslt != null)
|
||||
{
|
||||
meterRslt.TestDone = true;
|
||||
@@ -61,6 +62,10 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
}
|
||||
}
|
||||
|
||||
if (!success)
|
||||
{
|
||||
Bridge.OnError(this, "Q2 pre-correction sa nedá načítať");
|
||||
}
|
||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
||||
|
||||
return new List<Event> { success ? Event.Done : Event.RecoverableError };
|
||||
@@ -74,15 +79,26 @@ namespace TBF.BenchControl.TestMethods.Q2CorrectionFromHistory
|
||||
|
||||
try
|
||||
{
|
||||
return false;
|
||||
|
||||
/// TODO: Use webservice
|
||||
//IsQ2PreCorrectionCalculated = true;
|
||||
//return true;
|
||||
GetQ2PreCorrectionClient client = new GetQ2PreCorrectionClient(cfg.BaseUrl);
|
||||
client.GetToken("ReadUser", "sensus", "https://sluprimadev/SensusCore/api/v1/Locations/1/Login2").Wait();
|
||||
Q2PreCorrection response = client.GetQ2Correction(cfg.RelativeUrl).Result;
|
||||
if (response != null && response.AreDataCalculated)
|
||||
{
|
||||
CalculatedQ2PreCorrectionLR = response.CorrLR;
|
||||
CalculatedQ2PreCorrectionRL = response.CorrRL;
|
||||
IsQ2PreCorrectionCalculated = true;
|
||||
log.WarnFormat("Q2 corrections from a REST client are: LR = {0}, RL = {1}", CalculatedQ2PreCorrectionLR, CalculatedQ2PreCorrectionRL);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log.ErrorFormat("Failed to obtain Q2 corrections from a REST client");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("Failed to calculate Q2 corrections: {0}", exc.Message);
|
||||
log.ErrorFormat("Failed to obtain Q2 corrections from a REST client: {0}", exc.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.24.1391.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1391.0")]
|
||||
[assembly: AssemblyVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
|
||||
Generated
+2
-2
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.1008
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -12,7 +12,7 @@ namespace TBF.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
+9
-1
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TBF</RootNamespace>
|
||||
<AssemblyName>TBF</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
@@ -44,6 +44,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -54,6 +55,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -64,6 +66,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
@@ -74,6 +77,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>TBF.Program</StartupObject>
|
||||
@@ -3468,6 +3472,10 @@
|
||||
<Project>{0C0A1F4D-1363-4544-A7C5-196C76D26CCA}</Project>
|
||||
<Name>GraphLib</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\RestClient\RestClient.csproj">
|
||||
<Project>{46e3b0e1-209f-4550-b0dd-d7e2c039b3ce}</Project>
|
||||
<Name>RestClient</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TracingDB\TracingDB.csproj">
|
||||
<Project>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</Project>
|
||||
<Name>TracingDB</Name>
|
||||
|
||||
@@ -221,6 +221,8 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
TempLimHi,
|
||||
PressLimLo,
|
||||
PressLimHi,
|
||||
Publish,
|
||||
Evaluate,
|
||||
ColumnsCount
|
||||
}
|
||||
|
||||
@@ -237,6 +239,18 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
lv.Columns.Add(new ColumnHeader { Text = string.Format("{0} [°C]", Strings.Temp_lim_hi_chdr), Width = 100 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_lo_chdr, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Press_lim_hi_chdr, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Publish, Width = 80 });
|
||||
lv.Columns.Add(new ColumnHeader { Text = Strings.Evaluate, Width = 80 });
|
||||
|
||||
ComboBox publishCBox = new ComboBox(); /// control for Publish
|
||||
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
|
||||
{
|
||||
publishCBox.Items.Add(pb.ToDescription());
|
||||
}
|
||||
|
||||
ComboBox yesNoCBox = new ComboBox(); /// control for Evaluate
|
||||
yesNoCBox.Items.Add(Strings.yes);
|
||||
yesNoCBox.Items.Add(Strings.no);
|
||||
|
||||
metrologyEditors = new Control[]
|
||||
{
|
||||
@@ -250,6 +264,8 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
new TextBox(), /// Temp.Lim. +
|
||||
new TextBox(), /// Press.Lim. -
|
||||
new TextBox(), /// Press.Lim. +
|
||||
publishCBox, /// Publish
|
||||
yesNoCBox, /// Evaluate
|
||||
};
|
||||
|
||||
foreach (var ctrl in metrologyEditors)
|
||||
@@ -293,6 +309,8 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
lvi.SubItems.Add(pTest.TempLimHi.ToString());
|
||||
lvi.SubItems.Add(pTest.PressLimLo.ToString());
|
||||
lvi.SubItems.Add(pTest.PressLimHi.ToString());
|
||||
lvi.SubItems.Add(((Config.Entities.Publish)pTest.Publish).ToDescription());
|
||||
lvi.SubItems.Add(pTest.Evaluate ? Strings.yes : Strings.no);
|
||||
|
||||
metrologyListViewEx.Items.Add(lvi);
|
||||
}
|
||||
@@ -301,40 +319,57 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
for (int i = 0; i < metrologyListViewEx.Items.Count; i++)
|
||||
{
|
||||
ListViewItem lvi = metrologyListViewEx.Items[i];
|
||||
PTest entity = (PTest)lvi.Tag;
|
||||
try
|
||||
{
|
||||
ListViewItem lvi = metrologyListViewEx.Items[i];
|
||||
PTest entity = (PTest)lvi.Tag;
|
||||
|
||||
entity.Name = lvi.Text;
|
||||
entity.ItemNr = i;
|
||||
entity.Name = lvi.Text;
|
||||
entity.ItemNr = i;
|
||||
|
||||
int part = entity.Part;
|
||||
if (lvi.SubItems[(int)MtrlgyClmn.Part].Text.Equals("-"))
|
||||
{
|
||||
entity.Part = 0;
|
||||
}
|
||||
else if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Part].Text, out part))
|
||||
{
|
||||
entity.Part = part;
|
||||
}
|
||||
int part = entity.Part;
|
||||
if (lvi.SubItems[(int)MtrlgyClmn.Part].Text.Equals("-"))
|
||||
{
|
||||
entity.Part = 0;
|
||||
}
|
||||
else if (int.TryParse(lvi.SubItems[(int)MtrlgyClmn.Part].Text, out part))
|
||||
{
|
||||
entity.Part = part;
|
||||
}
|
||||
|
||||
double tmp;
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text, out tmp)) entity.CoefQfrom = tmp;
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text, out tmp)) entity.CoefQto = tmp;
|
||||
if (LoadedProfile.ProfileType != ProfileType.QpQi)
|
||||
{
|
||||
if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text, out tmp)) entity.ErrLimLo = tmp;
|
||||
if (Utils.TryParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text, out tmp)) entity.ErrLimHi = tmp;
|
||||
entity.CoefQfrom = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQfrom].Text);
|
||||
entity.CoefQto = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.CoefQto].Text);
|
||||
if (LoadedProfile.ProfileType != ProfileType.QpQi)
|
||||
{
|
||||
entity.ErrLimLo = Utils.ParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimLo].Text);
|
||||
entity.ErrLimHi = Utils.ParseSDouble(lvi.SubItems[(int)MtrlgyClmn.ErrLimHi].Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.ErrLimLo = +1.0;
|
||||
entity.ErrLimHi = -1.0;
|
||||
}
|
||||
entity.TempLimLo = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text);
|
||||
entity.TempLimHi = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text);
|
||||
entity.PressLimLo = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text);
|
||||
entity.PressLimHi = Utils.ParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text);
|
||||
|
||||
entity.Evaluate = lvi.SubItems[(int)MtrlgyClmn.Evaluate].Text.Equals(Strings.yes);
|
||||
|
||||
for (Config.Entities.Publish pb = 0; pb < Config.Entities.Publish.Count; pb++)
|
||||
{
|
||||
if (lvi.SubItems[(int)MtrlgyClmn.Publish].Text.Equals(pb.ToDescription()))
|
||||
{
|
||||
entity.Publish = (sbyte)pb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception exc)
|
||||
{
|
||||
entity.ErrLimLo = +1.0;
|
||||
entity.ErrLimHi = -1.0;
|
||||
MessageBox.Show(string.Format("Unexpected problem: {0}", exc.Message));
|
||||
}
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimLo].Text, out tmp)) entity.TempLimLo = tmp;
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.TempLimHi].Text, out tmp)) entity.TempLimHi = tmp;
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimLo].Text, out tmp)) entity.PressLimLo = tmp;
|
||||
if (Utils.TryParseUDouble(lvi.SubItems[(int)MtrlgyClmn.PressLimHi].Text, out tmp)) entity.PressLimHi = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void metrologyListViewEx_SubItemClicked(object sender, SubItemEventArgs e)
|
||||
@@ -416,6 +451,17 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
/// Combo boxes
|
||||
if ((e.SubItem == (int)MtrlgyClmn.Publish) || (e.SubItem == (int)MtrlgyClmn.Evaluate))
|
||||
{
|
||||
if (!(metrologyEditors[e.SubItem] as ComboBox).Items.Contains(e.DisplayText))
|
||||
{
|
||||
e.DisplayText = e.Item.SubItems[e.SubItem].Text;
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -566,8 +566,8 @@ namespace TBF.UI.Procedures
|
||||
test.Qto = (float)(Qtg * ptest.CoefQto);
|
||||
test.TempLimLo = (float)ptest.TempLimLo;
|
||||
test.TempLimHi = (float)ptest.TempLimHi;
|
||||
test.DoEvaluate = true;
|
||||
test.Publish = (sbyte)Publish.Always;
|
||||
test.Publish = ptest.Publish;
|
||||
test.DoEvaluate = ptest.Evaluate;
|
||||
|
||||
if (pt != ProfileType.QpQi)
|
||||
{
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace TBF.UI.Settings
|
||||
|
||||
log.ErrorFormat("Going to create an empty configuration database '{0}'", databaseName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName);
|
||||
Config.FluentCommon.CreateEmptyConfigDB(bench.ProceduresDBSettings.DbType, connectionString);
|
||||
log.ErrorFormat("An empty configuration database '{0}' was created", databaseName);
|
||||
|
||||
@@ -223,7 +223,7 @@ namespace TBF.UI.Settings
|
||||
|
||||
log.ErrorFormat("Going to create an empty results database '{0}'", databaseName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName);
|
||||
DB.DbType = bench.WaterMetersDBSettings.DbType;
|
||||
DB.ConnectionString = connectionString;
|
||||
DB.CreateEmptyDB();
|
||||
@@ -364,7 +364,7 @@ namespace TBF.UI.Settings
|
||||
|
||||
log.ErrorFormat("Going to import database '{0}' from file {1}", databaseName, inputFileName);
|
||||
ExecuteMySqlCmd(string.Format("DROP DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}`;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("CREATE DATABASE `{0}` CHARACTER SET utf8 COLLATE utf8_unicode_ci;", databaseName), userName);
|
||||
ExecuteMySqlCmd(string.Format("SOURCE {0}", inputFileName), userName, databaseName);
|
||||
log.ErrorFormat("Database {0} was imported from file {1}", databaseName, inputFileName);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TracingDB</RootNamespace>
|
||||
<AssemblyName>TracingDB</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -21,6 +22,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -29,6 +31,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.24.1368.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1368.0")]
|
||||
[assembly: AssemblyVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace UsersManagement.Properties {
|
||||
namespace UserManagement.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace UsersManagement.Properties {
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UsersManagement.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UserManagement.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
|
||||
+2
-2
@@ -8,11 +8,11 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace UsersManagement.Properties {
|
||||
namespace UserManagement.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UserManagement</RootNamespace>
|
||||
<AssemblyName>UserManagement</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
@@ -39,6 +39,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -48,6 +49,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>UserManagement.Program</StartupObject>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
|
||||
+11
-2
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,16 +11,25 @@ namespace Users.Entities
|
||||
{
|
||||
public virtual int Id { get; protected set; }
|
||||
public virtual GID GID { get; set; }
|
||||
public virtual long AccessFlags { get; set; } /// Bitfield of access flags: bit0 .. bit62
|
||||
public virtual IList<User> Users { get; set; } /// Group can be a member of a list of users
|
||||
|
||||
public Group()
|
||||
{
|
||||
}
|
||||
Users = new List<User>();
|
||||
}
|
||||
|
||||
public Group(GID gid)
|
||||
: this()
|
||||
{
|
||||
GID = gid;
|
||||
}
|
||||
|
||||
public virtual string Gid2Str()
|
||||
{
|
||||
return Group.Gid2Str(this.GID);
|
||||
}
|
||||
|
||||
public static string Gid2Str(GID gid)
|
||||
{
|
||||
switch (gid)
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Users.Entities
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ((groupId >= 0) && (groupId < GID.NrOfGroups) && (Groups != null))
|
||||
else if ((groupId >= 0) && (groupId < GID.NrOfGroups))
|
||||
{
|
||||
foreach (var g in Groups)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace Users.Entities
|
||||
|
||||
foreach (var gid in groupIds)
|
||||
{
|
||||
if (gid >= 0 && gid < GID.NrOfGroups)
|
||||
if ((gid >= 0) && (gid < GID.NrOfGroups))
|
||||
{
|
||||
/// for all group elements in User.Groups
|
||||
foreach (var grp in Groups)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Users.Forms
|
||||
{
|
||||
NHibernate.ISession session;
|
||||
User user;
|
||||
GID[] displayedGIDs;
|
||||
IList<Group> displayedGroups;
|
||||
|
||||
|
||||
bool[] oriGroupMember; /// index is gid, size is Grp.Count
|
||||
@@ -32,18 +32,18 @@ namespace Users.Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
this.toolTip1.SetToolTip(this.txtName, string.Format(Strings.max_0_alphanum_chars, 20));
|
||||
oriGroupMember = new bool[(displayedGIDs != null) ? displayedGIDs.Length : 0];
|
||||
oriGroupMember = new bool[(displayedGroups != null) ? displayedGroups.Count : 0];
|
||||
okBtn.Enabled = false;
|
||||
}
|
||||
|
||||
public EditSelectedUser(NHibernate.ISession session, User user, GID[] displayedGIDs)
|
||||
public EditSelectedUser(NHibernate.ISession session, User user, IList<Group> displayedGroups)
|
||||
: this()
|
||||
{
|
||||
this.session = session;
|
||||
this.user = user;
|
||||
this.displayedGIDs = displayedGIDs;
|
||||
this.displayedGroups = displayedGroups;
|
||||
|
||||
oriGroupMember = new bool[(displayedGIDs != null) ? displayedGIDs.Length : 0];
|
||||
oriGroupMember = new bool[(displayedGroups != null) ? displayedGroups.Count : 0];
|
||||
}
|
||||
|
||||
private void EditSelectedUser_Load(object sender, EventArgs e)
|
||||
@@ -124,12 +124,12 @@ namespace Users.Forms
|
||||
public void ShowGroups()
|
||||
{
|
||||
checkedListBoxGroups.Items.Clear();
|
||||
for (int i= 0; i < displayedGIDs.Length; i++)
|
||||
for (int i= 0; i < displayedGroups.Count; i++)
|
||||
{
|
||||
GID gid = displayedGIDs[i];
|
||||
Group group = displayedGroups[i];
|
||||
|
||||
bool boolIsMember = oriGroupMember[i] = user.IsMemberOf(gid);
|
||||
checkedListBoxGroups.Items.Add(Group.Gid2Str(gid));
|
||||
bool boolIsMember = oriGroupMember[i] = user.IsMemberOf(group.GID);
|
||||
checkedListBoxGroups.Items.Add(group.Gid2Str());
|
||||
checkedListBoxGroups.SetItemCheckState(i, boolIsMember ? CheckState.Checked : CheckState.Unchecked);
|
||||
}
|
||||
}
|
||||
@@ -189,30 +189,22 @@ namespace Users.Forms
|
||||
user.LastPwChange = DateTime.MinValue;
|
||||
}
|
||||
|
||||
///
|
||||
/// Groups
|
||||
///
|
||||
IList<Group> groups = user.Groups; /// = session.QueryOver<Group>().Where(x => (x.User.Id == user.Id)).List();
|
||||
for (int i = 0; i < displayedGIDs.Length; i++ )
|
||||
for (int i = 0; i < displayedGroups.Count; i++ )
|
||||
{
|
||||
GID gid = displayedGIDs[i];
|
||||
Group group = displayedGroups[i];
|
||||
bool newIsMember = checkedListBoxGroups.GetItemChecked(i);
|
||||
|
||||
if (!newIsMember && oriGroupMember[i])
|
||||
{
|
||||
for (int j = 0; j < user.Groups.Count; j++)
|
||||
{
|
||||
Group grp = user.Groups[j];
|
||||
if (grp.GID == gid)
|
||||
{
|
||||
session.Delete(user.Groups[j]);
|
||||
user.Groups.RemoveAt(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
user.Groups.Remove(group);
|
||||
}
|
||||
else if (newIsMember && !oriGroupMember[i])
|
||||
{
|
||||
Group newGroup = new Group(gid);
|
||||
user.Groups.Add(newGroup);
|
||||
user.Groups.Add(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,39 +26,7 @@ namespace Users.Forms
|
||||
const int NameSurnameColumn = 2;
|
||||
|
||||
|
||||
static GID[] DisplayedGIDs = new GID[]
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
|
||||
GID.Testers,
|
||||
GID.TestingSpecialists,
|
||||
GID.HeadOfLab,
|
||||
GID.MaintenanceSpecialists,
|
||||
GID.Metrologists,
|
||||
GID.CalibrationSpecialists,
|
||||
GID.Administrators,
|
||||
GID.TraceabilityManagement,
|
||||
#elif KEMPNO_50 || KRAKOW_50 || TORUN_50 || WARSAW_END
|
||||
GID.Testers,
|
||||
GID.TestingSpecialists,
|
||||
GID.HeadOfLab,
|
||||
GID.MaintenanceSpecialists,
|
||||
GID.Metrologists,
|
||||
GID.CalibrationSpecialists,
|
||||
GID.Administrators,
|
||||
GID.MetrologicalAuthority,
|
||||
GID.WaterMeterAuthority,
|
||||
#else
|
||||
GID.Testers,
|
||||
GID.TestingSpecialists,
|
||||
GID.HeadOfLab,
|
||||
GID.MaintenanceSpecialists,
|
||||
GID.Metrologists,
|
||||
GID.CalibrationSpecialists,
|
||||
GID.Administrators,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
IList<Group> displayedGroups;
|
||||
public string TitleExtension;
|
||||
|
||||
|
||||
@@ -77,6 +45,17 @@ namespace Users.Forms
|
||||
this.session = session;
|
||||
this.showExtensions = showLocalExtensions;
|
||||
if (showLocalExtensions) copyFromRemoteButton.Visible = true;
|
||||
|
||||
try
|
||||
{
|
||||
displayedGroups = session.QueryOver<Group>().List();
|
||||
listOfUsers = session.QueryOver<User>().List();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (displayedGroups == null) displayedGroups = new List<Group>();
|
||||
if (listOfUsers == null) listOfUsers = new List<User>();
|
||||
}
|
||||
}
|
||||
|
||||
private void UserManagementDlg_Load(object sender, EventArgs e)
|
||||
@@ -97,47 +76,35 @@ namespace Users.Forms
|
||||
listViewUsers.Columns.Add(Strings.Tag, 110);
|
||||
listViewUsers.Columns.Add(Strings.Groups, 370);
|
||||
|
||||
try
|
||||
{
|
||||
listOfUsers = session.QueryOver<User>().List();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string msg = exc.Message;
|
||||
}
|
||||
|
||||
ListUsers();
|
||||
}
|
||||
|
||||
public void ListUsers()
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
listViewUsers.Items.Clear();
|
||||
foreach (User u in listOfUsers)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(u.UserName);
|
||||
item.Tag = u;
|
||||
item.SubItems.Add(u.Number.ToString());
|
||||
item.SubItems.Add(u.FullName);
|
||||
item.SubItems.Add(string.IsNullOrEmpty(u.Tag) ? string.Empty : u.Tag);
|
||||
|
||||
/// Show groups of this user
|
||||
string grps = string.Empty;
|
||||
///
|
||||
foreach (var gid in DisplayedGIDs)
|
||||
foreach (var group in displayedGroups)
|
||||
{
|
||||
if (u.IsMemberOf(gid))
|
||||
if (u.IsMemberOf(group.GID))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(grps)) grps += ", ";
|
||||
grps += Group.Gid2Str(gid);
|
||||
grps += group.Gid2Str();
|
||||
}
|
||||
}
|
||||
|
||||
ListViewItem item = new ListViewItem(u.UserName);
|
||||
item.SubItems.Add(u.Number.ToString());
|
||||
item.SubItems.Add(u.FullName);
|
||||
item.SubItems.Add(string.IsNullOrEmpty(u.Tag) ? string.Empty : u.Tag);
|
||||
item.SubItems.Add(grps);
|
||||
item.Tag = u;
|
||||
|
||||
this.listViewUsers.Items.Add(item);
|
||||
}
|
||||
this.listViewUsers.Refresh();
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
private void closeButton_Click(object sender, EventArgs e)
|
||||
@@ -209,7 +176,7 @@ namespace Users.Forms
|
||||
{
|
||||
if (listViewUsers.SelectedItems.Count == 1 && listViewUsers.SelectedItems[0].Tag is User)
|
||||
{
|
||||
new Forms.EditSelectedUser(session, (User)listViewUsers.SelectedItems[0].Tag, DisplayedGIDs).ShowDialog();
|
||||
new Forms.EditSelectedUser(session, (User)listViewUsers.SelectedItems[0].Tag, displayedGroups).ShowDialog();
|
||||
ListUsers();
|
||||
}
|
||||
}
|
||||
@@ -222,7 +189,7 @@ namespace Users.Forms
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
User newUser = new User();
|
||||
if (new Forms.EditSelectedUser(session, newUser, DisplayedGIDs).ShowDialog() == DialogResult.OK)
|
||||
if (new Forms.EditSelectedUser(session, newUser, displayedGroups).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
listOfUsers.Add(newUser);
|
||||
}
|
||||
@@ -233,10 +200,10 @@ namespace Users.Forms
|
||||
{
|
||||
if (listViewUsers.SelectedItems.Count == 1 && listViewUsers.SelectedItems[0].Tag is User)
|
||||
{
|
||||
User Selecteduser = listViewUsers.SelectedItems[0].Tag as User;
|
||||
session.Delete(Selecteduser);
|
||||
User selecteduser = session.Get<User>((listViewUsers.SelectedItems[0].Tag as User).Id);
|
||||
session.Delete(selecteduser);
|
||||
session.Flush();
|
||||
listOfUsers.Remove(Selecteduser);
|
||||
listOfUsers.RemoveAt(listViewUsers.SelectedIndices[0]);
|
||||
ListUsers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -7,10 +7,18 @@ namespace Users.Mappings
|
||||
{
|
||||
class GroupMap : ClassMap<Entities.Group>
|
||||
{
|
||||
/// <seealso>
|
||||
/// https://stackoverflow.com/questions/9108083/fluent-nhibernate-many-to-many-mapping-way/9125059
|
||||
/// </seealso>
|
||||
public GroupMap()
|
||||
{
|
||||
Id(x => x.Id);
|
||||
Map(x => x.GID).Column("Name"); ;
|
||||
Map(x => x.GID).Column("Name");
|
||||
Map(x => x.AccessFlags);
|
||||
HasManyToMany(x => x.Users)
|
||||
.Cascade.SaveUpdate()
|
||||
.Inverse()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
@@ -19,8 +19,9 @@ namespace Users.Mappings
|
||||
Map(x => x.Password4);
|
||||
Map(x => x.FullName).Column("Description");
|
||||
Map(x => x.LastPwChange);
|
||||
HasMany(x => x.Groups)
|
||||
.Cascade.All();
|
||||
HasManyToMany(x => x.Groups)
|
||||
.Cascade.SaveUpdate()
|
||||
.Table("UsersGroups");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.24.1382.0")]
|
||||
[assembly: AssemblyFileVersion("2.24.1382.0")]
|
||||
[assembly: AssemblyVersion("2.25.1400.0")]
|
||||
[assembly: AssemblyFileVersion("2.25.1400.0")]
|
||||
|
||||
+4
-1
@@ -10,8 +10,9 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Users</RootNamespace>
|
||||
<AssemblyName>Users</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -21,6 +22,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -29,6 +31,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate">
|
||||
|
||||
@@ -14,6 +14,8 @@ rmdir /s /q GraphLib\bin
|
||||
rmdir /s /q GraphLib\obj
|
||||
rmdir /s /q TracingDB\bin
|
||||
rmdir /s /q TracingDB\obj
|
||||
rmdir /s /q RestClient\bin
|
||||
rmdir /s /q RestClient\obj
|
||||
rmdir /s /q Results\bin
|
||||
rmdir /s /q Results\obj
|
||||
rmdir /s /q ResultsBrowser\bin
|
||||
@@ -28,4 +30,3 @@ rmdir /s /q Users\bin
|
||||
rmdir /s /q Users\obj
|
||||
rmdir /s /q UserManagement\bin
|
||||
rmdir /s /q UserManagement\obj
|
||||
|
||||
BIN
Binary file not shown.
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+8920
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+10860
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user