Approval by legalizator when #define LANG_PL, ver. 3.5.1993

This commit is contained in:
Milan Hanajik 2022-11-23 16:27:14 +01:00
parent 6dcd40c640
commit 9e9a01bd43
12 changed files with 794 additions and 8 deletions

View File

@ -96,6 +96,16 @@ namespace Common
return string.Format("{0},{1},{2}", User().UserName, User2.UserName, User3.UserName);
}
public static string GetEncodedString(string legalizator)
{
if (User() == null || User().UserName == null) return string.Empty;
return string.Format("{0}~{1}~{2}",
User().UserName,
User().FullName == null ? string.Empty : User().FullName,
legalizator == null ? string.Empty : legalizator);
}
/// <summary>
/// Return the current user number or 0
/// </summary>

View File

@ -501,5 +501,10 @@ namespace SharedDatabase.Entities
{
return string.Format("{0}~{1}~{2}", UserName, FullName, legalizator);
}
public virtual string ToEncodedStr(string _legalizator)
{
return string.Format("{0}~{1}~{2}", UserName, FullName, _legalizator);
}
}
}

View File

@ -0,0 +1,112 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
namespace SharedDatabase.Forms
{
partial class PlainLoginDlg
{
/// <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 Windows Form 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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PlainLoginDlg));
this.userNameLabel = new System.Windows.Forms.Label();
this.passwordLabel = new System.Windows.Forms.Label();
this.passwordTextBox = new System.Windows.Forms.TextBox();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.userNameTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// aliasLabel
//
resources.ApplyResources(this.userNameLabel, "aliasLabel");
this.userNameLabel.Name = "aliasLabel";
//
// passwordLabel
//
resources.ApplyResources(this.passwordLabel, "passwordLabel");
this.passwordLabel.Name = "passwordLabel";
//
// passwordTextBox
//
resources.ApplyResources(this.passwordTextBox, "passwordTextBox");
this.passwordTextBox.Name = "passwordTextBox";
this.passwordTextBox.UseSystemPasswordChar = true;
this.passwordTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.passwordTextBox_KeyPress);
//
// cancelButton
//
resources.ApplyResources(this.cancelButton, "cancelButton");
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Name = "cancelButton";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
resources.ApplyResources(this.okButton, "okButton");
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Name = "okButton";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// userNameTextBox
//
resources.ApplyResources(this.userNameTextBox, "userNameTextBox");
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.userNameTextBox_KeyPress);
//
// PlainLoginDlg
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.Controls.Add(this.userNameTextBox);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.passwordTextBox);
this.Controls.Add(this.passwordLabel);
this.Controls.Add(this.userNameLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "PlainLoginDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PlainLoginDlg_FormClosing);
this.Load += new System.EventHandler(this.LoginDlg_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label userNameLabel;
private System.Windows.Forms.Label passwordLabel;
private System.Windows.Forms.TextBox userNameTextBox;
private System.Windows.Forms.TextBox passwordTextBox;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
}
}

View File

