GTB identity employee nr search
This commit is contained in:
@@ -9,30 +9,34 @@
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
var connection = new OmniUniProConnection("COM9");
|
||||
var connection = new OmniIrdaConnection("COM26");
|
||||
connection.StateChenged += Console.WriteLine;
|
||||
|
||||
connection.Open();
|
||||
connection.FactorySeal(false);
|
||||
connection.ViewBuildInformation();
|
||||
connection.ViewFactoryCorrection();
|
||||
var defaults = connection.ViewInputVolume();
|
||||
connection.Set(new RegisterSettings
|
||||
{
|
||||
IntPart = defaults.IntPart,
|
||||
Fraction = defaults.Fraction,
|
||||
Size = defaults.Size,
|
||||
Range = defaults.Range,
|
||||
VolumePerPulseUnit = 0,
|
||||
MeterUnits = (byte)MessurementUnits.CubicMeters,
|
||||
FlowUnits = (byte)MessurementUnits.CubicMeters,
|
||||
FlowRate = (byte)TimeUnits.Hours,
|
||||
FactoryCorrection = 0,
|
||||
FieldCorrection = 0,
|
||||
PulseWeight = 0,
|
||||
PulseWidth = 7,
|
||||
PulseUpdate = 0,
|
||||
});
|
||||
|
||||
Console.WriteLine(connection.ViewBuildInformation().Value);
|
||||
Console.WriteLine(connection.ViewFactoryCorrection().Value);
|
||||
|
||||
var rs = connection.ViewRegisterSettings();
|
||||
//connection.ViewBuildInformation();
|
||||
//connection.ViewFactoryCorrection();
|
||||
//var defaults = connection.ViewInputVolume();
|
||||
//connection.Set(new RegisterSettings
|
||||
//{
|
||||
// IntPart = defaults.IntPart,
|
||||
// Fraction = defaults.Fraction,
|
||||
// Size = defaults.Size,
|
||||
// Range = defaults.Range,
|
||||
// VolumePerPulseUnit = 0,
|
||||
// MeterUnits = (byte)MessurementUnits.CubicMeters,
|
||||
// FlowUnits = (byte)MessurementUnits.CubicMeters,
|
||||
// FlowRate = (byte)TimeUnits.Hours,
|
||||
// FactoryCorrection = 0,
|
||||
// FieldCorrection = 0,
|
||||
// PulseWeight = 0,
|
||||
// PulseWidth = 7,
|
||||
// PulseUpdate = 0,
|
||||
//});
|
||||
|
||||
|
||||
connection.Close();
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
EmployeeId = user.EmployeeId
|
||||
});
|
||||
|
||||
if (authenticationResponse.StatusCode == HttpStatusCode.OK)
|
||||
if (authenticationResponse.StatusCode == HttpStatusCode.Accepted)
|
||||
{
|
||||
IsRegistrationPending = true;
|
||||
}
|
||||
else if (authenticationResponse.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
bearer = authenticationResponse
|
||||
?.Content
|
||||
@@ -66,10 +70,6 @@
|
||||
UserName = $"{user.FirstName} {user.LastName}";
|
||||
}
|
||||
}
|
||||
else if (authenticationResponse.StatusCode == HttpStatusCode.Accepted)
|
||||
{
|
||||
IsRegistrationPending = true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(UserName))
|
||||
{
|
||||
@@ -253,7 +253,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 19207 Stoyan Zlatev +49 (5102) 74 3005 AD True 0 szlatev rd rd NULL 2017-07-18 00:00:00 6271 NULL 0 False Stoyan.Zlatev@xylem.com NULL NULL False False NULL NULL NULL NULL
|
||||
*/
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
model.DomainName,
|
||||
model.Password);
|
||||
|
||||
if (employeeNr <= 0)
|
||||
if (employeeNr < 0)
|
||||
{
|
||||
employeeNr = this.employeesRepository.Insert(
|
||||
model.EmployeeId,
|
||||
@@ -213,6 +213,11 @@
|
||||
model.Password);
|
||||
}
|
||||
|
||||
if (employeeNr <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bearer = this.GetOrCreateAuthToken(softwareId, employeeNr);
|
||||
|
||||
return true;
|
||||
|
||||
+88
-21
@@ -4,7 +4,7 @@
|
||||
using LaaProduction.Personalization.Repositories.Interfaces;
|
||||
|
||||
using LaaProductionSQL.Interfaces;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -227,27 +227,94 @@
|
||||
.ExecuteNonQuery() == 1;
|
||||
|
||||
public short Update(int employeeId, string firstName, string lastName, string phone, string email, string username, string domainname, string password)
|
||||
=> this.sqlConnection
|
||||
{
|
||||
var employeeNr = this.FindEmployeeNr(firstName, lastName, email, domainname);
|
||||
|
||||
if (employeeNr > 0)
|
||||
{
|
||||
this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [EmployeeId] = ISNULL([EmployeeId] , @{nameof(employeeId)})
|
||||
, [eMail] = ISNULL([eMail] , @{nameof(email)})
|
||||
, [Telefon] = ISNULL([Telefon] , @{nameof(phone)})
|
||||
, [Benutzername] = ISNULL([Benutzername] , @{nameof(username)})
|
||||
, [DomainUser] = ISNULL([DomainUser] , @{nameof(domainname)})
|
||||
, [PasswordHash] = ISNULL([PasswordHash] , @{nameof(password)})
|
||||
WHERE [MitarbeiterNr] = @{nameof(employeeNr)}")
|
||||
.SetParameter(nameof(employeeNr), employeeNr)
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
.SetParameter(nameof(lastName), lastName)
|
||||
.SetParameter(nameof(phone), phone)
|
||||
.SetParameter(nameof(email), email)
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.SetParameter(nameof(password), password)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
return employeeNr.Value;
|
||||
}
|
||||
|
||||
if (employeeNr is null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return default(short);
|
||||
}
|
||||
}
|
||||
|
||||
private short? FindEmployeeNr(string firstName, string lastName, string email, string domainname)
|
||||
{
|
||||
var employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE [Mitarbeiter]
|
||||
SET [EmployeeId] = ISNULL(@{nameof(employeeId)} , [EmployeeId])
|
||||
, [eMail] = ISNULL(@{nameof(email)} , [eMail])
|
||||
, [Telefon] = ISNULL(@{nameof(phone)} , [Telefon])
|
||||
, [Benutzername] = ISNULL(@{nameof(username)} , [Benutzername])
|
||||
, [DomainUser] = ISNULL(@{nameof(domainname)} , [DomainUser])
|
||||
, [PasswordHash] = ISNULL(@{nameof(password)} , [PasswordHash])
|
||||
OUTPUT [inserted].[MitarbeiterNr]
|
||||
WHERE [Vorname] = @{nameof(firstName)}
|
||||
AND [Name] = @{nameof(lastName)}
|
||||
AND [DomainUser] IS NULL")
|
||||
.SetParameter(nameof(employeeId), employeeId)
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [Name] = @{nameof(lastName)}
|
||||
AND [Vorname] = @{nameof(firstName)}")
|
||||
.SetParameter(nameof(lastName), lastName)
|
||||
.SetParameter(nameof(phone), phone)
|
||||
.SetParameter(nameof(email), email)
|
||||
.SetParameter(nameof(username), username)
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.SetParameter(nameof(password), password)
|
||||
.ExecuteScalar(x => x.GetSmallint());
|
||||
.SetParameter(nameof(firstName), firstName)
|
||||
.ExecuteReader(x => x.GetSmallint())
|
||||
.ToList();
|
||||
|
||||
if (employeeNumbers.Count != 1)
|
||||
{
|
||||
employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [eMail] = @{nameof(email)}")
|
||||
.SetParameter(nameof(email), email)
|
||||
.ExecuteReader(x => x.GetSmallint())
|
||||
.ToList();
|
||||
|
||||
if (employeeNumbers.Count != 1)
|
||||
{
|
||||
employeeNumbers = this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
SELECT [MitarbeiterNr]
|
||||
FROM [Mitarbeiter]
|
||||
WHERE [DomainUser] = @{nameof(domainname)}")
|
||||
.SetParameter(nameof(domainname), domainname)
|
||||
.ExecuteReader(x => x.GetSmallint())
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
if (employeeNumbers.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (employeeNumbers.Count > 1)
|
||||
{
|
||||
return default(short);
|
||||
}
|
||||
else
|
||||
{
|
||||
return employeeNumbers.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user