manual merge DEV_Shupping->main-Part 1: - RegsiterRestorer, - RegisterConverter, - ClassAccess,- UserAccessCtrl
This commit is contained in:
@@ -14,4 +14,4 @@ using System.Reflection;
|
||||
//[assembly: AssemblyVersion("1.2.*.0")]
|
||||
|
||||
|
||||
[assembly: AssemblyVersion("2.6.12.*")]
|
||||
[assembly: AssemblyVersion("2.6.13.*")]
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
{
|
||||
new RecoveryRegisterItem("LOGGER_TriggerLogFlush", new Byte[] { 0x01 }),
|
||||
// set counter to 0 as this is a value how often the radio detected a reset
|
||||
new RecoveryRegisterItem("PERIODICLOG_ResetCounter", new Byte[] { 0x00 }),
|
||||
new RecoveryRegisterItem("SENSUSRADIO_ResetCounter", new Byte[] { 0x00 }),
|
||||
// trigger idle 0 releases the display to normal operation
|
||||
new RecoveryRegisterItem("GENESISFLOW_TriggerIdle", new Byte[] { 0x00 })
|
||||
};
|
||||
@@ -165,6 +165,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
new RecoveryRegisterItem("SENSUSRADIO_SystemState", new Byte[] { 0xFF }),
|
||||
// seal the display to lock against changes
|
||||
new RecoveryRegisterItem("GENESISFLOW_SealDisplay", new Byte[] { 0x01 }),
|
||||
// set counter to 0 as this is a value how often the radio detected a reset
|
||||
new RecoveryRegisterItem("PERIODICLOG_ResetCounter", new Byte[] { 0x00 }),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -722,7 +724,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <remarks date="2025-Feb-14" author="Thomas Wiedebusch">
|
||||
/// - Exported write routines to <see cref="WriteRegisterParameterSet"/>.
|
||||
/// </remarks>
|
||||
public StatusReturn WriteRegisters(List<RecoveryRegisterItem> recoveryRegistersDb, Boolean eolProgramming = false)
|
||||
private StatusReturn WriteRegisters(List<RecoveryRegisterItem> recoveryRegistersDb, Boolean eolProgramming = false)
|
||||
{
|
||||
if (_currentGenesis == null ||
|
||||
string.IsNullOrEmpty(_currentGenesis.PcbId) ||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -433,8 +433,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
|
||||
/// and the given offset in seconds.
|
||||
/// - String removed from first zero in string until the end to avoid ghost signs!
|
||||
/// </remarks>
|
||||
/// <remarks date="2025-Mar-31" author="Thomas Wiedebusch/Roland Drabesch">
|
||||
/// - Return default (T) on input == null;
|
||||
/// </remarks>
|
||||
public static T ByteArrayToValue<T>(Byte[] rawByteArray)
|
||||
{
|
||||
if (rawByteArray == null)
|
||||
return default(T);
|
||||
|
||||
try
|
||||
{
|
||||
Object convertedObj;
|
||||
|
||||
@@ -0,0 +1,555 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
|
||||
|
||||
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper to convert genesis register values store in bytes to data types and back
|
||||
/// </summary>
|
||||
public static class RegisterConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Convert single register from Genesis and return a message of the result. The value input is a byte array
|
||||
/// with the LSB at the index 0 and the MSB at the highest index. A string is sorted with the first character
|
||||
/// at index 0, this does not need to be reversed as it is readable by default.
|
||||
/// The raw value is swapped byte-wise to get a human-readable value with MSB at leftmost and LSB at rightmost.
|
||||
/// The message contains the register name, the swapped raw value and on the converted value.
|
||||
/// </summary>
|
||||
/// <param name="registerDefinition"></param>
|
||||
/// <param name="regRawByteArray">the raw byte array is always % 4 0 padded for unused elements, the LSB is
|
||||
/// on index 0 (little endian, LSB first)</param>
|
||||
/// <returns>message with register name, swapped raw value and converted value</returns>
|
||||
/// <remarks date="2023-Jul-19" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Sep-05" author="Thomas Wiedebusch">
|
||||
/// - Reworked.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Sep-27" author="Thomas Wiedebusch">
|
||||
/// - Avoid logging of encryption key.
|
||||
/// </remarks>
|
||||
/// <remarks date="2024-Mar-20" author="Thomas Wiedebusch">
|
||||
/// - Hash password and encryption key with SHA256.
|
||||
/// </remarks>
|
||||
public static String GetRegisterContentText(RegisterDefinition registerDefinition, Byte[] regRawByteArray)
|
||||
{
|
||||
String msg;
|
||||
String registerName = "?";
|
||||
try
|
||||
{
|
||||
registerName = registerDefinition.GetIdent();
|
||||
// getting a result value as text of the data type e.g. UInt32
|
||||
var strValue = ConvertToText(regRawByteArray, registerDefinition.DataType);
|
||||
// remove non-printable char of the converted result
|
||||
var strValueResult = Regex.Replace(strValue, @"\p{C}+", string.Empty);
|
||||
|
||||
// use hashed output being able to compare written and read back values
|
||||
String strRawResult;
|
||||
if (registerName.Contains("EncryptionKey") || registerName.Contains("Password"))
|
||||
{
|
||||
strRawResult = GetRegisterRawText(registerDefinition, regRawByteArray, encryptData:true);
|
||||
msg = $"{registerName}: ({strRawResult})h";
|
||||
}
|
||||
else
|
||||
{
|
||||
strRawResult = GetRegisterRawText(registerDefinition, regRawByteArray);
|
||||
msg = $"{registerName}: ({strRawResult})h ({strValueResult})";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ApplicationException($"Cannot convert register {registerName}");
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert single register from Genesis and return a message of the result. The value input is a byte array
|
||||
/// with the LSB at the index 0 and the MSB at the highest index. A string is sorted with the first character
|
||||
/// at index 0, this does not need to be reversed as it is readable by default.
|
||||
/// The raw value is swapped byte-wise to get a human-readable value with MSB at leftmost and LSB at rightmost.
|
||||
/// The message contains the swapped raw value.
|
||||
/// </summary>
|
||||
/// <param name="registerDefinition"></param>
|
||||
/// <param name="regRawByteArray">the raw byte array is always % 4 0 padded for unused elements, the LSB is
|
||||
/// on index 0 (little endian, LSB first)</param>
|
||||
/// <param name="encryptData">data encryption for data required SHA256 hash instead of clear text</param>
|
||||
/// <returns>message with swapped raw value</returns>
|
||||
/// <remarks date="2023-Sep-05" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
/// <remarks date="2024-Mar-20" author="Thomas Wiedebusch">
|
||||
/// - Hash password and encryption key with SHA256.
|
||||
/// </remarks>
|
||||
public static String GetRegisterRawText(RegisterDefinition registerDefinition, Byte[] regRawByteArray,
|
||||
Boolean encryptData = false)
|
||||
{
|
||||
String msg;
|
||||
var strRawResult = "?";
|
||||
try
|
||||
{
|
||||
// inverse the raw value to get a readable byte order MSB left and LSB last right position
|
||||
var tmpList = regRawByteArray.ToList();
|
||||
|
||||
// reverse the list if it is not a string or the UInt48, UInt72, UInt88,UInt96 or UInt128 which
|
||||
// will be used as placeholder for a string
|
||||
if (registerDefinition.DataType != typeof(String) &&
|
||||
registerDefinition.DataType != typeof(UInt48) &&
|
||||
registerDefinition.DataType != typeof(UInt72) &&
|
||||
registerDefinition.DataType != typeof(UInt88) &&
|
||||
registerDefinition.DataType != typeof(UInt96) &&
|
||||
registerDefinition.DataType != typeof(UInt128))
|
||||
{
|
||||
tmpList.Reverse();
|
||||
}
|
||||
|
||||
// use hashed output being able to compare written and read back values
|
||||
if (encryptData)
|
||||
{
|
||||
var hash = SHA256.Create().ComputeHash(regRawByteArray);
|
||||
strRawResult = BitConverter.ToString(hash.ToArray());
|
||||
msg = $"SHA256 - {strRawResult}";
|
||||
}
|
||||
else
|
||||
{
|
||||
strRawResult = BitConverter.ToString(tmpList.ToArray());
|
||||
msg = $"{strRawResult}";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
msg = $"{strRawResult}";
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Preset the raw byte array with the default value.
|
||||
/// </summary>
|
||||
/// <param name="registerDefinition"></param>
|
||||
/// <param name="regRawByteArray"></param>
|
||||
/// <returns>true if value could be set</returns>
|
||||
/// <remarks date="2023-Sep-05" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean SetToDefault(RegisterDefinition registerDefinition, out Byte[] regRawByteArray)
|
||||
{
|
||||
if (registerDefinition.Default.HasValue)
|
||||
{
|
||||
// will always return an Int64 value Byte[8] !
|
||||
regRawByteArray = ValueToByteArray(registerDefinition.Default);
|
||||
return true;
|
||||
}
|
||||
|
||||
regRawByteArray = new Byte[] {0};
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a value (T) into byte[]
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to convert from</typeparam>
|
||||
/// <param name="value">value to convert</param>
|
||||
/// <returns>byte[] like it store in genesis meter</returns>
|
||||
/// <remarks date="????" author="Roland Drabesch">
|
||||
/// - Init.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Jul-19" author="Thomas Wiedebusch">
|
||||
/// - Used <see cref="TimeT"/> to calculate time in UTC based on 01. Jan 2000
|
||||
/// and the given offset in seconds.
|
||||
/// </remarks>
|
||||
public static Byte[] ValueToByteArray<T>(T value)
|
||||
{
|
||||
var converted = new Byte[] { 0 };
|
||||
if (value == null)
|
||||
return converted;
|
||||
|
||||
if (value.GetType() == typeof(TimeT))
|
||||
{
|
||||
var teaTime = value as TimeT;
|
||||
if (teaTime != null)
|
||||
{
|
||||
// the value contains always the seconds since 01.Jan 2000
|
||||
var intValue = Convert.ToInt32(teaTime.SecondsSince2000);
|
||||
return BitConverter.GetBytes(intValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (value is Boolean)
|
||||
{
|
||||
var tmp = Convert.ToBoolean(value);
|
||||
return BitConverter.GetBytes(tmp);
|
||||
}
|
||||
|
||||
if (value is UInt16)
|
||||
{
|
||||
var tmp = Convert.ToUInt16(value);
|
||||
return BitConverter.GetBytes(tmp);
|
||||
}
|
||||
|
||||
if (value is UInt32)
|
||||
{
|
||||
var tmp = Convert.ToUInt32(value);
|
||||
return BitConverter.GetBytes(tmp);
|
||||
}
|
||||
|
||||
if (value is UInt64)
|
||||
{
|
||||
var tmp = Convert.ToUInt64(value);
|
||||
return BitConverter.GetBytes(tmp);
|
||||
}
|
||||
|
||||
if (value is Int16)
|
||||
{
|
||||
var intValue = Convert.ToInt16(value);
|
||||
return BitConverter.GetBytes(intValue);
|
||||
}
|
||||
|
||||
if (value is Int32)
|
||||
{
|
||||
var intValue = Convert.ToInt32(value);
|
||||
return BitConverter.GetBytes(intValue);
|
||||
}
|
||||
|
||||
if (value is Int64)
|
||||
{
|
||||
var tmp = Convert.ToInt64(value);
|
||||
return BitConverter.GetBytes(tmp);
|
||||
}
|
||||
|
||||
if (value is String)
|
||||
{
|
||||
return Encoding.ASCII.GetBytes(value.ToString());
|
||||
}
|
||||
|
||||
if (value is Byte || value is Enum8)
|
||||
{
|
||||
converted[0] = Convert.ToByte(value);
|
||||
}
|
||||
else if (value is SByte)
|
||||
{
|
||||
return BitConverter.GetBytes(Convert.ToSByte(value));
|
||||
}
|
||||
|
||||
else if (value is Byte[])
|
||||
{
|
||||
return (Byte[])Convert.ChangeType(value, typeof(Byte[]));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException($"Data type {typeof(T)} not implemented");
|
||||
}
|
||||
|
||||
return converted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get size of type
|
||||
/// </summary>
|
||||
/// <param name="registerDefinition"></param>
|
||||
/// <returns>size in bytes</returns>
|
||||
/// <remarks date="2023-Sep-05" author="Thomas Wiedebusch">
|
||||
/// - Init.
|
||||
/// </remarks>
|
||||
public static Int32 SizeOf(RegisterDefinition registerDefinition)
|
||||
{
|
||||
var size = 4;
|
||||
|
||||
if (registerDefinition.DataType == typeof(Boolean))
|
||||
{
|
||||
size = sizeof(Boolean);
|
||||
}
|
||||
if (registerDefinition.DataType == typeof(Byte) ||
|
||||
registerDefinition.DataType == typeof(SByte) ||
|
||||
registerDefinition.DataType == typeof(Char) ||
|
||||
registerDefinition.DataType == typeof(Enum8))
|
||||
{
|
||||
size = sizeof(Byte);
|
||||
}
|
||||
else if (registerDefinition.DataType == typeof(Int16) ||
|
||||
registerDefinition.DataType == typeof(UInt16))
|
||||
{
|
||||
size = sizeof(Int16);
|
||||
}
|
||||
else if (registerDefinition.DataType == typeof(Int32) ||
|
||||
registerDefinition.DataType == typeof(UInt32) ||
|
||||
registerDefinition.DataType == typeof(TimeT))
|
||||
{
|
||||
size = sizeof(Int32);
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(Int64) ||
|
||||
registerDefinition.DataType == typeof(UInt64))
|
||||
{
|
||||
size = sizeof(Int64);
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(UInt48))
|
||||
{
|
||||
// 48 Bits / 8 Bits/Byte
|
||||
size = 6;
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(UInt72))
|
||||
{
|
||||
// 72 Bits / 8 Bits/Byte
|
||||
size = 9;
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(UInt88))
|
||||
{
|
||||
// 88 Bits / 8 Bits/Byte
|
||||
size = 11;
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(UInt96))
|
||||
{
|
||||
// 96 Bits / 8 Bits/Byte
|
||||
size = 3 * 4;
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(UInt128))
|
||||
{
|
||||
// 128 Bits / 8 Bits/Byte
|
||||
size = 4 * 4;
|
||||
}
|
||||
|
||||
else if (registerDefinition.DataType == typeof(String))
|
||||
{
|
||||
// just some value
|
||||
size = 6 * 4;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build the result of the array as text.
|
||||
/// </summary>
|
||||
/// <param name="rawByteArray">byte value for conversion</param>
|
||||
/// <param name="type">type of the result</param>
|
||||
/// <returns></returns>
|
||||
/// <remarks date="????" author="Roland Drabesch">
|
||||
/// - Init.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Jul-19" author="Thomas Wiedebusch">
|
||||
/// - Used <see cref="TimeT"/> to calculate time in UTC based on 01. Jan 2000
|
||||
/// and the given offset in seconds.
|
||||
/// </remarks>
|
||||
public static String ConvertToText(Byte[] rawByteArray, Type type)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (type == typeof(Boolean))
|
||||
{
|
||||
return ByteArrayToValue<Boolean>(rawByteArray).ToString();
|
||||
}
|
||||
|
||||
if (type == typeof(TimeT))
|
||||
{
|
||||
var teaTime = ByteArrayToValue<TimeT>(rawByteArray);
|
||||
return teaTime.ToString();
|
||||
}
|
||||
if (type == typeof(UInt16))
|
||||
{
|
||||
return ByteArrayToValue<UInt16>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(UInt32))
|
||||
{
|
||||
return ByteArrayToValue<UInt32>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(UInt64))
|
||||
{
|
||||
return ByteArrayToValue<UInt64>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(Int16))
|
||||
{
|
||||
return ByteArrayToValue<Int16>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(Int32))
|
||||
{
|
||||
return ByteArrayToValue<Int32>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(Int64))
|
||||
{
|
||||
return ByteArrayToValue<Int64>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(Byte) || type == typeof(Enum8))
|
||||
{
|
||||
return ByteArrayToValue<Byte>(rawByteArray).ToString();
|
||||
}
|
||||
if (type == typeof(UInt48))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (type == typeof(UInt72))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (type == typeof(UInt88))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (type == typeof(UInt96))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (type == typeof(UInt128))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
if (type == typeof(SByte))
|
||||
{
|
||||
return ByteArrayToValue<SByte>(rawByteArray).ToString();
|
||||
}
|
||||
|
||||
return ByteArrayToValue<String>(rawByteArray);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// convert form byte (meter) to data type
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to cast in</typeparam>
|
||||
/// <param name="rawByteArray">byte value for conversion</param>
|
||||
/// <returns>converted value</returns>
|
||||
/// <remarks date="????" author="Roland Drabesch">
|
||||
/// - Init.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Jul-19" author="Thomas Wiedebusch">
|
||||
/// - Used <see cref="TimeT"/> to calculate time in UTC based on 01. Jan 2000
|
||||
/// and the given offset in seconds.
|
||||
/// - String removed from first zero in string until the end to avoid ghost signs!
|
||||
/// </remarks>
|
||||
public static T ByteArrayToValue<T>(Byte[] rawByteArray)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object convertedObj;
|
||||
var type = typeof(T);
|
||||
|
||||
if (type == typeof(Boolean))
|
||||
{
|
||||
convertedObj = BitConverter.ToBoolean(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(UInt16))
|
||||
{
|
||||
convertedObj = BitConverter.ToUInt16(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(UInt32))
|
||||
{
|
||||
convertedObj = BitConverter.ToUInt32(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(UInt64))
|
||||
{
|
||||
convertedObj = BitConverter.ToUInt64(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(UInt48))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
else if (type == typeof(UInt72))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
else if (type == typeof(UInt88))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
else if (type == typeof(UInt96))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
else if (type == typeof(UInt128))
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
else if (type == typeof(Int16))
|
||||
{
|
||||
convertedObj = BitConverter.ToInt16(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(Int32))
|
||||
{
|
||||
convertedObj = BitConverter.ToInt32(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(Int64))
|
||||
{
|
||||
convertedObj = BitConverter.ToInt64(rawByteArray, 0);
|
||||
}
|
||||
else if (type == typeof(Byte) || type == typeof(Enum8))
|
||||
{
|
||||
convertedObj = rawByteArray[0];
|
||||
}
|
||||
else if (type == typeof(SByte))
|
||||
{
|
||||
// set all others to 0 as only the LSB is of interest
|
||||
for (var idx = 1; idx < rawByteArray.Length; idx++)
|
||||
rawByteArray[idx] = 0;
|
||||
convertedObj = Convert.ToSByte((SByte)rawByteArray[0]);
|
||||
}
|
||||
else if (type == typeof(Boolean))
|
||||
{
|
||||
convertedObj = Convert.ToBoolean(rawByteArray[0]);
|
||||
}
|
||||
else if (type == typeof(String))
|
||||
{
|
||||
// the value may contain zeros at the beginning of the value-record, these have to be removed
|
||||
var zeroPaddingCounter = 0;
|
||||
while (rawByteArray.Length > zeroPaddingCounter && rawByteArray[zeroPaddingCounter] == 0)
|
||||
zeroPaddingCounter += 1;
|
||||
var trimmedValue = new Byte[rawByteArray.Length - zeroPaddingCounter];
|
||||
Int32 i;
|
||||
for (i = 0; i < rawByteArray.Length - zeroPaddingCounter; i++)
|
||||
trimmedValue[i] = rawByteArray[i + zeroPaddingCounter];
|
||||
|
||||
// as a string is terminated with a zero all following elements after including the initial
|
||||
// zero have to be removed. This is caused due to the 4 byte chunks which will be sent.
|
||||
var validCharCtr = 0;
|
||||
// find the first zero in the trimmed value array
|
||||
while (trimmedValue.Length > validCharCtr && trimmedValue[validCharCtr] != 0)
|
||||
validCharCtr += 1;
|
||||
// reserve space for valid chr plus the trailing 0 which will be added if
|
||||
var rawResult = new Byte[validCharCtr + 1];
|
||||
for (i = 0; i < validCharCtr; i++)
|
||||
rawResult[i] = trimmedValue[i];
|
||||
if (validCharCtr < trimmedValue.Length)
|
||||
{
|
||||
rawResult[i] = 0;
|
||||
convertedObj = Encoding.ASCII.GetString(rawResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
convertedObj = Encoding.ASCII.GetString(trimmedValue);
|
||||
}
|
||||
}
|
||||
else if (type == typeof(TimeT))
|
||||
{
|
||||
// the value contains always the seconds since 01.Jan 2000
|
||||
convertedObj = new TimeT { SecondsSince2000 = ByteArrayToValue<Int32>(rawByteArray) };
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ApplicationException($"Data type {type} not implemented");
|
||||
}
|
||||
|
||||
return (T)Convert.ChangeType(convertedObj, type);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Xylem.Common.Utils.ClassAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Access to private methods of any class by System.Reflection
|
||||
/// </summary>
|
||||
public static class ClassAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// Access private or public methods by name
|
||||
/// </summary>
|
||||
/// <typeparam name="TInstance"></typeparam>
|
||||
/// <typeparam name="TReturn"></typeparam>
|
||||
/// <param name="classInstance">class reference</param>
|
||||
/// <param name="methodName">method in class</param>
|
||||
/// <param name="parameters">optional parameters</param>
|
||||
/// <param name="isPrivateMethod"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks date="2024-11-07" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static TReturn CallMethode<TInstance, TReturn>(TInstance classInstance, String methodName,
|
||||
Object[] parameters = null, Boolean isPrivateMethod = false)
|
||||
{
|
||||
var type = classInstance.GetType();
|
||||
BindingFlags bindingFlags;
|
||||
if (isPrivateMethod)
|
||||
{
|
||||
bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
bindingFlags = BindingFlags.Public | BindingFlags.Instance;
|
||||
}
|
||||
var method = type.GetMethod(methodName, bindingFlags);
|
||||
|
||||
if (method != null)
|
||||
{
|
||||
return (TReturn)method.Invoke(classInstance, parameters);
|
||||
}
|
||||
|
||||
return default(TReturn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Getting the value of a property referenced by the name
|
||||
/// </summary>
|
||||
/// <typeparam name="TType"></typeparam>
|
||||
/// <typeparam name="TObj"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="propertyName"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns>false if property cannot be found or accessed</returns>
|
||||
/// <remarks date="2024-11-07" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean GetPropertyValue<TType, TObj>(TObj obj, String propertyName, out TType value)
|
||||
{
|
||||
value = default(TType);
|
||||
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
var property = typeof(TObj).GetProperty(propertyName);
|
||||
if (property is null)
|
||||
return false;
|
||||
|
||||
value = (TType)property.GetValue(obj, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting the value of a property referenced by the name
|
||||
/// </summary>
|
||||
/// <typeparam name="TType"></typeparam>
|
||||
/// <typeparam name="TObj"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="propertyName"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns>false if property cannot be found or accessed</returns>
|
||||
/// <remarks date="2024-11-07" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean SetPropertyValue<TType, TObj>(TObj obj, String propertyName, TType value)
|
||||
{
|
||||
if (value == null || obj == null)
|
||||
return false;
|
||||
|
||||
var property = typeof(TObj).GetProperty(propertyName);
|
||||
if (property is null || !property.CanWrite)
|
||||
return false;
|
||||
property.SetValue(obj, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy all properties.
|
||||
/// </summary>
|
||||
/// <typeparam name="TObj"></typeparam>
|
||||
/// <param name="destination"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns>false if property cannot be found or accessed</returns>
|
||||
/// <remarks date="2024-11-07" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public static Boolean CopyAllProperties<TObj>(TObj destination, TObj source)
|
||||
{
|
||||
var type = typeof(TObj);
|
||||
foreach (var prop in type.GetProperties())
|
||||
{
|
||||
if (prop.CanWrite)
|
||||
prop.SetValue(destination, prop.GetValue(source, null), null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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>{30BF7357-0B6C-498D-8123-5AACC66B3E5F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Xylem.Common.Utils.ClassAccess</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.Utils.ClassAccess</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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="ClassAccess.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<ProjectConfiguration>
|
||||
<Settings>
|
||||
<HiddenComponentWarnings />
|
||||
<IgnoredTests>
|
||||
<AllTestsSelector />
|
||||
</IgnoredTests>
|
||||
</Settings>
|
||||
</ProjectConfiguration>
|
||||
@@ -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("Xylem.Common.Utils.ClassAccess")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[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(true)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("30bf7357-0b6c-498d-8123-5aacc66b3e5f")]
|
||||
|
||||
// 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,29 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class ADLoginModel
|
||||
{
|
||||
public String Assembly { get; set; }
|
||||
|
||||
public Int32 MajorV { get; set; }
|
||||
|
||||
public Int32 MinorV { get; set; }
|
||||
|
||||
public Int32 BuildV { get; set; }
|
||||
|
||||
public Int32 EmployeeId { get; set; }
|
||||
|
||||
public String FirstName { get; set; }
|
||||
|
||||
public String LastName { get; set; }
|
||||
|
||||
public String Username { get; set; }
|
||||
|
||||
public String Phone { get; set; }
|
||||
|
||||
public String Email { get; set; }
|
||||
|
||||
public String DomainName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class ApplicationHttp
|
||||
{
|
||||
const String APPLICATION_JSON = "application/json";
|
||||
|
||||
private static readonly HttpClient httpClient = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri(ServiceUrls.LaaProductionAPI)
|
||||
};
|
||||
|
||||
internal static Int32 ApplicationId(String software, params String[] functions)
|
||||
=> Task
|
||||
.Run(async () =>
|
||||
{
|
||||
var applicationId = default(Int32);
|
||||
|
||||
try
|
||||
{
|
||||
using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, "/LaaProductionWeb/api/software/appid"))
|
||||
{
|
||||
httpRequestMessage.Content = new StringContent(
|
||||
mediaType: APPLICATION_JSON,
|
||||
encoding: Encoding.UTF8,
|
||||
content: JsonConvert.SerializeObject(new
|
||||
{
|
||||
windowsUser = Environment.UserName,
|
||||
software,
|
||||
functions
|
||||
}));
|
||||
|
||||
using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage))
|
||||
{
|
||||
if (httpResponseMessage.Content != null)
|
||||
{
|
||||
var httpResponseContent = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
|
||||
_ = int.TryParse(httpResponseContent, out applicationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// TODO: Log the error message.
|
||||
}
|
||||
|
||||
return applicationId;
|
||||
})
|
||||
.ConfigureAwait(true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
internal static IEnumerable<T> GetSoftwareFunction<T>(Int32 appId, String username, String password)
|
||||
=> Task
|
||||
.Run(async () =>
|
||||
{
|
||||
var functions = default(IEnumerable<T>);
|
||||
|
||||
try
|
||||
{
|
||||
using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, "/LaaProductionWeb/api/software/functions"))
|
||||
{
|
||||
httpRequestMessage.Content = new StringContent(
|
||||
mediaType: APPLICATION_JSON,
|
||||
encoding: Encoding.UTF8,
|
||||
content: JsonConvert.SerializeObject(new
|
||||
{
|
||||
appId,
|
||||
username,
|
||||
password,
|
||||
windowsUser = Environment.UserName,
|
||||
}));
|
||||
|
||||
using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage))
|
||||
{
|
||||
if (httpResponseMessage.IsSuccessStatusCode && httpResponseMessage.Content != null)
|
||||
{
|
||||
var httpResponseContent = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||
|
||||
functions = JsonConvert.DeserializeObject<T[]>(httpResponseContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// TODO: Log the error message.
|
||||
}
|
||||
|
||||
return functions;
|
||||
})
|
||||
.ConfigureAwait(true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
internal static void LogAction(String buttonText, String buttonTag, String user, Int32 appId)
|
||||
=> Task
|
||||
.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, "/LaaProductionWeb/api/software/functions"))
|
||||
{
|
||||
httpRequestMessage.Content = new StringContent(
|
||||
mediaType: APPLICATION_JSON,
|
||||
encoding: Encoding.UTF8,
|
||||
content: JsonConvert.SerializeObject(new
|
||||
{
|
||||
WindowsUser = Environment.UserName,
|
||||
Action = "ACCESS",
|
||||
AppId = appId,
|
||||
Message = $"User '{user}' accessed '{buttonText}' with Tag: {buttonTag}"
|
||||
}));
|
||||
|
||||
_ = await httpClient.SendAsync(httpRequestMessage);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// TODO: Log the error message.
|
||||
}
|
||||
})
|
||||
.ConfigureAwait(true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class ApplicationState
|
||||
{
|
||||
internal const String UNAVAILABLE = "Genesis Toolbox is currently not available.";
|
||||
|
||||
private static IEnumerable<SoftwareFunctions> softwareFunctions;
|
||||
|
||||
internal static Int32 Id { get; private set; }
|
||||
|
||||
internal static String User { get; private set; }
|
||||
|
||||
internal static Boolean IsAuthorized { get; private set; }
|
||||
|
||||
internal static Boolean Initialized { get; private set; }
|
||||
|
||||
internal static ApplicationVersion Version { get; private set; }
|
||||
= ApplicationVersion.Current;
|
||||
|
||||
internal static void Initialize()
|
||||
{
|
||||
Id = ApplicationHttp.ApplicationId(
|
||||
software: Version.Assembly.Name,
|
||||
functions: Enum.GetNames(typeof(SoftwareFunctions)));
|
||||
Initialized = Id > 0;
|
||||
}
|
||||
|
||||
internal static Boolean Authorize(String username, String password, out String error)
|
||||
{
|
||||
error = default(String);
|
||||
|
||||
if (Id <= 0)
|
||||
{
|
||||
error = "Genesis Toolbox is currently not available.";
|
||||
}
|
||||
else
|
||||
{
|
||||
softwareFunctions = ApplicationHttp.GetSoftwareFunction<SoftwareFunctions>(Id, username, password);
|
||||
IsAuthorized = softwareFunctions != null;
|
||||
User = username;
|
||||
|
||||
if (!IsAuthorized)
|
||||
{
|
||||
error = "Genesis Toolbox is currently not available.";
|
||||
softwareFunctions = Array.Empty<SoftwareFunctions>();
|
||||
}
|
||||
}
|
||||
|
||||
return IsAuthorized;
|
||||
}
|
||||
|
||||
internal static Boolean IsEnabled(SoftwareFunctions softwareFunction)
|
||||
=> softwareFunctions.Contains(softwareFunction);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal struct ApplicationVersion
|
||||
{
|
||||
private ApplicationVersion(Boolean initialize)
|
||||
{
|
||||
if (initialize)
|
||||
{
|
||||
Assembly = System.Reflection.Assembly
|
||||
.GetExecutingAssembly()
|
||||
.GetName();
|
||||
Major = Assembly.Version.Major;
|
||||
Minor = Assembly.Version.Minor;
|
||||
Build = Assembly.Version.Build;
|
||||
}
|
||||
else
|
||||
{
|
||||
Major = default(Int32);
|
||||
Minor = default(Int32);
|
||||
Build = default(Int32);
|
||||
Assembly = default(AssemblyName);
|
||||
}
|
||||
}
|
||||
|
||||
public Int32 Major { get; }
|
||||
|
||||
public Int32 Minor { get; }
|
||||
|
||||
public Int32 Build { get; }
|
||||
|
||||
public AssemblyName Assembly { get; }
|
||||
|
||||
public override String ToString()
|
||||
=> $"{nameof(Version)}: {Major}.{Minor}.{Build}";
|
||||
|
||||
public static ApplicationVersion Current => new ApplicationVersion(true);
|
||||
|
||||
public static implicit operator String(ApplicationVersion assemblyVersion)
|
||||
=> assemblyVersion.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public static class Appsettings
|
||||
{
|
||||
private const String EMPTY = "";
|
||||
private const String SETTINGS_SECTION = "appSettings";
|
||||
private static Configuration configuration
|
||||
= ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
|
||||
private static KeyValueConfigurationCollection settings
|
||||
= configuration.AppSettings.Settings;
|
||||
|
||||
public static String WorkingDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return Directory
|
||||
.GetParent(configuration.FilePath)
|
||||
.FullName;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Int16 GMHPort
|
||||
{
|
||||
get => GetInt16();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
|
||||
public static Int32 MessurementDauer
|
||||
{
|
||||
get => GetInt32();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public static Int32 MessurementStep
|
||||
{
|
||||
get => GetInt32();
|
||||
set => SetValue(value);
|
||||
}
|
||||
|
||||
public static String GetKey(String key)
|
||||
{
|
||||
var _key = settings.AllKeys.FirstOrDefault(x => x.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(_key))
|
||||
{
|
||||
_key = key;
|
||||
|
||||
settings.Add(_key, string.Empty);
|
||||
}
|
||||
|
||||
return _key;
|
||||
}
|
||||
|
||||
private static String GetValue([CallerMemberName] String property = EMPTY)
|
||||
=> settings[property]?.Value?.ToString() ?? string.Empty;
|
||||
|
||||
private static Int16 GetInt16([CallerMemberName] String property = EMPTY)
|
||||
{
|
||||
var value = GetValue(property);
|
||||
|
||||
if (short.TryParse(value, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return default(Int16);
|
||||
}
|
||||
|
||||
private static Int32 GetInt32([CallerMemberName] String property = EMPTY)
|
||||
{
|
||||
var value = GetValue(property);
|
||||
|
||||
if (int.TryParse(value, out var result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return default(Int16);
|
||||
}
|
||||
|
||||
private static void SetValue<T>(this T value, [CallerMemberName] String property = EMPTY)
|
||||
{
|
||||
var key = GetKey(property);
|
||||
|
||||
settings[key].Value = value?.ToString() ?? EMPTY;
|
||||
}
|
||||
|
||||
public static void SaveSettings()
|
||||
{
|
||||
configuration.Save(ConfigurationSaveMode.Full);
|
||||
ConfigurationManager.RefreshSection(SETTINGS_SECTION);
|
||||
|
||||
configuration = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
|
||||
settings = configuration.AppSettings.Settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
+234
@@ -0,0 +1,234 @@
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
partial class ChangePassword
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.layout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblOldPassword = new System.Windows.Forms.Label();
|
||||
this.lblNewPassword = new System.Windows.Forms.Label();
|
||||
this.lblConfirmPassword = new System.Windows.Forms.Label();
|
||||
this.tbxOldPassword = new System.Windows.Forms.TextBox();
|
||||
this.newPassword = new System.Windows.Forms.TextBox();
|
||||
this.confirmPassword = new System.Windows.Forms.TextBox();
|
||||
this.btnCHangePassword = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.errorLbl = new System.Windows.Forms.Label();
|
||||
this.ChangePasswordErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
|
||||
this.layout.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ChangePasswordErrorProvider)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// layout
|
||||
//
|
||||
this.layout.AutoSize = true;
|
||||
this.layout.ColumnCount = 3;
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F));
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.layout.Controls.Add(this.lblOldPassword, 1, 1);
|
||||
this.layout.Controls.Add(this.lblNewPassword, 1, 4);
|
||||
this.layout.Controls.Add(this.lblConfirmPassword, 1, 7);
|
||||
this.layout.Controls.Add(this.tbxOldPassword, 1, 2);
|
||||
this.layout.Controls.Add(this.newPassword, 1, 5);
|
||||
this.layout.Controls.Add(this.confirmPassword, 1, 8);
|
||||
this.layout.Controls.Add(this.btnCHangePassword, 1, 10);
|
||||
this.layout.Controls.Add(this.btnCancel, 1, 12);
|
||||
this.layout.Controls.Add(this.errorLbl, 1, 13);
|
||||
this.layout.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.layout.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.layout.Location = new System.Drawing.Point(0, 0);
|
||||
this.layout.Name = "layout";
|
||||
this.layout.RowCount = 15;
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout.Size = new System.Drawing.Size(413, 584);
|
||||
this.layout.TabIndex = 0;
|
||||
//
|
||||
// lblOldPassword
|
||||
//
|
||||
this.lblOldPassword.AutoSize = true;
|
||||
this.lblOldPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblOldPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lblOldPassword.Location = new System.Drawing.Point(68, 185);
|
||||
this.lblOldPassword.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lblOldPassword.Name = "lblOldPassword";
|
||||
this.lblOldPassword.Size = new System.Drawing.Size(275, 15);
|
||||
this.lblOldPassword.TabIndex = 0;
|
||||
this.lblOldPassword.Text = "Old password";
|
||||
this.lblOldPassword.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// lblNewPassword
|
||||
//
|
||||
this.lblNewPassword.AutoSize = true;
|
||||
this.lblNewPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblNewPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lblNewPassword.Location = new System.Drawing.Point(68, 228);
|
||||
this.lblNewPassword.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lblNewPassword.Name = "lblNewPassword";
|
||||
this.lblNewPassword.Size = new System.Drawing.Size(275, 15);
|
||||
this.lblNewPassword.TabIndex = 1;
|
||||
this.lblNewPassword.Text = "New password";
|
||||
this.lblNewPassword.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// lblConfirmPassword
|
||||
//
|
||||
this.lblConfirmPassword.AutoSize = true;
|
||||
this.lblConfirmPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblConfirmPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lblConfirmPassword.Location = new System.Drawing.Point(68, 271);
|
||||
this.lblConfirmPassword.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lblConfirmPassword.Name = "lblConfirmPassword";
|
||||
this.lblConfirmPassword.Size = new System.Drawing.Size(275, 15);
|
||||
this.lblConfirmPassword.TabIndex = 2;
|
||||
this.lblConfirmPassword.Text = "Confirm password";
|
||||
this.lblConfirmPassword.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// tbxOldPassword
|
||||
//
|
||||
this.tbxOldPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.tbxOldPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tbxOldPassword.Location = new System.Drawing.Point(71, 200);
|
||||
this.tbxOldPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.tbxOldPassword.Name = "tbxOldPassword";
|
||||
this.tbxOldPassword.Size = new System.Drawing.Size(272, 23);
|
||||
this.tbxOldPassword.TabIndex = 3;
|
||||
this.tbxOldPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// newPassword
|
||||
//
|
||||
this.newPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.newPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.newPassword.Location = new System.Drawing.Point(71, 243);
|
||||
this.newPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.newPassword.Name = "newPassword";
|
||||
this.newPassword.Size = new System.Drawing.Size(272, 23);
|
||||
this.newPassword.TabIndex = 4;
|
||||
this.newPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// confirmPassword
|
||||
//
|
||||
this.confirmPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.confirmPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.confirmPassword.Location = new System.Drawing.Point(71, 286);
|
||||
this.confirmPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.confirmPassword.Name = "confirmPassword";
|
||||
this.confirmPassword.Size = new System.Drawing.Size(272, 23);
|
||||
this.confirmPassword.TabIndex = 5;
|
||||
this.confirmPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// btnCHangePassword
|
||||
//
|
||||
this.btnCHangePassword.AutoSize = true;
|
||||
this.btnCHangePassword.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCHangePassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnCHangePassword.Location = new System.Drawing.Point(71, 319);
|
||||
this.btnCHangePassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.btnCHangePassword.Name = "btnCHangePassword";
|
||||
this.btnCHangePassword.Size = new System.Drawing.Size(272, 27);
|
||||
this.btnCHangePassword.TabIndex = 6;
|
||||
this.btnCHangePassword.Text = "Change password";
|
||||
this.btnCHangePassword.UseVisualStyleBackColor = true;
|
||||
this.btnCHangePassword.Click += new System.EventHandler(this.OnFormSubmittedClick);
|
||||
this.btnCHangePassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.btnCHangePassword_KeyDown);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnCancel.Location = new System.Drawing.Point(71, 356);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(272, 27);
|
||||
this.btnCancel.TabIndex = 7;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.OnCancellationClick);
|
||||
this.btnCancel.KeyDown += new System.Windows.Forms.KeyEventHandler(this.btnCancel_KeyDown);
|
||||
//
|
||||
// errorLbl
|
||||
//
|
||||
this.errorLbl.AutoSize = true;
|
||||
this.errorLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.errorLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.errorLbl.ForeColor = System.Drawing.Color.Firebrick;
|
||||
this.errorLbl.Location = new System.Drawing.Point(68, 383);
|
||||
this.errorLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.errorLbl.Name = "errorLbl";
|
||||
this.errorLbl.Size = new System.Drawing.Size(275, 15);
|
||||
this.errorLbl.TabIndex = 8;
|
||||
this.errorLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// ChangePasswordErrorProvider
|
||||
//
|
||||
this.ChangePasswordErrorProvider.ContainerControl = this;
|
||||
//
|
||||
// ChangePassword
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.layout);
|
||||
this.Name = "ChangePassword";
|
||||
this.Size = new System.Drawing.Size(413, 584);
|
||||
this.layout.ResumeLayout(false);
|
||||
this.layout.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ChangePasswordErrorProvider)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel layout;
|
||||
private System.Windows.Forms.Label lblOldPassword;
|
||||
private System.Windows.Forms.Label lblNewPassword;
|
||||
private System.Windows.Forms.Label lblConfirmPassword;
|
||||
private System.Windows.Forms.TextBox tbxOldPassword;
|
||||
private System.Windows.Forms.TextBox newPassword;
|
||||
private System.Windows.Forms.TextBox confirmPassword;
|
||||
private System.Windows.Forms.Button btnCHangePassword;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.ErrorProvider ChangePasswordErrorProvider;
|
||||
private System.Windows.Forms.Label errorLbl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Xylem.Common.Utils.UserAccessCtrl.Properties;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public partial class ChangePassword : UserControl, IIdentityForm
|
||||
{
|
||||
private readonly Action<ChangePassword> closeOnSuccessOrCancel;
|
||||
private readonly IDictionary<String, Control> fields;
|
||||
|
||||
public ChangePassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Dock = DockStyle.Fill;
|
||||
}
|
||||
|
||||
public ChangePassword(Action<Control> closeOnSuccess) : this()
|
||||
{
|
||||
closeOnSuccessOrCancel = closeOnSuccess;
|
||||
|
||||
fields = new Dictionary<String, Control>
|
||||
{
|
||||
{ "OldPassword", tbxOldPassword },
|
||||
{ "NewPassword", newPassword },
|
||||
{ "ConfirmPassword", confirmPassword },
|
||||
};
|
||||
lblOldPassword.Text = Resources.StrLblOldPassword;
|
||||
lblNewPassword.Text = Resources.StrLblNewPassword;
|
||||
lblConfirmPassword.Text = Resources.StrLblConfirmPasswort;
|
||||
btnCHangePassword.Text = Resources.StrLblChangePassword;
|
||||
btnCancel.Text = Resources.StrLblCancel;
|
||||
}
|
||||
|
||||
private void OnCancellationClick(Object sender, EventArgs args)
|
||||
{
|
||||
closeOnSuccessOrCancel?.Invoke(this);
|
||||
}
|
||||
|
||||
private void OnFormSubmittedClick(Object sender, EventArgs args)
|
||||
{
|
||||
ChangePasswordErrorProvider.Clear();
|
||||
|
||||
errorLbl.Text = default(String);
|
||||
|
||||
if (!Software.ChangePassword(tbxOldPassword.Text, newPassword.Text, confirmPassword.Text, out var errors))
|
||||
{
|
||||
errorLbl.Text = Resources.StrMsgFailedPasswordChange;
|
||||
|
||||
foreach (var kvp in errors)
|
||||
{
|
||||
if (fields.TryGetValue(kvp.Key, out var control))
|
||||
{
|
||||
ChangePasswordErrorProvider.SetError(control, kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
closeOnSuccessOrCancel?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnCHangePassword_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
OnFormSubmittedClick(this, null);
|
||||
}
|
||||
|
||||
private void btnCancel_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
OnCancellationClick(this, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ChangePasswordErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public class CordonelTempLut
|
||||
{
|
||||
public Int32 Id { get; set; }
|
||||
|
||||
public Int32 PcbId { get; set; }
|
||||
|
||||
public Double RefTempC { get; set; }
|
||||
|
||||
public Double AvgTof { get; set; }
|
||||
|
||||
public Boolean Active { get; set; }
|
||||
|
||||
public DateTime? Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public interface IIdentityForm
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class LDAPLoginModel
|
||||
{
|
||||
public String Assembly { get; set; }
|
||||
|
||||
public Int32 MajorV { get; set; }
|
||||
|
||||
public Int32 MinorV { get; set; }
|
||||
|
||||
public Int32 BuildV { get; set; }
|
||||
|
||||
public Int32 EmployeeId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public class LDAPRegisterModel
|
||||
{
|
||||
public String Assembly { get; set; }
|
||||
|
||||
public Int32 MajorV { get; set; }
|
||||
|
||||
public Int32 MinorV { get; set; }
|
||||
|
||||
public Int32 BuildV { get; set; }
|
||||
|
||||
public Int32 EmployeeId { get; set; }
|
||||
|
||||
public String FirstName { get; set; }
|
||||
|
||||
public String LastName { get; set; }
|
||||
|
||||
public String Phone { get; set; }
|
||||
|
||||
public String Email { get; set; }
|
||||
|
||||
public String Username { get; set; }
|
||||
|
||||
public String DomainName { get; set; }
|
||||
|
||||
public String Password { get; set; }
|
||||
|
||||
public String ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.DirectoryServices;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public class LDAPUser
|
||||
{
|
||||
public LDAPUser()
|
||||
=> InitializeLDAPUser();
|
||||
|
||||
public Int32 EmployeeId { get; private set; }
|
||||
|
||||
public String FirstName { get; set; }
|
||||
|
||||
public String LastName { get; set; }
|
||||
|
||||
public String Phone { get; set; }
|
||||
|
||||
public String Email { get; set; }
|
||||
|
||||
public String Username { get; set; }
|
||||
|
||||
public String DomainName { get; private set; }
|
||||
|
||||
public String Password { get; set; }
|
||||
|
||||
public String ConfirmPassword { get; set; }
|
||||
|
||||
public Boolean Found { get; private set; }
|
||||
|
||||
private void InitializeLDAPUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = UserPrincipal.Current;
|
||||
|
||||
using (var directoryEntry = new DirectoryEntry($"LDAP://{currentUser.DistinguishedName}"))
|
||||
{
|
||||
using (var directorySearcher = new DirectorySearcher(directoryEntry))
|
||||
{
|
||||
var searchResult = directorySearcher.FindOne();
|
||||
|
||||
foreach (DictionaryEntry dictionaryEntry in searchResult.Properties)
|
||||
{
|
||||
if (dictionaryEntry.Key is String property)
|
||||
{
|
||||
if (property.Equals("employeeid", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String value)
|
||||
{
|
||||
if (int.TryParse(value, out Int32 employeeId))
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("givenname", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String firstName)
|
||||
{
|
||||
FirstName = firstName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("sn", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String lastName)
|
||||
{
|
||||
LastName = lastName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("mail", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String email)
|
||||
{
|
||||
Email = email;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("telephonenumber", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String phone)
|
||||
{
|
||||
Phone = phone;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("samaccountname", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String username)
|
||||
{
|
||||
DomainName = username.ToLower();
|
||||
Username = DomainName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Found = EmployeeId > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
sealed partial class LoginForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.LoginErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
|
||||
this.LoginLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblPassword = new System.Windows.Forms.Label();
|
||||
this.lblUserName = new System.Windows.Forms.Label();
|
||||
this.tbxUserName = new System.Windows.Forms.TextBox();
|
||||
this.tbxPassword = new System.Windows.Forms.TextBox();
|
||||
this.btnLogin = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.errorLbl = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.LoginErrorProvider)).BeginInit();
|
||||
this.LoginLayoutPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// LoginErrorProvider
|
||||
//
|
||||
this.LoginErrorProvider.BlinkRate = 0;
|
||||
this.LoginErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
|
||||
this.LoginErrorProvider.ContainerControl = this;
|
||||
//
|
||||
// LoginLayoutPanel
|
||||
//
|
||||
this.LoginLayoutPanel.ColumnCount = 3;
|
||||
this.LoginLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.LoginLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F));
|
||||
this.LoginLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.LoginLayoutPanel.Controls.Add(this.lblPassword, 1, 4);
|
||||
this.LoginLayoutPanel.Controls.Add(this.lblUserName, 1, 1);
|
||||
this.LoginLayoutPanel.Controls.Add(this.tbxUserName, 1, 2);
|
||||
this.LoginLayoutPanel.Controls.Add(this.tbxPassword, 1, 5);
|
||||
this.LoginLayoutPanel.Controls.Add(this.btnLogin, 1, 7);
|
||||
this.LoginLayoutPanel.Controls.Add(this.btnCancel, 1, 9);
|
||||
this.LoginLayoutPanel.Controls.Add(this.errorLbl, 1, 10);
|
||||
this.LoginLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.LoginLayoutPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.LoginLayoutPanel.Name = "LoginLayoutPanel";
|
||||
this.LoginLayoutPanel.RowCount = 12;
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.LoginLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.LoginLayoutPanel.Size = new System.Drawing.Size(385, 541);
|
||||
this.LoginLayoutPanel.TabIndex = 1;
|
||||
//
|
||||
// lblPassword
|
||||
//
|
||||
this.lblPassword.AutoSize = true;
|
||||
this.lblPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lblPassword.Location = new System.Drawing.Point(64, 230);
|
||||
this.lblPassword.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lblPassword.Name = "lblPassword";
|
||||
this.lblPassword.Size = new System.Drawing.Size(256, 15);
|
||||
this.lblPassword.TabIndex = 1;
|
||||
this.lblPassword.Text = "Password";
|
||||
this.lblPassword.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// lblUserName
|
||||
//
|
||||
this.lblUserName.AutoSize = true;
|
||||
this.lblUserName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblUserName.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lblUserName.Location = new System.Drawing.Point(64, 187);
|
||||
this.lblUserName.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lblUserName.Name = "lblUserName";
|
||||
this.lblUserName.Size = new System.Drawing.Size(256, 15);
|
||||
this.lblUserName.TabIndex = 0;
|
||||
this.lblUserName.Text = "Username";
|
||||
this.lblUserName.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// tbxUserName
|
||||
//
|
||||
this.tbxUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.tbxUserName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tbxUserName.Location = new System.Drawing.Point(67, 202);
|
||||
this.tbxUserName.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.tbxUserName.Name = "tbxUserName";
|
||||
this.tbxUserName.Size = new System.Drawing.Size(253, 23);
|
||||
this.tbxUserName.TabIndex = 1;
|
||||
this.tbxUserName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxUserName_KeyDown);
|
||||
//
|
||||
// tbxPassword
|
||||
//
|
||||
this.tbxPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.tbxPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tbxPassword.Location = new System.Drawing.Point(67, 245);
|
||||
this.tbxPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.tbxPassword.Name = "tbxPassword";
|
||||
this.tbxPassword.Size = new System.Drawing.Size(253, 23);
|
||||
this.tbxPassword.TabIndex = 2;
|
||||
this.tbxPassword.UseSystemPasswordChar = true;
|
||||
this.tbxPassword.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxPassword_KeyDown);
|
||||
//
|
||||
// btnLogin
|
||||
//
|
||||
this.btnLogin.AutoSize = true;
|
||||
this.btnLogin.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnLogin.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnLogin.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnLogin.Location = new System.Drawing.Point(67, 278);
|
||||
this.btnLogin.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.btnLogin.Name = "btnLogin";
|
||||
this.btnLogin.Size = new System.Drawing.Size(253, 25);
|
||||
this.btnLogin.TabIndex = 3;
|
||||
this.btnLogin.Text = "Login";
|
||||
this.btnLogin.UseVisualStyleBackColor = true;
|
||||
this.btnLogin.Click += new System.EventHandler(this.OnLoginClick);
|
||||
this.btnLogin.KeyDown += new System.Windows.Forms.KeyEventHandler(this.btnLogin_KeyDown);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.AutoSize = true;
|
||||
this.btnCancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.btnCancel.Location = new System.Drawing.Point(67, 313);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(253, 25);
|
||||
this.btnCancel.TabIndex = 4;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.OnCancelClick);
|
||||
this.btnCancel.KeyDown += new System.Windows.Forms.KeyEventHandler(this.btnCancel_KeyDown);
|
||||
//
|
||||
// errorLbl
|
||||
//
|
||||
this.errorLbl.AutoSize = true;
|
||||
this.errorLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.errorLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.errorLbl.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.errorLbl.ForeColor = System.Drawing.Color.Firebrick;
|
||||
this.errorLbl.Location = new System.Drawing.Point(64, 338);
|
||||
this.errorLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.errorLbl.Name = "errorLbl";
|
||||
this.errorLbl.Size = new System.Drawing.Size(256, 15);
|
||||
this.errorLbl.TabIndex = 6;
|
||||
//
|
||||
// LoginForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.LoginLayoutPanel);
|
||||
this.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Name = "LoginForm";
|
||||
this.Size = new System.Drawing.Size(385, 541);
|
||||
this.VisibleChanged += new System.EventHandler(this.LoginForm_VisibleChanged);
|
||||
((System.ComponentModel.ISupportInitialize)(this.LoginErrorProvider)).EndInit();
|
||||
this.LoginLayoutPanel.ResumeLayout(false);
|
||||
this.LoginLayoutPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.ErrorProvider LoginErrorProvider;
|
||||
private System.Windows.Forms.TableLayoutPanel LoginLayoutPanel;
|
||||
private System.Windows.Forms.Label lblPassword;
|
||||
private System.Windows.Forms.Label lblUserName;
|
||||
private System.Windows.Forms.TextBox tbxUserName;
|
||||
private System.Windows.Forms.TextBox tbxPassword;
|
||||
private System.Windows.Forms.Button btnLogin;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Label errorLbl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Xylem.Common.Utils.UserAccessCtrl.Properties;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public sealed partial class LoginForm : UserControl, IIdentityForm
|
||||
{
|
||||
private readonly Action<Control> submittedCallback;
|
||||
private readonly IDictionary<String, Control> fields;
|
||||
|
||||
public LoginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Dock = DockStyle.Fill;
|
||||
tbxUserName.Focus();
|
||||
}
|
||||
|
||||
private void LoginForm_Shown(Object sender, EventArgs e)
|
||||
{
|
||||
tbxUserName.Focus();
|
||||
}
|
||||
|
||||
public LoginForm(Action<Control> submittedCallback) : this()
|
||||
{
|
||||
this.submittedCallback = submittedCallback;
|
||||
|
||||
fields = new Dictionary<String, Control>
|
||||
{
|
||||
{ "Username", tbxUserName },
|
||||
{ "Password", tbxPassword },
|
||||
};
|
||||
lblPassword.Text = Resources.StrLblPassword;
|
||||
lblUserName.Text = Resources.StrLblUserName;
|
||||
btnCancel.Text = Resources.StrLblCancel;
|
||||
}
|
||||
|
||||
private void OnLoginClick(Object sender, EventArgs e)
|
||||
{
|
||||
LoginErrorProvider.Clear();
|
||||
|
||||
errorLbl.Text = null;
|
||||
|
||||
if (!Software.Login(tbxUserName.Text, tbxPassword.Text.ComputeBase64Hash(), out var errors))
|
||||
{
|
||||
errorLbl.Text = Resources.StrMsgInvalidLogin;
|
||||
|
||||
foreach (var kvp in errors)
|
||||
{
|
||||
if (fields.TryGetValue(kvp.Key, out var control))
|
||||
{
|
||||
LoginErrorProvider.SetError(control, kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
submittedCallback?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCancelClick(Object sender, EventArgs e)
|
||||
{
|
||||
submittedCallback?.Invoke(this);
|
||||
}
|
||||
|
||||
private void btnLogin_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
OnLoginClick(this, null);
|
||||
}
|
||||
|
||||
private void btnCancel_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
OnCancelClick(this, null);
|
||||
}
|
||||
|
||||
private void LoginForm_VisibleChanged(Object sender, EventArgs e)
|
||||
{
|
||||
tbxUserName.Focus();
|
||||
}
|
||||
|
||||
private void tbxPassword_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
OnLoginClick(this,null);
|
||||
}
|
||||
|
||||
private void tbxUserName_KeyDown(Object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
tbxPassword.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="LoginErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal static class ParseExtensions
|
||||
{
|
||||
private static readonly NumberStyles any = NumberStyles.Any;
|
||||
private static readonly CultureInfo de = new CultureInfo("de-DE");
|
||||
private static readonly CultureInfo us = new CultureInfo("en-US");
|
||||
private static Boolean IsDECulture => Thread.CurrentThread.CurrentCulture.Name.ToLower().Contains("de");
|
||||
|
||||
internal static Boolean TryParse(this String stringValue, out Double value)
|
||||
{
|
||||
if (IsDECulture)
|
||||
{
|
||||
return double.TryParse(stringValue, any, de, out value)
|
||||
|| double.TryParse(stringValue, any, us, out value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return double.TryParse(stringValue, any, us, out value)
|
||||
|| double.TryParse(stringValue, any, de, out value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
|
||||
// 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("Xylem.Common.Utils.UserAccessCtrl")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
//[assembly: AssemblyConfiguration("")]
|
||||
//[assembly: AssemblyCompany("")]
|
||||
//[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
//[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("2d55bbd1-5373-484c-8781-c6eceafc2a90")]
|
||||
|
||||
// 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,144 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// 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", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Xylem.Common.Utils.UserAccessCtrl.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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 {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
internal static string StrLblCancel {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblCancel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Change password.
|
||||
/// </summary>
|
||||
internal static string StrLblChangePassword {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblChangePassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Confirm password.
|
||||
/// </summary>
|
||||
internal static string StrLblConfirmPasswort {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblConfirmPasswort", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New password.
|
||||
/// </summary>
|
||||
internal static string StrLblNewPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblNewPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Old password.
|
||||
/// </summary>
|
||||
internal static string StrLblOldPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblOldPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password.
|
||||
/// </summary>
|
||||
internal static string StrLblPassword {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblPassword", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User name.
|
||||
/// </summary>
|
||||
internal static string StrLblUserName {
|
||||
get {
|
||||
return ResourceManager.GetString("StrLblUserName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Password change failed!.
|
||||
/// </summary>
|
||||
internal static string StrMsgFailedPasswordChange {
|
||||
get {
|
||||
return ResourceManager.GetString("StrMsgFailedPasswordChange", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Invalid login attempt!.
|
||||
/// </summary>
|
||||
internal static string StrMsgInvalidLogin {
|
||||
get {
|
||||
return ResourceManager.GetString("StrMsgInvalidLogin", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="StrLblCancel" xml:space="preserve">
|
||||
<value>Abbruch</value>
|
||||
</data>
|
||||
<data name="StrLblChangePassword" xml:space="preserve">
|
||||
<value>Paßwort ändern</value>
|
||||
</data>
|
||||
<data name="StrLblConfirmPasswort" xml:space="preserve">
|
||||
<value>Paßwort bestätigen</value>
|
||||
</data>
|
||||
<data name="StrLblNewPassword" xml:space="preserve">
|
||||
<value>Neues Paßwort</value>
|
||||
</data>
|
||||
<data name="StrLblOldPassword" xml:space="preserve">
|
||||
<value>Altes Paßwort</value>
|
||||
</data>
|
||||
<data name="StrLblPassword" xml:space="preserve">
|
||||
<value>Paßwort</value>
|
||||
</data>
|
||||
<data name="StrLblUserName" xml:space="preserve">
|
||||
<value>Benutzername</value>
|
||||
</data>
|
||||
<data name="StrMsgFailedPasswordChange" xml:space="preserve">
|
||||
<value>Paßwortänderung fehlgeschlagen!</value>
|
||||
</data>
|
||||
<data name="StrMsgInvalidLogin" xml:space="preserve">
|
||||
<value>Ungültiger Login!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,147 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="StrLblCancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="StrLblChangePassword" xml:space="preserve">
|
||||
<value>Change password</value>
|
||||
</data>
|
||||
<data name="StrLblConfirmPasswort" xml:space="preserve">
|
||||
<value>Confirm password</value>
|
||||
</data>
|
||||
<data name="StrLblNewPassword" xml:space="preserve">
|
||||
<value>New password</value>
|
||||
</data>
|
||||
<data name="StrLblOldPassword" xml:space="preserve">
|
||||
<value>Old password</value>
|
||||
</data>
|
||||
<data name="StrLblPassword" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
<data name="StrLblUserName" xml:space="preserve">
|
||||
<value>User name</value>
|
||||
</data>
|
||||
<data name="StrMsgFailedPasswordChange" xml:space="preserve">
|
||||
<value>Password change failed!</value>
|
||||
</data>
|
||||
<data name="StrMsgInvalidLogin" xml:space="preserve">
|
||||
<value>Invalid login attempt!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public class RefTempRange
|
||||
{
|
||||
public Double Min { get; set; }
|
||||
|
||||
public Double Max { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,378 @@
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
partial class RegisterLDAPUser
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.layout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.employeeIdLbl = new System.Windows.Forms.Label();
|
||||
this.employeeId = new System.Windows.Forms.TextBox();
|
||||
this.firstnameLbl = new System.Windows.Forms.Label();
|
||||
this.lastnameLbl = new System.Windows.Forms.Label();
|
||||
this.phoneLbl = new System.Windows.Forms.Label();
|
||||
this.emailLbl = new System.Windows.Forms.Label();
|
||||
this.usernameLbl = new System.Windows.Forms.Label();
|
||||
this.passwordLbl = new System.Windows.Forms.Label();
|
||||
this.confirmPasswordLbl = new System.Windows.Forms.Label();
|
||||
this.firstname = new System.Windows.Forms.TextBox();
|
||||
this.lastname = new System.Windows.Forms.TextBox();
|
||||
this.phone = new System.Windows.Forms.TextBox();
|
||||
this.email = new System.Windows.Forms.TextBox();
|
||||
this.username = new System.Windows.Forms.TextBox();
|
||||
this.password = new System.Windows.Forms.TextBox();
|
||||
this.confirmPassword = new System.Windows.Forms.TextBox();
|
||||
this.errorLbl = new System.Windows.Forms.Label();
|
||||
this.RegisterErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
|
||||
this.submitBtn = new System.Windows.Forms.Button();
|
||||
this.layout.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RegisterErrorProvider)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// layout
|
||||
//
|
||||
this.layout.AutoSize = true;
|
||||
this.layout.ColumnCount = 3;
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666F));
|
||||
this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
|
||||
this.layout.Controls.Add(this.employeeIdLbl, 1, 1);
|
||||
this.layout.Controls.Add(this.employeeId, 1, 2);
|
||||
this.layout.Controls.Add(this.firstnameLbl, 1, 4);
|
||||
this.layout.Controls.Add(this.lastnameLbl, 1, 7);
|
||||
this.layout.Controls.Add(this.phoneLbl, 1, 10);
|
||||
this.layout.Controls.Add(this.emailLbl, 1, 13);
|
||||
this.layout.Controls.Add(this.usernameLbl, 1, 16);
|
||||
this.layout.Controls.Add(this.passwordLbl, 1, 19);
|
||||
this.layout.Controls.Add(this.confirmPasswordLbl, 1, 22);
|
||||
this.layout.Controls.Add(this.firstname, 1, 5);
|
||||
this.layout.Controls.Add(this.lastname, 1, 8);
|
||||
this.layout.Controls.Add(this.phone, 1, 11);
|
||||
this.layout.Controls.Add(this.email, 1, 14);
|
||||
this.layout.Controls.Add(this.username, 1, 17);
|
||||
this.layout.Controls.Add(this.password, 1, 20);
|
||||
this.layout.Controls.Add(this.confirmPassword, 1, 23);
|
||||
this.layout.Controls.Add(this.submitBtn, 1, 25);
|
||||
this.layout.Controls.Add(this.errorLbl, 1, 26);
|
||||
this.layout.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.layout.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.layout.Location = new System.Drawing.Point(0, 0);
|
||||
this.layout.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.layout.Name = "layout";
|
||||
this.layout.RowCount = 28;
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.layout.Size = new System.Drawing.Size(371, 545);
|
||||
this.layout.TabIndex = 1;
|
||||
//
|
||||
// employeeIdLbl
|
||||
//
|
||||
this.employeeIdLbl.AutoSize = true;
|
||||
this.employeeIdLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.employeeIdLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.employeeIdLbl.Location = new System.Drawing.Point(61, 77);
|
||||
this.employeeIdLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.employeeIdLbl.Name = "employeeIdLbl";
|
||||
this.employeeIdLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.employeeIdLbl.TabIndex = 0;
|
||||
this.employeeIdLbl.Text = "Employee Id";
|
||||
this.employeeIdLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// employeeId
|
||||
//
|
||||
this.employeeId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.employeeId.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.employeeId.Location = new System.Drawing.Point(64, 92);
|
||||
this.employeeId.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.employeeId.Name = "employeeId";
|
||||
this.employeeId.ReadOnly = true;
|
||||
this.employeeId.Size = new System.Drawing.Size(244, 23);
|
||||
this.employeeId.TabIndex = 1;
|
||||
//
|
||||
// firstnameLbl
|
||||
//
|
||||
this.firstnameLbl.AutoSize = true;
|
||||
this.firstnameLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.firstnameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.firstnameLbl.Location = new System.Drawing.Point(61, 120);
|
||||
this.firstnameLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.firstnameLbl.Name = "firstnameLbl";
|
||||
this.firstnameLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.firstnameLbl.TabIndex = 2;
|
||||
this.firstnameLbl.Text = "First name";
|
||||
this.firstnameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// lastnameLbl
|
||||
//
|
||||
this.lastnameLbl.AutoSize = true;
|
||||
this.lastnameLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lastnameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.lastnameLbl.Location = new System.Drawing.Point(61, 163);
|
||||
this.lastnameLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lastnameLbl.Name = "lastnameLbl";
|
||||
this.lastnameLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.lastnameLbl.TabIndex = 3;
|
||||
this.lastnameLbl.Text = "Last name";
|
||||
this.lastnameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// phoneLbl
|
||||
//
|
||||
this.phoneLbl.AutoSize = true;
|
||||
this.phoneLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.phoneLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.phoneLbl.Location = new System.Drawing.Point(61, 206);
|
||||
this.phoneLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.phoneLbl.Name = "phoneLbl";
|
||||
this.phoneLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.phoneLbl.TabIndex = 4;
|
||||
this.phoneLbl.Text = "Phone";
|
||||
this.phoneLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// emailLbl
|
||||
//
|
||||
this.emailLbl.AutoSize = true;
|
||||
this.emailLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.emailLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.emailLbl.Location = new System.Drawing.Point(61, 249);
|
||||
this.emailLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.emailLbl.Name = "emailLbl";
|
||||
this.emailLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.emailLbl.TabIndex = 5;
|
||||
this.emailLbl.Text = "Email";
|
||||
this.emailLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// usernameLbl
|
||||
//
|
||||
this.usernameLbl.AutoSize = true;
|
||||
this.usernameLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.usernameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.usernameLbl.Location = new System.Drawing.Point(61, 292);
|
||||
this.usernameLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.usernameLbl.Name = "usernameLbl";
|
||||
this.usernameLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.usernameLbl.TabIndex = 6;
|
||||
this.usernameLbl.Text = "Username";
|
||||
this.usernameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// passwordLbl
|
||||
//
|
||||
this.passwordLbl.AutoSize = true;
|
||||
this.passwordLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.passwordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.passwordLbl.Location = new System.Drawing.Point(61, 335);
|
||||
this.passwordLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.passwordLbl.Name = "passwordLbl";
|
||||
this.passwordLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.passwordLbl.TabIndex = 7;
|
||||
this.passwordLbl.Text = "Password";
|
||||
this.passwordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// confirmPasswordLbl
|
||||
//
|
||||
this.confirmPasswordLbl.AutoSize = true;
|
||||
this.confirmPasswordLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.confirmPasswordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.confirmPasswordLbl.Location = new System.Drawing.Point(61, 378);
|
||||
this.confirmPasswordLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.confirmPasswordLbl.Name = "confirmPasswordLbl";
|
||||
this.confirmPasswordLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.confirmPasswordLbl.TabIndex = 8;
|
||||
this.confirmPasswordLbl.Text = "Confirm password";
|
||||
this.confirmPasswordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// firstname
|
||||
//
|
||||
this.firstname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.firstname.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.firstname.Location = new System.Drawing.Point(64, 135);
|
||||
this.firstname.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.firstname.Name = "firstname";
|
||||
this.firstname.ReadOnly = true;
|
||||
this.firstname.Size = new System.Drawing.Size(244, 23);
|
||||
this.firstname.TabIndex = 9;
|
||||
//
|
||||
// lastname
|
||||
//
|
||||
this.lastname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.lastname.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lastname.Location = new System.Drawing.Point(64, 178);
|
||||
this.lastname.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.lastname.Name = "lastname";
|
||||
this.lastname.ReadOnly = true;
|
||||
this.lastname.Size = new System.Drawing.Size(244, 23);
|
||||
this.lastname.TabIndex = 10;
|
||||
//
|
||||
// phone
|
||||
//
|
||||
this.phone.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.phone.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.phone.Location = new System.Drawing.Point(64, 221);
|
||||
this.phone.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.phone.Name = "phone";
|
||||
this.phone.ReadOnly = true;
|
||||
this.phone.Size = new System.Drawing.Size(244, 23);
|
||||
this.phone.TabIndex = 11;
|
||||
//
|
||||
// email
|
||||
//
|
||||
this.email.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.email.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.email.Location = new System.Drawing.Point(64, 264);
|
||||
this.email.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.email.Name = "email";
|
||||
this.email.ReadOnly = true;
|
||||
this.email.Size = new System.Drawing.Size(244, 23);
|
||||
this.email.TabIndex = 12;
|
||||
//
|
||||
// username
|
||||
//
|
||||
this.username.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.username.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.username.Location = new System.Drawing.Point(64, 307);
|
||||
this.username.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.username.Name = "username";
|
||||
this.username.Size = new System.Drawing.Size(244, 23);
|
||||
this.username.TabIndex = 13;
|
||||
//
|
||||
// password
|
||||
//
|
||||
this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.password.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.password.Location = new System.Drawing.Point(64, 350);
|
||||
this.password.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.password.Name = "password";
|
||||
this.password.Size = new System.Drawing.Size(244, 23);
|
||||
this.password.TabIndex = 14;
|
||||
this.password.UseSystemPasswordChar = true;
|
||||
//
|
||||
// confirmPassword
|
||||
//
|
||||
this.confirmPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.confirmPassword.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.confirmPassword.Location = new System.Drawing.Point(64, 393);
|
||||
this.confirmPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.confirmPassword.Name = "confirmPassword";
|
||||
this.confirmPassword.Size = new System.Drawing.Size(244, 23);
|
||||
this.confirmPassword.TabIndex = 15;
|
||||
this.confirmPassword.UseSystemPasswordChar = true;
|
||||
//
|
||||
// errorLbl
|
||||
//
|
||||
this.errorLbl.AutoSize = true;
|
||||
this.errorLbl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.errorLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.errorLbl.ForeColor = System.Drawing.Color.Firebrick;
|
||||
this.errorLbl.Location = new System.Drawing.Point(61, 453);
|
||||
this.errorLbl.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.errorLbl.Name = "errorLbl";
|
||||
this.errorLbl.Size = new System.Drawing.Size(247, 15);
|
||||
this.errorLbl.TabIndex = 18;
|
||||
this.errorLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
|
||||
//
|
||||
// RegisterErrorProvider
|
||||
//
|
||||
this.RegisterErrorProvider.ContainerControl = this;
|
||||
//
|
||||
// submitBtn
|
||||
//
|
||||
this.submitBtn.AutoSize = true;
|
||||
this.submitBtn.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.submitBtn.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.submitBtn.Location = new System.Drawing.Point(64, 426);
|
||||
this.submitBtn.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
||||
this.submitBtn.Name = "submitBtn";
|
||||
this.submitBtn.Size = new System.Drawing.Size(244, 27);
|
||||
this.submitBtn.TabIndex = 16;
|
||||
this.submitBtn.Text = "Complete Registration";
|
||||
this.submitBtn.UseVisualStyleBackColor = true;
|
||||
this.submitBtn.Click += new System.EventHandler(this.SubmitBtn_Click);
|
||||
//
|
||||
// RegisterLDAPUser
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.layout);
|
||||
this.Name = "RegisterLDAPUser";
|
||||
this.Size = new System.Drawing.Size(371, 545);
|
||||
this.layout.ResumeLayout(false);
|
||||
this.layout.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RegisterErrorProvider)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TableLayoutPanel layout;
|
||||
private System.Windows.Forms.Label employeeIdLbl;
|
||||
private System.Windows.Forms.TextBox employeeId;
|
||||
private System.Windows.Forms.Label firstnameLbl;
|
||||
private System.Windows.Forms.Label lastnameLbl;
|
||||
private System.Windows.Forms.Label phoneLbl;
|
||||
private System.Windows.Forms.Label emailLbl;
|
||||
private System.Windows.Forms.Label usernameLbl;
|
||||
private System.Windows.Forms.Label passwordLbl;
|
||||
private System.Windows.Forms.Label confirmPasswordLbl;
|
||||
private System.Windows.Forms.TextBox firstname;
|
||||
private System.Windows.Forms.TextBox lastname;
|
||||
private System.Windows.Forms.TextBox phone;
|
||||
private System.Windows.Forms.TextBox email;
|
||||
private System.Windows.Forms.TextBox username;
|
||||
private System.Windows.Forms.TextBox password;
|
||||
private System.Windows.Forms.TextBox confirmPassword;
|
||||
private System.Windows.Forms.ErrorProvider RegisterErrorProvider;
|
||||
private System.Windows.Forms.Label errorLbl;
|
||||
private System.Windows.Forms.Button submitBtn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public partial class RegisterLDAPUser : UserControl, IIdentityForm
|
||||
{
|
||||
private readonly Action<RegisterLDAPUser> initializeFormState;
|
||||
private readonly IDictionary<String, Control> fields;
|
||||
|
||||
public RegisterLDAPUser()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Dock = DockStyle.Fill;
|
||||
|
||||
var user = Software.PendingUser;
|
||||
employeeId.Text = user.EmployeeId.ToString();
|
||||
firstname.Text = user.FirstName;
|
||||
lastname.Text = user.LastName;
|
||||
phone.Text = user.Phone;
|
||||
email.Text = user.Email;
|
||||
username.Text = user.Username;
|
||||
password.Text = user.Password;
|
||||
confirmPassword.Text = user.ConfirmPassword;
|
||||
|
||||
fields = new Dictionary<String, Control>
|
||||
{
|
||||
{ nameof(user.EmployeeId), employeeId },
|
||||
{ nameof(user.FirstName), firstname },
|
||||
{ nameof(user.LastName), lastname },
|
||||
{ nameof(user.Phone), phone },
|
||||
{ nameof(user.Email), email },
|
||||
{ nameof(user.Username), username },
|
||||
{ nameof(user.Password), password },
|
||||
{ nameof(user.ConfirmPassword), confirmPassword },
|
||||
};
|
||||
}
|
||||
|
||||
public RegisterLDAPUser(Action<RegisterLDAPUser> initializeFormState) : this()
|
||||
{
|
||||
this.initializeFormState = initializeFormState;
|
||||
}
|
||||
|
||||
public event Action<Control> OnCancellation;
|
||||
|
||||
private void SubmitBtn_Click(Object sender, EventArgs args)
|
||||
{
|
||||
RegisterErrorProvider.Clear();
|
||||
|
||||
errorLbl.Text = default(String);
|
||||
|
||||
var user = Software.PendingUser;
|
||||
|
||||
user.Username = username.Text;
|
||||
user.Password = password
|
||||
.Text
|
||||
.ComputeBase64Hash();
|
||||
user.ConfirmPassword = confirmPassword
|
||||
.Text
|
||||
.ComputeBase64Hash();
|
||||
|
||||
if (!Software.Register(user, out var errors))
|
||||
{
|
||||
errorLbl.Text = "Registration failed.";
|
||||
|
||||
foreach (var kvp in errors)
|
||||
{
|
||||
if (fields.TryGetValue(kvp.Key, out var control))
|
||||
{
|
||||
RegisterErrorProvider.SetError(control, kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
initializeFormState?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCancellationClick(Object sender, EventArgs args)
|
||||
{
|
||||
OnCancellation?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="RegisterErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,246 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.Logic.SoftwareAccessHelper;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds information over current software and logged in user.
|
||||
/// </summary>
|
||||
public static class Software
|
||||
{
|
||||
const String Bearer = nameof(Bearer);
|
||||
|
||||
private static String bearer;
|
||||
private static LDAPUser user;
|
||||
private static IEnumerable<SoftwareFunctions> softwareFunctions = Array.Empty<SoftwareFunctions>();
|
||||
|
||||
public static String UserName { get; private set; }
|
||||
|
||||
public static Boolean IsRegistrationPending { get; set; }
|
||||
|
||||
public static LDAPUser PendingUser => user;
|
||||
|
||||
public static Boolean IsAutenticated => !string.IsNullOrWhiteSpace(bearer);
|
||||
|
||||
public static AuthenticationHeaderValue AuthorizationHeader
|
||||
= new AuthenticationHeaderValue(Bearer, bearer);
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
bearer = default(String);
|
||||
user = new LDAPUser();
|
||||
|
||||
var version = SoftwareVersion.Current;
|
||||
var response = new LDAPLoginModel
|
||||
{
|
||||
Assembly = version.Name,
|
||||
BuildV = version.BuildV,
|
||||
MajorV = version.MajorV,
|
||||
MinorV = version.MinorV,
|
||||
EmployeeId = user.EmployeeId
|
||||
}
|
||||
.PostAsJson<String>($"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/AD");
|
||||
|
||||
if (response.HttpStatusCode == HttpStatusCode.Accepted)
|
||||
{
|
||||
IsRegistrationPending = true;
|
||||
}
|
||||
else if (response.HttpStatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
bearer = response
|
||||
.Value
|
||||
?.Trim()
|
||||
?.Trim('"');
|
||||
softwareFunctions = GetFunctions();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(bearer))
|
||||
{
|
||||
UserName = $"{user.FirstName} {user.LastName}";
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(UserName))
|
||||
{
|
||||
UserName = "Options";
|
||||
}
|
||||
}
|
||||
|
||||
internal static Boolean ChangePassword(String oldPassword, String newPassword, String confirmPassword, out Dictionary<String, String> errors)
|
||||
{
|
||||
errors = new Dictionary<String, String>();
|
||||
|
||||
var response = new
|
||||
{
|
||||
OldPassword = oldPassword.ComputeBase64Hash(),
|
||||
NewPassword = newPassword.ComputeBase64Hash(),
|
||||
ConfirmPassword = confirmPassword.ComputeBase64Hash()
|
||||
}
|
||||
.PutAsJson<Dictionary<String, String>>($"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login", headers =>
|
||||
{
|
||||
headers.Authorization = $"{Bearer} {bearer}";
|
||||
});
|
||||
var succeeded = response.HttpStatusCode == HttpStatusCode.OK;
|
||||
|
||||
if (!succeeded)
|
||||
{
|
||||
errors = response.Errors;
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
internal static Boolean Register(LDAPUser user, out Dictionary<String, String> errors)
|
||||
{
|
||||
errors = new Dictionary<String, String>();
|
||||
|
||||
var version = SoftwareVersion.Current;
|
||||
var response = new LDAPRegisterModel
|
||||
{
|
||||
Assembly = version.Name,
|
||||
BuildV = version.BuildV,
|
||||
ConfirmPassword = user.ConfirmPassword,
|
||||
DomainName = user.DomainName,
|
||||
Email = user.Email,
|
||||
EmployeeId = user.EmployeeId,
|
||||
FirstName = user.FirstName,
|
||||
LastName = user.LastName,
|
||||
MajorV = version.MajorV,
|
||||
MinorV = version.MinorV,
|
||||
Password = user.Password,
|
||||
Phone = user.Phone,
|
||||
Username = user.Username
|
||||
}
|
||||
.PutAsJson<String>($"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/AD");
|
||||
var succeeded = response.HttpStatusCode == HttpStatusCode.OK;
|
||||
|
||||
if (succeeded)
|
||||
{
|
||||
IsRegistrationPending = false;
|
||||
|
||||
bearer = response
|
||||
?.Value
|
||||
?.Trim()
|
||||
?.Trim('"');
|
||||
softwareFunctions = GetFunctions();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(bearer))
|
||||
{
|
||||
UserName = $"{user.FirstName} {user.LastName}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = response.Errors;
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends login request and obtains an bearer authorization token.
|
||||
/// </summary>
|
||||
public static Boolean Login(String username, String password, out Dictionary<String, String> errors)
|
||||
{
|
||||
bearer = default(String);
|
||||
errors = new Dictionary<String, String>();
|
||||
|
||||
var response = new UserLoginModel
|
||||
{
|
||||
Username = username,
|
||||
Password = password,
|
||||
Assembly = SoftwareVersion.Current.Name,
|
||||
MajorV = SoftwareVersion.Current.MajorV,
|
||||
MinorV = SoftwareVersion.Current.MinorV,
|
||||
BuildV = SoftwareVersion.Current.BuildV,
|
||||
}
|
||||
.PostAsJson<String>($"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/Local");
|
||||
|
||||
if (response.HttpStatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
bearer = response
|
||||
.Value
|
||||
?.Trim()
|
||||
?.Trim('"');
|
||||
softwareFunctions = GetFunctions();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(bearer))
|
||||
{
|
||||
UserName = $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login"
|
||||
.GetAsJson<String>(headersHandler: headers =>
|
||||
{
|
||||
headers.Authorization = $"{Bearer} {bearer}";
|
||||
})
|
||||
.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errors = response.Errors;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(UserName))
|
||||
{
|
||||
UserName = "Options";
|
||||
}
|
||||
|
||||
return !string.IsNullOrWhiteSpace(bearer);
|
||||
}
|
||||
|
||||
public static IEnumerable<SoftwareFunctions> GetFunctions()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(bearer))
|
||||
{
|
||||
return Array.Empty<SoftwareFunctions>();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var response = $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Personalization/Software/Access"
|
||||
.GetAsJson<IEnumerable<SoftwareFunctions>>(headersHandler: headers =>
|
||||
{
|
||||
headers.Authorization = $"{Bearer} {bearer}";
|
||||
});
|
||||
|
||||
return response.Value;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
|
||||
return Array.Empty<SoftwareFunctions>();
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean IsEnabled(SoftwareFunctions softwareFunction)
|
||||
=> softwareFunction != SoftwareFunctions.NONE && softwareFunctions.Contains(softwareFunction);
|
||||
|
||||
public static void Logout()
|
||||
{
|
||||
UserName = "Options";
|
||||
bearer = default(String);
|
||||
softwareFunctions = Array.Empty<SoftwareFunctions>();
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
internal static String ComputeBase64Hash(this String plainText)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(plainText))
|
||||
{
|
||||
return plainText;
|
||||
}
|
||||
|
||||
var buffer = Encoding.UTF8.GetBytes(plainText);
|
||||
var hash = SHA256.Create().ComputeHash(buffer);
|
||||
|
||||
return Convert.ToBase64String(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public enum SoftwareFunctions
|
||||
{
|
||||
NONE,
|
||||
|
||||
DEV_FILE_CONTROL,
|
||||
DEV_FILE_SPLIT,
|
||||
DEV_LEGACY_TEST_APP,
|
||||
DEV_LOW_LEVEL_TOOLS,
|
||||
|
||||
GENERAL_ALARM,
|
||||
GENERAL_FIRMWARE_UPDATE,
|
||||
GENERAL_LUT_MANAGEMENT,
|
||||
GENERAL_LUT_UPDATE,
|
||||
GENERAL_PRESSURE_LOG,
|
||||
GENERAL_PULS_CONFIG,
|
||||
GENERAL_REGISTER_STORE,
|
||||
GENERAL_SETUP,
|
||||
GENERAL_STREAM_QUALITY,
|
||||
GENERAL_TEMP_METER,
|
||||
|
||||
LAA_MAPPING_NA,
|
||||
LAA_PASSWORD,
|
||||
LAA_PARAMETERIZATION,
|
||||
LAA_PROCESS_PARAMETER,
|
||||
LAA_REGISTER_HISTORY,
|
||||
LAA_ADMIN,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.DirectoryServices;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class SoftwareUser
|
||||
{
|
||||
public SoftwareUser()
|
||||
=> InitializeSoftwareUser();
|
||||
|
||||
public Int32 EmployeeId { get; private set; }
|
||||
|
||||
public String FirstName { get; private set; }
|
||||
|
||||
public String LastName { get; private set; }
|
||||
|
||||
public String Username { get; private set; }
|
||||
|
||||
public String Phone { get; private set; }
|
||||
|
||||
public String Email { get; private set; }
|
||||
|
||||
private void InitializeSoftwareUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
var currentUser = UserPrincipal.Current;
|
||||
|
||||
using (var directoryEntry = new DirectoryEntry($"LDAP://{currentUser.DistinguishedName}"))
|
||||
{
|
||||
using (var directorySearcher = new DirectorySearcher(directoryEntry))
|
||||
{
|
||||
var searchResult = directorySearcher.FindOne();
|
||||
|
||||
foreach (DictionaryEntry dictionaryEntry in searchResult.Properties)
|
||||
{
|
||||
if (dictionaryEntry.Key is String property)
|
||||
{
|
||||
if (property.Equals("employeeid", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String value)
|
||||
{
|
||||
if (int.TryParse(value, out Int32 employeeId))
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("givenname", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String firstName)
|
||||
{
|
||||
FirstName = firstName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("sn", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String lastName)
|
||||
{
|
||||
LastName = lastName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("mail", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String email)
|
||||
{
|
||||
Email = email;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("telephonenumber", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String phone)
|
||||
{
|
||||
Phone = phone;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (property.Equals("samaccountname", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (dictionaryEntry.Value is ResultPropertyValueCollection dictionaryEntryValues)
|
||||
{
|
||||
if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is String username)
|
||||
{
|
||||
Username = username.ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public struct SoftwareVersion
|
||||
{
|
||||
private SoftwareVersion(Boolean initialize)
|
||||
{
|
||||
Name = "unknown";
|
||||
MajorV = 0;
|
||||
MinorV = 0;
|
||||
BuildV = 0;
|
||||
VersionString = "?";
|
||||
|
||||
AssemblyName = Assembly
|
||||
.GetEntryAssembly()?
|
||||
.GetName();
|
||||
if (AssemblyName != null)
|
||||
{
|
||||
Name = AssemblyName.Name;
|
||||
|
||||
var version = AssemblyName.Version;
|
||||
|
||||
MajorV = version.Major;
|
||||
MinorV = version.Minor;
|
||||
BuildV = version.Build;
|
||||
VersionString = $"{MajorV}.{MinorV}.{BuildV}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String Name { get; internal set; }
|
||||
|
||||
public Int32 MajorV { get; internal set; }
|
||||
|
||||
public Int32 MinorV { get; internal set; }
|
||||
|
||||
public Int32 BuildV { get; internal set; }
|
||||
|
||||
public String VersionString { get; }
|
||||
|
||||
public AssemblyName AssemblyName { get; }
|
||||
|
||||
public override String ToString()
|
||||
=> $"{nameof(Version)}: {VersionString}";
|
||||
|
||||
public static SoftwareVersion Current = new SoftwareVersion(true);
|
||||
|
||||
public static implicit operator String(SoftwareVersion assemblyVersion)
|
||||
=> assemblyVersion.ToString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Timers;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public interface ITempMeterForm
|
||||
{
|
||||
void AddMessage(String message);
|
||||
|
||||
void StartRecording();
|
||||
|
||||
void InvokeOnUIThread(Action action);
|
||||
|
||||
IDictionary<String, Double> GetAverageTOFForeachMeter();
|
||||
}
|
||||
|
||||
public partial class AutomaticTemperatureCalibration
|
||||
{
|
||||
private readonly ITempMeterForm tempMeterForm;
|
||||
private TemperatureSource temperatureSource;
|
||||
private readonly String outputFile;
|
||||
|
||||
private Timer timer;
|
||||
private Boolean hasHeaders;
|
||||
|
||||
public AutomaticTemperatureCalibration(ITempMeterForm tempMeterForm)
|
||||
{
|
||||
this.tempMeterForm = tempMeterForm;
|
||||
outputFile = Path.Combine(Appsettings.WorkingDirectory, $"{DateTime.Now:yyyy_MM_dd}_mesurements.txt");
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
|
||||
File.AppendAllText(outputFile, default(String));
|
||||
}
|
||||
|
||||
public void StartMessuring()
|
||||
{
|
||||
temperatureSource = new TemperatureSource();
|
||||
tempMeterForm.StartRecording();
|
||||
GetResults(null, null);
|
||||
|
||||
timer = new Timer()
|
||||
{
|
||||
AutoReset = true,
|
||||
Interval = Appsettings.MessurementStep,
|
||||
};
|
||||
timer.Elapsed += GetResults;
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
private void GetResults(Object sender, ElapsedEventArgs args)
|
||||
{
|
||||
tempMeterForm.InvokeOnUIThread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var temp = temperatureSource.GetTemperature();
|
||||
var results = tempMeterForm.GetAverageTOFForeachMeter();
|
||||
|
||||
if (!hasHeaders)
|
||||
{
|
||||
File.AppendAllText(outputFile, $"Timestamp;°C;{string.Join(";", results.Keys)}{Environment.NewLine}");
|
||||
|
||||
hasHeaders = true;
|
||||
}
|
||||
|
||||
var messurement = $"{temp:0.00};{string.Join(";", results.Values.Select(x => $"{x:0.0000000000}"))}";
|
||||
|
||||
File.AppendAllText(outputFile, $"{messurement}{Environment.NewLine}");
|
||||
|
||||
tempMeterForm.AddMessage(messurement);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
tempMeterForm.AddMessage(e.ToString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void StopMessuring()
|
||||
{
|
||||
try
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
timer = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
tempMeterForm.AddMessage($"{e}");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
temperatureSource.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
tempMeterForm.AddMessage($"{e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public class TemperatureSource : IDisposable
|
||||
{
|
||||
[DllImport("GMH3x32E.dll")]
|
||||
public static extern Int16 UniversalOpenCom(Int16 ini16COMPortNumber, UInt32 inui32BaudRate, Int16 inui16ConverterType, Int16 ini16Parity, Int16 ini16StoppBits);
|
||||
|
||||
[DllImport("GMH3x32E.dll")]
|
||||
public static extern Int16 GMH_CloseCom();
|
||||
|
||||
[DllImport("GMH3x32E.dll")]
|
||||
unsafe public static extern Int16 GMH_Transmit(Int16 ini16DeviceAddress, Int16 ini16TransmitCode, Int16* refi16ptrPriority, Double* refdblptrFloatValue, Int32* refi32ptrIntegerValue);
|
||||
|
||||
private readonly Boolean connected;
|
||||
|
||||
public TemperatureSource()
|
||||
=> connected = UniversalOpenCom(Appsettings.GMHPort, 4800, 8, 0, 0) == 2;
|
||||
|
||||
public Double GetTemperature()
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = default(Int16);
|
||||
var priority = default(Int16);
|
||||
var temperature = double.MinValue;
|
||||
var value = default(Int32);
|
||||
|
||||
unsafe
|
||||
{
|
||||
result = GMH_Transmit(1, 0, &priority, &temperature, &value);
|
||||
}
|
||||
|
||||
if (temperature < 50)
|
||||
{
|
||||
return -1.11;
|
||||
}
|
||||
else if (temperature > 50)
|
||||
{
|
||||
return 1.11;
|
||||
}
|
||||
|
||||
return temperature;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> GMH_CloseCom();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
public enum ProgressBarDisplayMode
|
||||
{
|
||||
NoText,
|
||||
Percentage,
|
||||
CurrProgress,
|
||||
CustomText,
|
||||
TextAndPercentage,
|
||||
TextAndCurrProgress
|
||||
}
|
||||
|
||||
public class TextProgressBar : ProgressBar
|
||||
{
|
||||
[Description("Font of the text on ProgressBar"), Category("Additional Options")]
|
||||
public Font TextFont { get; set; } = new Font(FontFamily.GenericSerif, 11, FontStyle.Bold | FontStyle.Italic);
|
||||
|
||||
private SolidBrush _textColourBrush = (SolidBrush)Brushes.Black;
|
||||
[Category("Additional Options")]
|
||||
public Color TextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _textColourBrush.Color;
|
||||
}
|
||||
set
|
||||
{
|
||||
_textColourBrush.Dispose();
|
||||
_textColourBrush = new SolidBrush(value);
|
||||
}
|
||||
}
|
||||
|
||||
private SolidBrush _progressColourBrush = (SolidBrush)Brushes.LightGreen;
|
||||
[Category("Additional Options"), Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public Color ProgressColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _progressColourBrush.Color;
|
||||
}
|
||||
set
|
||||
{
|
||||
_progressColourBrush.Dispose();
|
||||
_progressColourBrush = new SolidBrush(value);
|
||||
}
|
||||
}
|
||||
|
||||
private ProgressBarDisplayMode _visualMode = ProgressBarDisplayMode.CurrProgress;
|
||||
[Category("Additional Options"), Browsable(true)]
|
||||
public ProgressBarDisplayMode VisualMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _visualMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_visualMode = value;
|
||||
Invalidate();//redraw component after change value from VS Properties section
|
||||
}
|
||||
}
|
||||
|
||||
private String _text = string.Empty;
|
||||
|
||||
[Description("If it's empty, % will be shown"), Category("Additional Options"), Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
|
||||
public String CustomText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
set
|
||||
{
|
||||
_text = value;
|
||||
Invalidate();//redraw component after change value from VS Properties section
|
||||
}
|
||||
}
|
||||
|
||||
private String _textToDraw
|
||||
{
|
||||
get
|
||||
{
|
||||
String text = CustomText;
|
||||
|
||||
switch (VisualMode)
|
||||
{
|
||||
case (ProgressBarDisplayMode.Percentage):
|
||||
text = _percentageStr;
|
||||
break;
|
||||
case (ProgressBarDisplayMode.CurrProgress):
|
||||
text = _currProgressStr;
|
||||
break;
|
||||
case (ProgressBarDisplayMode.TextAndCurrProgress):
|
||||
text = $"{CustomText}: {_currProgressStr}";
|
||||
break;
|
||||
case (ProgressBarDisplayMode.TextAndPercentage):
|
||||
text = $"{CustomText}: {_percentageStr}";
|
||||
break;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
set { }
|
||||
}
|
||||
|
||||
private String _percentageStr { get { return $"{(Int32)((Single)Value - Minimum) / ((Single)Maximum - Minimum) * 100 } %"; } }
|
||||
|
||||
private String _currProgressStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{Value}/{Maximum}";
|
||||
}
|
||||
}
|
||||
|
||||
public TextProgressBar()
|
||||
{
|
||||
Value = Minimum;
|
||||
FixComponentBlinking();
|
||||
}
|
||||
|
||||
private void FixComponentBlinking()
|
||||
{
|
||||
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
DrawProgressBar(g);
|
||||
|
||||
DrawStringIfNeeded(g);
|
||||
}
|
||||
|
||||
private void DrawProgressBar(Graphics g)
|
||||
{
|
||||
Rectangle rect = ClientRectangle;
|
||||
|
||||
ProgressBarRenderer.DrawHorizontalBar(g, rect);
|
||||
|
||||
rect.Inflate(-3, -3);
|
||||
|
||||
if (Value > 0)
|
||||
{
|
||||
Rectangle clip = new Rectangle(rect.X, rect.Y, (Int32)Math.Round(((Single)Value / Maximum) * rect.Width), rect.Height);
|
||||
try
|
||||
{
|
||||
g.FillRectangle(_progressColourBrush, clip);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawStringIfNeeded(Graphics g)
|
||||
{
|
||||
if (VisualMode != ProgressBarDisplayMode.NoText)
|
||||
{
|
||||
|
||||
String text = _textToDraw;
|
||||
|
||||
SizeF len = g.MeasureString(text, TextFont);
|
||||
|
||||
Point location = new Point(((Width / 2) - (Int32)len.Width / 2), ((Height / 2) - (Int32)len.Height / 2));
|
||||
|
||||
g.DrawString(text, TextFont, (Brush)_textColourBrush, location);
|
||||
}
|
||||
}
|
||||
|
||||
public new void Dispose()
|
||||
{
|
||||
_textColourBrush.Dispose();
|
||||
_progressColourBrush.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
<?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>{2D55BBD1-5373-484C-8781-C6ECEAFC2A90}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Xylem.Common.Utils.UserAccessCtrl</RootNamespace>
|
||||
<AssemblyName>Xylem.Common.Utils.UserAccessCtrl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</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>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ADLoginModel.cs" />
|
||||
<Compile Include="ApplicationHttp.cs" />
|
||||
<Compile Include="ApplicationState.cs" />
|
||||
<Compile Include="ApplicationVersion.cs" />
|
||||
<Compile Include="Appsettings.cs" />
|
||||
<Compile Include="ChangePassword.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ChangePassword.Designer.cs">
|
||||
<DependentUpon>ChangePassword.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CordonelTempLut.cs" />
|
||||
<Compile Include="IIdentityForm.cs" />
|
||||
<Compile Include="LDAPLoginModel.cs" />
|
||||
<Compile Include="LDAPRegisterModel.cs" />
|
||||
<Compile Include="LDAPUser.cs" />
|
||||
<Compile Include="LoginForm.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LoginForm.Designer.cs">
|
||||
<DependentUpon>LoginForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ParseExtensions.cs" />
|
||||
<Compile Include="Properties\Resources.de.Designer.cs">
|
||||
<DependentUpon>Resources.de.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RefTempRange.cs" />
|
||||
<Compile Include="RegisterLDAPUser.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RegisterLDAPUser.Designer.cs">
|
||||
<DependentUpon>RegisterLDAPUser.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Software.cs" />
|
||||
<Compile Include="SoftwareFunctions.cs" />
|
||||
<Compile Include="SoftwareUser.cs" />
|
||||
<Compile Include="SoftwareVersion.cs" />
|
||||
<Compile Include="TemperatureSource.cs" />
|
||||
<Compile Include="TempMeterModels.cs" />
|
||||
<Compile Include="TextProgressBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UserLoginModel.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ChangePassword.resx">
|
||||
<DependentUpon>ChangePassword.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LoginForm.resx">
|
||||
<DependentUpon>LoginForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.de.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="RegisterLDAPUser.resx">
|
||||
<DependentUpon>RegisterLDAPUser.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CommonCore.Configuration\CommonCore.Configuration.csproj">
|
||||
<Project>{9EB1F659-6F73-4F65-BCAB-4114FD94F5FC}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SoftwareAccessHelper\SoftwareAccessHelper.csproj">
|
||||
<Project>{A33E3C6D-EAAE-4A20-A0EE-F9E6922FD029}</Project>
|
||||
<Name>SoftwareAccessHelper</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<ProjectConfiguration>
|
||||
<Settings>
|
||||
<HiddenComponentWarnings />
|
||||
</Settings>
|
||||
</ProjectConfiguration>
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Utils.UserAccessCtrl
|
||||
{
|
||||
internal class UserLoginModel
|
||||
{
|
||||
public String Assembly { get; set; }
|
||||
|
||||
public Int32 MajorV { get; set; }
|
||||
|
||||
public Int32 MinorV { get; set; }
|
||||
|
||||
public Int32 BuildV { get; set; }
|
||||
|
||||
public String Username { get; set; }
|
||||
|
||||
public String Password { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user