@ -0,0 +1,315 @@
///
/// Copyright (c) 2022 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
using System.Windows.Forms;
using log4net;
using Common;
using GemCard;
using SharedDatabase.Entities;
using SharedDatabase.Resources;
namespace SharedDatabase.Forms
{
/// <summary>
/// Provides login dialog as well as user authorization using TBF.User.Authorize(...)
/// (i.e. when DialogResult is OK, user was authorized).
/// </summary>
public partial class PlainLoginDlg : Form
{
private static readonly ILog log = LogManager.GetLogger(typeof(PlainLoginDlg));
/// Public readonly
public string UserName { get { return user; } }
public string FullName { get { return fullName; } }
/// Private fields
string user;
string password;
GID[] requiredGroupMembership;
bool noDatabase;
Color oriBackColor;
string fullName; /// Description of the selected user
/// Smart card support, card S/N is used as user.Tag
CardNative card;
string smartCardReader;
public LoginMethod Method;
public string VersionString;
/// <summary>
/// Constructor.
/// </summary>
public PlainLoginDlg()
{
InitializeComponent();
oriBackColor = BackColor;
}
/// <summary>
/// Constructor with a predefined user.
/// </summary>
public PlainLoginDlg(string predefinedUser, string prompt = null)
: this()
{
user = predefinedUser;
userNameTextBox.Text = predefinedUser;
if (prompt != null) Text = prompt;
}
/// <summary>
/// Constructor with 'no Database' flag.
/// </summary>
public PlainLoginDlg(bool noDatabase, string prompt = null)
: this()
{
this.noDatabase = noDatabase;
if (prompt != null) Text = prompt;
}
/// <summary>
/// Constructor when a specific group membership is required.
/// </summary>
public PlainLoginDlg(GID[] requiredGroupMembership, string prompt = null)
: this()
{
this.requiredGroupMembership = requiredGroupMembership;
if (prompt != null) Text = prompt;
}
/// <summary>
/// Constructor with a predefined user when a specific group membership is required.
/// </summary>
public PlainLoginDlg(string predefinedUser, GID[] requiredGroupMembership, string prompt = null)
: this()
{
user = predefinedUser;
userNameTextBox.Text = predefinedUser;
this.requiredGroupMembership = requiredGroupMembership;
Text = (prompt != null) ? prompt : Strings.User_Login + (string.IsNullOrEmpty(VersionString) ? "" : (" " + VersionString));
}
private void LoginDlg_Load(object sender, EventArgs e)
{
Localize();
if (user == null)
userNameTextBox.Select();
else
passwordTextBox.Select();
///
/// Smart card reader detection
///
smartCardReader = null; /// null = No smart card reader detected
#if TURA_IPERL || TURA_IPERL_NEW || TURA_SPECIAL
try
{
card = new CardNative();
/// Find NFC smart card reader
string[] cardReaders = card.ListReaders();
if (cardReaders != null)
{
foreach (var crd in cardReaders)
{
log.WarnFormat("SMART card reader found: {0}", crd);
}
foreach (var crd in cardReaders)
{
if (crd.Contains("NFC"))
{
log.ErrorFormat("SMART card reader selected: {0}", crd);
smartCardReader = crd; /// NFC smart card reader detected
break;
}
}
}
if (!string.IsNullOrEmpty(smartCardReader))
{
/// Reader found, initialize NFC smart card reader
card.OnCardInserted += delegate(object sndr, CardInsertedEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<CardInsertedEventArgs>(OnCardInserted), sndr, args); }
else OnCardInserted(sndr, args);
};
card.OnCardRemoved += delegate(object sndr, CardRemovedEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<CardRemovedEventArgs>(OnCardRemoved), sndr, args); }
else OnCardRemoved(sndr, args);
};
card.StartCardEvents(smartCardReader);
Text += " (NFC)";
}
}
catch (Exception)
{
smartCardReader = null;
}
#endif
}
void Localize()
{
userNameLabel.Text = Strings.User_name;
passwordLabel.Text = Strings.Password;
okButton.Text = Strings.OkBtnText;
cancelButton.Text = Strings.CancelBtnText;
}
/// <summary>
/// Try to authorize the user when OK clicked.
/// </summary>
private void okButton_Click(object sender, EventArgs e)
{
user = userNameTextBox.Text;
password = passwordTextBox.Text;
bool authorized = Common.Utils.IsPowerUser(user, password);
if (authorized) fullName = "Power user";
if (!authorized && !noDatabase)
{
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
foreach (var db in dbs)
{
try
{
var usr1 = Entities.User.LoadUserByName(user, db);
if (usr1.IsMemberOf(requiredGroupMembership) && usr1.IsCorrectPassword(password))
{
authorized = true;
fullName = usr1.FullName;
break;
}
}
catch (Exception) { }
}
}
if (authorized)
{
DialogResult = DialogResult.OK;
Close();
return;
}
MessageBox.Show(Strings.Invalid_username_or_password, Strings.Error, MessageBoxButtons.OK);
DialogResult = DialogResult.None;
return;
}
/// <summary>
/// Cancel clicked, do not try to authorize.
/// </summary>
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
return;
}
private void userNameTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (Convert.ToInt32(e.KeyChar) == 13)
{
passwordTextBox.Focus();
}
}
private void passwordTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
if (Convert.ToInt32(e.KeyChar) == 13)
{
okButton_Click(sender, e);
}
}
void OnCardInserted(object sender, CardInsertedEventArgs args)
{
string tag = string.Empty;
try
{
BackColor = Color.Green;
card.Connect(smartCardReader, SHARE.Shared, PROTOCOL.T0orT1);
/// Read the serial number of the card
APDUResponse response = card.Transmit(new APDUCommand(0xFF, 0xCA, 0x00, 0x00, null, 7));
tag = response.ToString();
card.Disconnect(DISCONNECT.Leave);
}
catch
{
tag = string.Empty;
}
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
bool authorized = false;
AuthorizedAs authorizedAs = AuthorizedAs.RemoteUser;
///
foreach (var db in dbs)
{
try
{
Entities.User loadedUser = Entities.User.LoadUserByTag(tag, db);
if (loadedUser != null)
{
authorized = (tag == loadedUser.Tag && loadedUser.IsMemberOf(requiredGroupMembership));
if (authorized)
{
user = loadedUser.UserName;
break;
}
}
}
catch (Exception) { }
authorizedAs = AuthorizedAs.LocalUser;
}
if (authorized)
{
CurrentUser.AuthorizedAs = authorizedAs;
DialogResult = DialogResult.OK;
Close();
return;
}
MessageBox.Show(Strings.Invalid_username_or_password, Strings.Error, MessageBoxButtons.OK);
DialogResult = DialogResult.None;
return;
}
void OnCardRemoved(object sender, CardRemovedEventArgs args)
{
BackColor = oriBackColor;
}
private void PlainLoginDlg_FormClosing(object sender, FormClosingEventArgs e)
{
if (!string.IsNullOrEmpty(smartCardReader))
{
try { card.StopCardEvents(); }
catch { }
}
}
}
}

View File

@ -0,0 +1,300 @@
<?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>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="aliasLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="aliasLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 24</value>
</data>
<data name="aliasLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>58, 13</value>
</data>
<data name="aliasLabel.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="aliasLabel.Text" xml:space="preserve">
<value>User name</value>
</data>
<data name="&gt;&gt;aliasLabel.Name" xml:space="preserve">
<value>aliasLabel</value>
</data>
<data name="&gt;&gt;aliasLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;aliasLabel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;aliasLabel.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="passwordLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="passwordLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>11, 51</value>
</data>
<data name="passwordLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 13</value>
</data>
<data name="passwordLabel.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="passwordLabel.Text" xml:space="preserve">
<value>Password</value>
</data>
<data name="&gt;&gt;passwordLabel.Name" xml:space="preserve">
<value>passwordLabel</value>
</data>
<data name="&gt;&gt;passwordLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;passwordLabel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;passwordLabel.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="passwordTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="passwordTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 48</value>
</data>
<data name="passwordTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>168, 20</value>
</data>
<data name="passwordTextBox.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;passwordTextBox.Name" xml:space="preserve">
<value>passwordTextBox</value>
</data>
<data name="&gt;&gt;passwordTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;passwordTextBox.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;passwordTextBox.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="cancelButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="cancelButton.Location" type="System.Drawing.Point, System.Drawing">
<value>336, 48</value>
</data>
<data name="cancelButton.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 28</value>
</data>
<data name="cancelButton.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="cancelButton.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="&gt;&gt;cancelButton.Name" xml:space="preserve">
<value>cancelButton</value>
</data>
<data name="&gt;&gt;cancelButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cancelButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cancelButton.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="okButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="okButton.Location" type="System.Drawing.Point, System.Drawing">
<value>336, 14</value>
</data>
<data name="okButton.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 28</value>
</data>
<data name="okButton.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="okButton.Text" xml:space="preserve">
<value>OK</value>
</data>
<data name="&gt;&gt;okButton.Name" xml:space="preserve">
<value>okButton</value>
</data>
<data name="&gt;&gt;okButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;okButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;okButton.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="userNameTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="userNameTextBox.Location" type="System.Drawing.Point, System.Drawing">
<value>150, 22</value>
</data>
<data name="userNameTextBox.Size" type="System.Drawing.Size, System.Drawing">
<value>168, 20</value>
</data>
<data name="userNameTextBox.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;userNameTextBox.Name" xml:space="preserve">
<value>userNameTextBox</value>
</data>
<data name="&gt;&gt;userNameTextBox.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;userNameTextBox.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;userNameTextBox.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>456, 88</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>User login</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>LoginDlg</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -115,7 +115,7 @@ namespace SharedDatabase.Resources {
}
/// <summary>
/// Looks up a localized string similar to calibration specialist.
/// Looks up a localized string similar to legalizator.
/// </summary>
internal static string calibration_specialist {
get {

View File

@ -157,7 +157,7 @@
<value>Are you sure?</value>
</data>
<data name="calibration_specialist" xml:space="preserve">
<value>calibration specialist</value>
<value>legalizator</value>
</data>
<data name="CancelBtnText" xml:space="preserve">
<value>Cancel</value>

View File

@ -102,6 +102,12 @@
<Compile Include="Forms\PasswordChangeDlg.designer.cs">
<DependentUpon>PasswordChangeDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\PlainLoginDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\PlainLoginDlg.Designer.cs">
<DependentUpon>PlainLoginDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\TripleLoginDlg.cs">
<SubType>Form</SubType>
</Compile>
@ -187,6 +193,9 @@
<EmbeddedResource Include="Forms\PasswordChangeDlg.resx">
<DependentUpon>PasswordChangeDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\PlainLoginDlg.resx">
<DependentUpon>PlainLoginDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TripleLoginDlg.resx">
<DependentUpon>TripleLoginDlg.cs</DependentUpon>
</EmbeddedResource>

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.5.1992.0")]
[assembly: AssemblyFileVersion("3.5.1992.0")]
[assembly: AssemblyVersion("3.5.1993.0")]
[assembly: AssemblyFileVersion("3.5.1993.0")]

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -24,6 +24,9 @@ namespace TBF.Rig.Sequences
public override string ToString() { return "Sequences.MainSeq"; }
bool isApprovedByLegalizator = false;
string legalizatorName = string.Empty;
DateTime lastApprovalByLegalizatorTime;
int simultWithPurgingCount;
Generic.IComponentCfg simultWithPurgingCfg;
@ -354,13 +357,24 @@ namespace TBF.Rig.Sequences
StateMachine.Procedure = null;
}
}
catch (Exception)
catch (Exception exc)
{
string msg = exc.Message;
StateMachine.Procedure = null;
}
}
while (StateMachine.Procedure == null); /// Make sure a valid procedure is selected
#if LANG_PL
///
/// Approval of a legalizator
///
if (!string.IsNullOrEmpty(StateMachine.Procedure.AltProcName) && !IsApprovedByLegalizator())
{
goto select_procedure; /// Loop back to procedure selection if not approved by a legalizator
}
#endif
Debug.WriteLine(string.Empty);
Debug.WriteLine(string.Format("TransitionSequences {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSequences) ? "initialized" : "NOT initialized"));
Debug.WriteLine(string.Format("TransitionSteps {0}", NHibernateUtil.IsInitialized(StateMachine.TransitionSteps) ? "initialized" : "NOT initialized"));
@ -1458,6 +1472,27 @@ namespace TBF.Rig.Sequences
}
bool IsApprovedByLegalizator()
{
if (isApprovedByLegalizator && DateTime.Now < lastApprovalByLegalizatorTime.Date.AddDays(1))
{
return true;
}
var loginDlg = new SharedDatabase.Forms.PlainLoginDlg(new GID[] { GID.CalibrationSpecialists }, "Approval by legalizator");
if (loginDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
isApprovedByLegalizator = true;
legalizatorName = loginDlg.FullName;
lastApprovalByLegalizatorTime = DateTime.Now;
return true;
}
legalizatorName = string.Empty;
return false;
}
/// <summary>
/// MakeSelection() call context
/// </summary>

View File

@ -614,7 +614,7 @@ namespace TBF.Rig.Sequences
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
CurrentUser.UserName(),
CurrentUser.GetEncodedString(legalizatorName),
CurrentUser.Number(),
Program.Version,
StateMachine.Procedure,

View File

@ -55,7 +55,7 @@ namespace TBF.UI.Shared
{
benchName = predefinedBench;
#if LANG_PL || BAHRAIN_50
#if BAHRAIN_50
Height = 156;
EnableAndPrepareLegalizatorCombo(legalizatorComboBox);
#else