Common..CurrentUser static class with Stack<UserAndForm> userStack, Change( ) and Restore( ).
This commit is contained in:
parent
00fc9ea847
commit
f1f662a419
@ -64,6 +64,7 @@
|
||||
<DependentUpon>ModelessForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Formulas.cs" />
|
||||
<Compile Include="CurrentUser.cs" />
|
||||
<Compile Include="GlobalData.cs" />
|
||||
<Compile Include="IMeasurementCorrection.cs" />
|
||||
<Compile Include="IOrderInfo.cs" />
|
||||
|
||||
122
Common/CurrentUser.cs
Normal file
122
Common/CurrentUser.cs
Normal file
@ -0,0 +1,122 @@
|
||||
///
|
||||
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
class UserAndForm
|
||||
{
|
||||
public readonly IUser User;
|
||||
public readonly Form Form;
|
||||
|
||||
public UserAndForm(IUser user, Form form)
|
||||
{
|
||||
User = user;
|
||||
Form = form;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CurrentUser
|
||||
{
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
|
||||
public static int MinPasswdLength = 0;
|
||||
public static int PasswdExpirationPeriodDays = 0;
|
||||
|
||||
public static DBSettings RemoteUsersDB = null;
|
||||
public static DBSettings LocalUsersDB = null;
|
||||
|
||||
|
||||
static readonly Stack<UserAndForm> userStack = new Stack<UserAndForm>();
|
||||
|
||||
public static Common.AuthorizedAs AuthorizedAs;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Push a new user into the stack of users and form references.
|
||||
/// Prevent double user stack entry for the same Windows form.
|
||||
/// </summary>
|
||||
/// <param name="newUser">New user</param>
|
||||
/// <param name="currentForm">Reference to the current form</param>
|
||||
public static void Change(IUser newUser, Form currentForm)
|
||||
{
|
||||
if (userStack.Count > 0 && userStack.Peek().Form == currentForm)
|
||||
{
|
||||
userStack.Pop();
|
||||
}
|
||||
|
||||
userStack.Push(new UserAndForm(newUser, currentForm));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restore an original user from the stack of users - remove user at the top of the stack.
|
||||
/// Prevent restoring when there is no entry for the form currently being closed.
|
||||
/// </summary>
|
||||
/// <param name="formBeingClosed">Reference to the form currently being closed</param>
|
||||
/// <returns>true = current user was restored, false = no current user change</returns>
|
||||
public static bool Restore(Form formBeingClosed)
|
||||
{
|
||||
if (userStack.Count > 0 && userStack.Peek().Form == formBeingClosed)
|
||||
{
|
||||
userStack.Pop();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the user currenty at the top of the stack of users.
|
||||
/// </summary>
|
||||
public static IUser User()
|
||||
{
|
||||
return (userStack.Count > 0) ? userStack.Peek().User : null; /// TODO: Return default user when stack is empty
|
||||
}
|
||||
|
||||
public static IUser User2;
|
||||
public static IUser User3;
|
||||
|
||||
/// <summary>
|
||||
/// Return the current user name or an empty string
|
||||
/// </summary>
|
||||
public static string UserName()
|
||||
{
|
||||
if (User() == null || User().UserName == null)
|
||||
return string.Empty;
|
||||
else if (User2 == null || User2.UserName == null)
|
||||
return User().UserName;
|
||||
else if (User3 == null || User3.UserName == null)
|
||||
return string.Format("{0},{1}", User().UserName, User2.UserName);
|
||||
else
|
||||
return string.Format("{0},{1},{2}", User().UserName, User2.UserName, User3.UserName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the current user number or 0
|
||||
/// </summary>
|
||||
public static int Number()
|
||||
{
|
||||
return (User() != null) ? User().Number : 0;
|
||||
}
|
||||
|
||||
public static bool IsPowerUser()
|
||||
{
|
||||
return (User() != null) ? User().IsPowerUser() : false;
|
||||
}
|
||||
|
||||
public static bool IsMemberOf(GID groupId)
|
||||
{
|
||||
return (User() != null) ? User().IsMemberOf(groupId) : false;
|
||||
}
|
||||
|
||||
public static bool IsMemberOf(GID[] groupIds)
|
||||
{
|
||||
return (User() != null) ? User().IsMemberOf(groupIds) : (groupIds == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,38 +5,10 @@ using System;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public class GlobalData
|
||||
public static class GlobalData
|
||||
{
|
||||
public static double SampleDensity = 0; /// sample water density measured in an accredited labo [kg/m3]
|
||||
public static double SampleTemp = 0; /// sample temperature when density measured in an accredited labo [°C]
|
||||
public static double Buoyancy = 0;
|
||||
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
|
||||
public static DBSettings RemoteUsersDB = null;
|
||||
public static DBSettings LocalUsersDB = null;
|
||||
|
||||
public static IUser CurrentUser;
|
||||
public static IUser CurrentUser2;
|
||||
public static IUser CurrentUser3;
|
||||
|
||||
public static Common.AuthorizedAs AuthorizedAs;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
public static int MinPasswdLength = 0;
|
||||
public static int PasswdExpirationPeriodDays = 0;
|
||||
|
||||
public static string GetCurrentUserName()
|
||||
{
|
||||
if (CurrentUser == null || CurrentUser.UserName == null)
|
||||
return string.Empty;
|
||||
else if (CurrentUser2 == null || CurrentUser2.UserName == null)
|
||||
return CurrentUser.UserName;
|
||||
else if (CurrentUser3 == null || CurrentUser3.UserName == null)
|
||||
return string.Format("{0},{1}", CurrentUser.UserName, CurrentUser2.UserName);
|
||||
else
|
||||
return string.Format("{0},{1},{2}", CurrentUser.UserName, CurrentUser2.UserName, CurrentUser3.UserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ namespace Common
|
||||
int Number { get; }
|
||||
|
||||
/// Access rights
|
||||
bool IsPowerUser();
|
||||
bool IsMemberOf(GID group);
|
||||
bool IsMemberOf(GID[] groups);
|
||||
bool IsCorrectPassword(string password);
|
||||
|
||||
@ -212,9 +212,9 @@ namespace Common
|
||||
int length = string.IsNullOrEmpty(password) ? 0 : password.Length;
|
||||
|
||||
/// Password length must be at least 6
|
||||
if (length < GlobalData.MinPasswdLength)
|
||||
if (length < CurrentUser.MinPasswdLength)
|
||||
{
|
||||
explanation = string.Format("Password must have at least {0} characters", GlobalData.MinPasswdLength);
|
||||
explanation = string.Format("Password must have at least {0} characters", CurrentUser.MinPasswdLength);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
@ -75,7 +75,7 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = Common.GlobalData.GetCurrentUserName();
|
||||
CreationUser = Common.CurrentUser.UserName();
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = GlobalData.GetCurrentUserName();
|
||||
CreationUser = CurrentUser.UserName();
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
|
||||
@ -157,14 +157,14 @@ namespace Config.Entities
|
||||
/// <returns></ returns>
|
||||
public virtual bool IsPasswordExpired()
|
||||
{
|
||||
if (IsPowerUser() || IsMemberOf(GID.Administrators) || GlobalData.PasswdExpirationPeriodDays == 0)
|
||||
if (IsPowerUser() || IsMemberOf(GID.Administrators) || CurrentUser.PasswdExpirationPeriodDays == 0)
|
||||
{
|
||||
/// Password cannot expirate for this user or this feature is disabled in Backup and Security options
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Password expiration time is 3 months
|
||||
return (DateTime.Now - LastPwChange > new TimeSpan(GlobalData.PasswdExpirationPeriodDays, 0, 0, 0));
|
||||
return (DateTime.Now - LastPwChange > new TimeSpan(CurrentUser.PasswdExpirationPeriodDays, 0, 0, 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -105,11 +105,11 @@ namespace Config
|
||||
///
|
||||
var admin = new Config.Entities.User
|
||||
{
|
||||
UserName = GlobalData.AdminUsername,
|
||||
UserName = CurrentUser.AdminUsername,
|
||||
FullName = Strings.Administrator,
|
||||
LastPwChange = DateTime.Now
|
||||
};
|
||||
admin.SetPassword(GlobalData.AdminPassword);
|
||||
admin.SetPassword(CurrentUser.AdminPassword);
|
||||
|
||||
///
|
||||
/// Prepare all groups, add some of them to admin
|
||||
|
||||
@ -423,7 +423,7 @@ namespace DeviceTest
|
||||
{
|
||||
parentCfg = parentFactory.DefaultConfig();
|
||||
}
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = new List<Config.Entities.Component>();
|
||||
|
||||
IComponentCfgCtrl cfgControl = parentCfg.GetControl(cfgForm.CmpntEntities);
|
||||
@ -452,7 +452,7 @@ namespace DeviceTest
|
||||
{
|
||||
component1Cfg = component1Factory.DefaultConfig();
|
||||
}
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
///
|
||||
var compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@ -486,7 +486,7 @@ namespace DeviceTest
|
||||
{
|
||||
component2Cfg = component2Factory.DefaultConfig();
|
||||
}
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
///
|
||||
var compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@ -521,7 +521,7 @@ namespace DeviceTest
|
||||
{
|
||||
component3Cfg = component3Factory.DefaultConfig();
|
||||
}
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
///
|
||||
var compEntities = new List<Config.Entities.Component>();
|
||||
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
|
||||
@ -899,6 +899,8 @@ namespace DeviceTest
|
||||
{
|
||||
Cursor = Cursors.WaitCursor;
|
||||
|
||||
CurrentUser.Restore(this);
|
||||
|
||||
if (workerThread != null)
|
||||
{
|
||||
workerThreadRunning = false;
|
||||
|
||||
@ -291,7 +291,7 @@ namespace EventViewer
|
||||
{
|
||||
try
|
||||
{
|
||||
GlobalData.RemoteUsersDB = new DBSettings(DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
CurrentUser.RemoteUsersDB = new DBSettings(DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
SharedDatabase.Forms.LoginDlg dlg = new SharedDatabase.Forms.LoginDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
@ -176,13 +176,11 @@ namespace GenericTest
|
||||
|
||||
private void settingsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
IUser oriUser = GlobalData.CurrentUser; /// Save the original user (= tester)
|
||||
|
||||
if (new LoginDlg(Program.SettingsAccessLevel).ShowDialog() == DialogResult.OK)
|
||||
if (new LoginDlg(Program.SettingsAccessLevel, this).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// Logged in at 'TraceabilityManagement' level
|
||||
|
||||
GlobalData.CurrentUser = oriUser; /// Restore the original user (= tester)
|
||||
CurrentUser.Restore(this); /// Restore the original user (= tester)
|
||||
|
||||
string oriWorkplace = Program.LocalSettings.Workplace;
|
||||
///
|
||||
@ -195,7 +193,7 @@ namespace GenericTest
|
||||
TracingDB.UnregisterWorkplaceObsolete(dbSession, oriWorkplace);
|
||||
TracingDB.RegisterWorkplaceObsolete(dbSession,
|
||||
Program.LocalSettings.Workplace,
|
||||
GlobalData.GetCurrentUserName(),
|
||||
CurrentUser.UserName(),
|
||||
"1.2.3.4",
|
||||
"<multiple>",
|
||||
WorkflowStep,
|
||||
@ -714,14 +712,14 @@ namespace GenericTest
|
||||
|
||||
if (!string.IsNullOrEmpty(Program.LocalSettings.UsersDBConnString))
|
||||
{
|
||||
GlobalData.LocalUsersDB = new DBSettings(DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
CurrentUser.LocalUsersDB = new DBSettings(DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
|
||||
TracingDB.RegisterWorkplaceObsolete(dbSession,
|
||||
Program.LocalSettings.Workplace,
|
||||
GlobalData.GetCurrentUserName(),
|
||||
CurrentUser.UserName(),
|
||||
"1.2.3.4",
|
||||
"<multiple>",
|
||||
WorkflowStep,
|
||||
@ -1037,7 +1035,7 @@ namespace GenericTest
|
||||
|
||||
void UpdateTitle()
|
||||
{
|
||||
Text = string.Format("{0} v.{1} ({2}, {3})", DfltWorkplaceName, Program.Version, Program.LocalSettings.Workplace, GlobalData.GetCurrentUserName());
|
||||
Text = string.Format("{0} v.{1} ({2}, {3})", DfltWorkplaceName, Program.Version, Program.LocalSettings.Workplace, CurrentUser.UserName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ namespace GenericTest
|
||||
{
|
||||
try
|
||||
{
|
||||
GlobalData.LocalUsersDB = new DBSettings(DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
CurrentUser.LocalUsersDB = new DBSettings(DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
|
||||
if (new SharedDatabase.Forms.LoginDlg().ShowDialog() != DialogResult.OK) return;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ namespace OrderManagement
|
||||
{
|
||||
try
|
||||
{
|
||||
Common.GlobalData.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
Common.CurrentUser.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
|
||||
DialogResult dr = new SharedDatabase.Forms.LoginDlg().ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
@ -160,7 +160,7 @@ namespace OrderManagement
|
||||
{
|
||||
try
|
||||
{
|
||||
Common.GlobalData.RemoteUsersDB = new DBSettings(Common.DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
Common.CurrentUser.RemoteUsersDB = new DBSettings(Common.DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
|
||||
DialogResult dr = new SharedDatabase.Forms.LoginDlg().ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
@ -158,7 +158,7 @@ namespace ProductionTracing
|
||||
{
|
||||
try
|
||||
{
|
||||
Common.GlobalData.RemoteUsersDB = new DBSettings(Common.DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
Common.CurrentUser.RemoteUsersDB = new DBSettings(Common.DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
|
||||
DialogResult dr = new SharedDatabase.Forms.LoginDlg().ShowDialog();
|
||||
if (dr != DialogResult.OK) return;
|
||||
|
||||
@ -107,6 +107,7 @@
|
||||
this.Controls.Add(this.printerClassComboBox);
|
||||
this.Name = "PrinterConfigDlg";
|
||||
this.Text = "Printer configuration";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PrinterConfigDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.PrinterClassDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -88,7 +88,7 @@ namespace ResultsBrowser.Forms
|
||||
printerCfg = printerFactory.CmpntCfgFromCmpntEntity(cmpnt);
|
||||
}
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = new List<Component>();
|
||||
|
||||
IComponentCfgCtrl cfgControl = printerCfg.GetControl(cfgForm.CmpntEntities);
|
||||
@ -167,5 +167,10 @@ namespace ResultsBrowser.Forms
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void PrinterConfigDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Common.CurrentUser.Restore(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -30,7 +30,7 @@ namespace SharedDatabase.Entities
|
||||
|
||||
private bool powerUser; /// true for built-in users, power users have full access even with empty Groups list
|
||||
public virtual bool IsPowerUser() { return powerUser; }
|
||||
|
||||
|
||||
private string legalizator; /// Not mapped to a database !!!, 2nd user entered in a logging dialog
|
||||
public virtual void SetLegalizator(string value) { legalizator = value; }
|
||||
public virtual string GetLegalizator() { return legalizator; }
|
||||
@ -160,14 +160,14 @@ namespace SharedDatabase.Entities
|
||||
/// <returns></ returns>
|
||||
public virtual bool IsPasswordExpired()
|
||||
{
|
||||
if (IsPowerUser() || IsMemberOf(GID.Administrators) || GlobalData.PasswdExpirationPeriodDays == 0)
|
||||
if (IsPowerUser() || IsMemberOf(GID.Administrators) || CurrentUser.PasswdExpirationPeriodDays == 0)
|
||||
{
|
||||
/// Password cannot expirate for this user or this feature is disabled in Backup and Security options
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Password expiration time is 3 months
|
||||
return (DateTime.Now - LastPwChange > new TimeSpan(GlobalData.PasswdExpirationPeriodDays, 0, 0, 0));
|
||||
return (DateTime.Now - LastPwChange > new TimeSpan(CurrentUser.PasswdExpirationPeriodDays, 0, 0, 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -216,13 +216,13 @@ namespace SharedDatabase.Entities
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool Authorize(string userName, string password, GID[] requiredGroupMembership)
|
||||
public virtual bool Authorize(string userName, string password, GID[] requiredGroupMembership, System.Windows.Forms.Form currentForm )
|
||||
{
|
||||
if (Common.Utils.IsPowerUser(userName, password))
|
||||
{
|
||||
/// User is a power user => authorize
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
CurrentUser.Change(this, currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("Power user '{0}' authorized @level '{1}'", userName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
@ -233,7 +233,7 @@ namespace SharedDatabase.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -247,7 +247,7 @@ namespace SharedDatabase.Entities
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeNumber(int number, string password, GID[] requiredGroupMembership)
|
||||
public virtual bool AuthorizeNumber(int number, string password, GID[] requiredGroupMembership, System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
if (Number != number)
|
||||
{
|
||||
@ -255,7 +255,7 @@ namespace SharedDatabase.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -269,7 +269,7 @@ namespace SharedDatabase.Entities
|
||||
/// <param name="password"></param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeFullName(string fullName, string password, GID[] requiredGroupMembership)
|
||||
public virtual bool AuthorizeFullName(string fullName, string password, GID[] requiredGroupMembership, System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
if (FullName.ToLower() != fullName.ToLower())
|
||||
{
|
||||
@ -277,7 +277,7 @@ namespace SharedDatabase.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -286,7 +286,7 @@ namespace SharedDatabase.Entities
|
||||
/// <param name="password">Password</param>
|
||||
/// <param name="requiredGroupMembership">Required group membership</param>
|
||||
/// <returns>true = authorized</returns>
|
||||
bool CompleteAuthorization(string password, GID[] requiredGroupMembership)
|
||||
bool CompleteAuthorization(string password, GID[] requiredGroupMembership, System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
if (!IsMemberOf(requiredGroupMembership) || !IsCorrectPassword(password))
|
||||
{
|
||||
@ -305,8 +305,8 @@ namespace SharedDatabase.Entities
|
||||
}
|
||||
|
||||
/// All OK => complete authorization
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
CurrentUser.Change(this, currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User '{0}' authorized @level '{1}'", UserName, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
@ -321,7 +321,7 @@ namespace SharedDatabase.Entities
|
||||
/// <param name="tag">Tag (RFID, NFC, ... s/n)</param>
|
||||
/// <param name="requiredGrupMembership"></param>
|
||||
/// <returns>true = authorized</returns>
|
||||
public virtual bool AuthorizeTag(string tag, GID[] requiredGroupMembership)
|
||||
public virtual bool AuthorizeTag(string tag, GID[] requiredGroupMembership, System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
if (Tag != tag)
|
||||
{
|
||||
@ -332,8 +332,8 @@ namespace SharedDatabase.Entities
|
||||
if (IsMemberOf(requiredGroupMembership))
|
||||
{
|
||||
/// Group membersip is OK _and_ password is OK => authorize
|
||||
GlobalData.CurrentUser = this;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
CurrentUser.Change(this, currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
log.FatalFormat("User with Tag={0} authorized @level '{1}'", tag, requiredGroupMembership);
|
||||
return true;
|
||||
}
|
||||
@ -349,12 +349,13 @@ namespace SharedDatabase.Entities
|
||||
/// </summary>
|
||||
/// <param name="username">User name for the query</param>
|
||||
/// <returns>reference to a 'User' (if it exists) or null</returns>
|
||||
public static User AuthorizeDummyUser(string username)
|
||||
public static User AuthorizeDummyUser(string username, System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
User user = new User();
|
||||
user.UserName = username;
|
||||
GlobalData.CurrentUser = user;
|
||||
return user;
|
||||
CurrentUser.Change(user, currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
@ -490,10 +491,10 @@ namespace SharedDatabase.Entities
|
||||
/// <summary>
|
||||
/// Unauthorize, abandon current users authorization.
|
||||
/// </summary>
|
||||
public static void Unauthorize()
|
||||
public static void Unauthorize(System.Windows.Forms.Form currentForm)
|
||||
{
|
||||
GlobalData.CurrentUser = null;
|
||||
GlobalData.LastAuthorization = DateTime.Now;
|
||||
CurrentUser.Restore(currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
}
|
||||
|
||||
public virtual string ToEncodedStr()
|
||||
|
||||
@ -20,7 +20,8 @@ namespace SharedDatabase.Forms
|
||||
// Private fields
|
||||
string predefinedUser;
|
||||
GID[] requiredGroupMembership;
|
||||
bool noDatabase;
|
||||
Form parentForm;
|
||||
bool noDatabase;
|
||||
Color oriBackColor;
|
||||
|
||||
/// Smart card support, card S/N is used as user.Tag
|
||||
@ -54,10 +55,11 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user.
|
||||
/// </summary>
|
||||
public DoubleLoginDlg(string predefinedUser)
|
||||
public DoubleLoginDlg(string predefinedUser, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.predefinedUser = predefinedUser;
|
||||
this.parentForm = parentForm;
|
||||
userNameTextBox1.Text = predefinedUser;
|
||||
}
|
||||
|
||||
@ -66,11 +68,12 @@ namespace SharedDatabase.Forms
|
||||
/// </summary>
|
||||
/// <param name="workplace1">Name of workplace A</param>
|
||||
/// <param name="workplace2">Name of workplace B</param>
|
||||
public DoubleLoginDlg(string workplace1, string workplace2)
|
||||
public DoubleLoginDlg(string workplace1, string workplace2, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
workplaceGroupBox1.Text = workplace1;
|
||||
workplaceGroupBox2.Text = workplace2;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -85,21 +88,23 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor when a specific group membership is required.
|
||||
/// </summary>
|
||||
public DoubleLoginDlg(GID[] requiredGroupMembership)
|
||||
public DoubleLoginDlg(GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user when a specific group membership is required.
|
||||
/// </summary>
|
||||
public DoubleLoginDlg(string predefinedUser, GID[] requiredGroupMembership)
|
||||
public DoubleLoginDlg(string predefinedUser, GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.predefinedUser = predefinedUser;
|
||||
userNameTextBox1.Text = predefinedUser;
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
private void LoginDlg_Load(object sender, EventArgs e)
|
||||
@ -249,7 +254,7 @@ namespace SharedDatabase.Forms
|
||||
bool authorized = false;
|
||||
if (!noDatabase)
|
||||
{
|
||||
DBSettings db = GlobalData.LocalUsersDB;
|
||||
DBSettings db = CurrentUser.LocalUsersDB;
|
||||
|
||||
loadedUser = User.LoadUserByName(user, db);
|
||||
if (loadedUser != null)
|
||||
@ -258,15 +263,15 @@ namespace SharedDatabase.Forms
|
||||
{
|
||||
default:
|
||||
case LoginMethod.UserName:
|
||||
authorized = loadedUser.Authorize(user, password, requiredGroupMembership);
|
||||
authorized = loadedUser.Authorize(user, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
case LoginMethod.FullName:
|
||||
authorized = loadedUser.AuthorizeFullName(user, password, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeFullName(user, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
case LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(user, out number)) break;
|
||||
authorized = loadedUser.AuthorizeNumber(number, password, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeNumber(number, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -283,7 +288,7 @@ namespace SharedDatabase.Forms
|
||||
{
|
||||
if (requiredGroupMembership == null)
|
||||
{
|
||||
Entities.User.Unauthorize();
|
||||
Entities.User.Unauthorize(parentForm);
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
@ -316,13 +321,12 @@ namespace SharedDatabase.Forms
|
||||
|
||||
|
||||
bool authorized = false;
|
||||
DBSettings db = GlobalData.LocalUsersDB;
|
||||
IUser oriUser = GlobalData.CurrentUser;
|
||||
DBSettings db = CurrentUser.LocalUsersDB;
|
||||
|
||||
User loadedUser = User.LoadUserByTag(tag, db);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership, parentForm);
|
||||
}
|
||||
|
||||
|
||||
@ -515,8 +519,8 @@ namespace SharedDatabase.Forms
|
||||
/// </summary>
|
||||
void PrepareClosingDlg()
|
||||
{
|
||||
GlobalData.CurrentUser = authorizedUser1;
|
||||
GlobalData.CurrentUser2 = authorizedUser2;
|
||||
CurrentUser.Change(authorizedUser1, parentForm);
|
||||
CurrentUser.User2 = authorizedUser2;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
||||
@ -27,7 +27,8 @@ namespace SharedDatabase.Forms
|
||||
string user;
|
||||
string password;
|
||||
GID[] requiredGroupMembership;
|
||||
bool noDatabase;
|
||||
Form parentForm;
|
||||
bool noDatabase;
|
||||
Color oriBackColor;
|
||||
|
||||
/// Smart card support, card S/N is used as user.Tag
|
||||
@ -50,11 +51,12 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user.
|
||||
/// </summary>
|
||||
public LoginDlg(string predefinedUser)
|
||||
public LoginDlg(string predefinedUser, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
user = predefinedUser;
|
||||
userNameTextBox.Text = predefinedUser;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -69,10 +71,11 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor when a specific group membership is required.
|
||||
/// </summary>
|
||||
public LoginDlg(GID[] requiredGroupMembership)
|
||||
public LoginDlg(GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
#if DEBUG
|
||||
user = "milan";
|
||||
userNameTextBox.Text = "milan";
|
||||
@ -83,12 +86,13 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user when a specific group membership is required.
|
||||
/// </summary>
|
||||
public LoginDlg(string predefinedUser, GID[] requiredGroupMembership)
|
||||
public LoginDlg(string predefinedUser, GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
user = predefinedUser;
|
||||
userNameTextBox.Text = predefinedUser;
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
private void LoginDlg_Load(object sender, EventArgs e)
|
||||
@ -191,12 +195,12 @@ namespace SharedDatabase.Forms
|
||||
bool authorized = Common.Utils.IsPowerUser(user, password);
|
||||
if (authorized)
|
||||
{
|
||||
GlobalData.CurrentUser = new Entities.User(user, 6, true);
|
||||
CurrentUser.Change(new Entities.User(user, 6, true), parentForm);
|
||||
}
|
||||
|
||||
if (!authorized && !noDatabase)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
|
||||
authorizedAs = AuthorizedAs.RemoteUser;
|
||||
|
||||
foreach (var db in dbs)
|
||||
@ -208,12 +212,12 @@ namespace SharedDatabase.Forms
|
||||
case LoginMethod.UserName:
|
||||
default:
|
||||
var usr1 = Entities.User.LoadUserByName(user, db);
|
||||
if (usr1 != null) { authorized = usr1.Authorize(user, password, requiredGroupMembership); }
|
||||
if (usr1 != null) { authorized = usr1.Authorize(user, password, requiredGroupMembership, parentForm); }
|
||||
break;
|
||||
|
||||
case LoginMethod.FullName:
|
||||
var usr2 = Entities.User.LoadUserByFullName(user, db);
|
||||
if (usr2 != null) { authorized = usr2.AuthorizeFullName(user, password, requiredGroupMembership); }
|
||||
if (usr2 != null) { authorized = usr2.AuthorizeFullName(user, password, requiredGroupMembership, parentForm); }
|
||||
if (authorized) { user = usr2.UserName; }
|
||||
break;
|
||||
|
||||
@ -221,7 +225,7 @@ namespace SharedDatabase.Forms
|
||||
int number;
|
||||
if (!int.TryParse(user, out number)) break;
|
||||
var usr3 = Entities.User.LoadUserByNumber(number, db);
|
||||
if (usr3 != null) { authorized = usr3.AuthorizeNumber(number, password, requiredGroupMembership); }
|
||||
if (usr3 != null) { authorized = usr3.AuthorizeNumber(number, password, requiredGroupMembership, parentForm); }
|
||||
if (authorized) { user = usr3.UserName; }
|
||||
break;
|
||||
}
|
||||
@ -236,7 +240,7 @@ namespace SharedDatabase.Forms
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
GlobalData.AuthorizedAs = authorizedAs;
|
||||
CurrentUser.AuthorizedAs = authorizedAs;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
@ -254,7 +258,7 @@ namespace SharedDatabase.Forms
|
||||
{
|
||||
if (requiredGroupMembership == null)
|
||||
{
|
||||
Entities.User.Unauthorize();
|
||||
Entities.User.Unauthorize(parentForm);
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
@ -297,7 +301,7 @@ namespace SharedDatabase.Forms
|
||||
|
||||
card.Disconnect(DISCONNECT.Leave);
|
||||
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
|
||||
bool authorized = false;
|
||||
AuthorizedAs authorizedAs = AuthorizedAs.RemoteUser;
|
||||
///
|
||||
@ -308,7 +312,7 @@ namespace SharedDatabase.Forms
|
||||
Entities.User loadedUser = Entities.User.LoadUserByTag(tag, db);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership, parentForm);
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
@ -324,7 +328,7 @@ namespace SharedDatabase.Forms
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
GlobalData.AuthorizedAs = authorizedAs;
|
||||
CurrentUser.AuthorizedAs = authorizedAs;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
|
||||
@ -97,7 +97,7 @@ namespace SharedDatabase.Forms
|
||||
bool oldPasswdOK = false;
|
||||
if (!oldPasswdOK)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
|
||||
|
||||
foreach (var db in dbs)
|
||||
{
|
||||
|
||||
@ -20,7 +20,8 @@ namespace SharedDatabase.Forms
|
||||
// Private fields
|
||||
string predefinedUser;
|
||||
GID[] requiredGroupMembership;
|
||||
bool noDatabase;
|
||||
Form parentForm;
|
||||
bool noDatabase;
|
||||
Color oriBackColor;
|
||||
|
||||
/// Smart card support, card S/N is used as user.Tag
|
||||
@ -58,10 +59,11 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user.
|
||||
/// </summary>
|
||||
public TripleLoginDlg(string predefinedUser)
|
||||
public TripleLoginDlg(string predefinedUser, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.predefinedUser = predefinedUser;
|
||||
this.parentForm = parentForm;
|
||||
userNameTextBox1.Text = predefinedUser;
|
||||
}
|
||||
|
||||
@ -70,9 +72,10 @@ namespace SharedDatabase.Forms
|
||||
/// </summary>
|
||||
/// <param name="workplace1">Name of workplace A</param>
|
||||
/// <param name="workplace2">Name of workplace B</param>
|
||||
public TripleLoginDlg(string workplace1, string workplace2, string workplace3)
|
||||
public TripleLoginDlg(string workplace1, string workplace2, string workplace3, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.parentForm = parentForm;
|
||||
workplaceGroupBox1.Text = workplace1;
|
||||
workplaceGroupBox2.Text = workplace2;
|
||||
workplaceGroupBox3.Text = workplace3;
|
||||
@ -90,21 +93,23 @@ namespace SharedDatabase.Forms
|
||||
/// <summary>
|
||||
/// Constructor when a specific group membership is required.
|
||||
/// </summary>
|
||||
public TripleLoginDlg(GID[] requiredGroupMembership)
|
||||
public TripleLoginDlg(GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a predefined user when a specific group membership is required.
|
||||
/// </summary>
|
||||
public TripleLoginDlg(string predefinedUser, GID[] requiredGroupMembership)
|
||||
public TripleLoginDlg(string predefinedUser, GID[] requiredGroupMembership, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
this.predefinedUser = predefinedUser;
|
||||
userNameTextBox1.Text = predefinedUser;
|
||||
this.requiredGroupMembership = requiredGroupMembership;
|
||||
this.parentForm = parentForm;
|
||||
userNameTextBox1.Text = predefinedUser;
|
||||
}
|
||||
|
||||
private void LoginDlg_Load(object sender, EventArgs e)
|
||||
@ -274,7 +279,7 @@ namespace SharedDatabase.Forms
|
||||
bool authorized = false;
|
||||
if (!noDatabase)
|
||||
{
|
||||
DBSettings db = GlobalData.LocalUsersDB;
|
||||
DBSettings db = CurrentUser.LocalUsersDB;
|
||||
|
||||
loadedUser = User.LoadUserByName(user, db);
|
||||
if (loadedUser != null)
|
||||
@ -283,15 +288,15 @@ namespace SharedDatabase.Forms
|
||||
{
|
||||
default:
|
||||
case LoginMethod.UserName:
|
||||
authorized = loadedUser.Authorize(user, password, requiredGroupMembership);
|
||||
authorized = loadedUser.Authorize(user, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
case LoginMethod.FullName:
|
||||
authorized = loadedUser.AuthorizeFullName(user, password, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeFullName(user, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
case LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(user, out number)) break;
|
||||
authorized = loadedUser.AuthorizeNumber(number, password, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeNumber(number, password, requiredGroupMembership, parentForm);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -308,7 +313,7 @@ namespace SharedDatabase.Forms
|
||||
{
|
||||
if (requiredGroupMembership == null)
|
||||
{
|
||||
Entities.User.Unauthorize();
|
||||
Entities.User.Unauthorize(parentForm);
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
@ -347,13 +352,12 @@ namespace SharedDatabase.Forms
|
||||
|
||||
|
||||
bool authorized = false;
|
||||
DBSettings db = GlobalData.LocalUsersDB;
|
||||
IUser oriUser = GlobalData.CurrentUser;
|
||||
DBSettings db = CurrentUser.LocalUsersDB;
|
||||
|
||||
User loadedUser = User.LoadUserByTag(tag, db);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership, parentForm);
|
||||
}
|
||||
|
||||
|
||||
@ -622,9 +626,9 @@ namespace SharedDatabase.Forms
|
||||
/// </summary>
|
||||
void PrepareClosingDlg()
|
||||
{
|
||||
GlobalData.CurrentUser = authorizedUser1;
|
||||
GlobalData.CurrentUser2 = authorizedUser2;
|
||||
GlobalData.CurrentUser3 = authorizedUser3;
|
||||
CurrentUser.Change(authorizedUser1, parentForm);
|
||||
CurrentUser.User2 = authorizedUser2;
|
||||
CurrentUser.User3 = authorizedUser3;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
||||
@ -223,8 +223,8 @@ namespace SharedDatabase.Forms
|
||||
|
||||
private void copyFromRemoteButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GlobalData.RemoteUsersDB == null || string.IsNullOrEmpty(GlobalData.RemoteUsersDB.ConnectionString) ||
|
||||
GlobalData.LocalUsersDB == null || string.IsNullOrEmpty(GlobalData.LocalUsersDB.ConnectionString))
|
||||
if (CurrentUser.RemoteUsersDB == null || string.IsNullOrEmpty(CurrentUser.RemoteUsersDB.ConnectionString) ||
|
||||
CurrentUser.LocalUsersDB == null || string.IsNullOrEmpty(CurrentUser.LocalUsersDB.ConnectionString))
|
||||
{
|
||||
MessageBox.Show(Strings.No_remote_database_of_users, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return;
|
||||
@ -244,8 +244,8 @@ namespace SharedDatabase.Forms
|
||||
///
|
||||
/// Create remote DB session and read remote users
|
||||
///
|
||||
UsersDB.DbType = GlobalData.RemoteUsersDB.DbType;
|
||||
UsersDB.ConnectionString = GlobalData.RemoteUsersDB.ConnectionString;
|
||||
UsersDB.DbType = CurrentUser.RemoteUsersDB.DbType;
|
||||
UsersDB.ConnectionString = CurrentUser.RemoteUsersDB.ConnectionString;
|
||||
ISession remoteSession = UsersDB.CreateSession();
|
||||
remoteUsers = remoteSession.QueryOver<User>().List();
|
||||
remoteGroups = remoteSession.QueryOver<Group>().List();
|
||||
@ -253,8 +253,8 @@ namespace SharedDatabase.Forms
|
||||
///
|
||||
/// Prepare local DB session
|
||||
///
|
||||
UsersDB.DbType = GlobalData.LocalUsersDB.DbType;
|
||||
UsersDB.ConnectionString = GlobalData.LocalUsersDB.ConnectionString;
|
||||
UsersDB.DbType = CurrentUser.LocalUsersDB.DbType;
|
||||
UsersDB.ConnectionString = CurrentUser.LocalUsersDB.ConnectionString;
|
||||
ISession localSession = UsersDB.CreateSession();
|
||||
transaction = localSession.BeginTransaction();
|
||||
|
||||
|
||||
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("3.0.1.0")]
|
||||
[assembly: AssemblyFileVersion("3.0.1.0")]
|
||||
[assembly: AssemblyVersion("3.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("3.2.0.0")]
|
||||
|
||||
@ -252,8 +252,8 @@ namespace TBF
|
||||
{
|
||||
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
|
||||
|
||||
GlobalData.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
|
||||
GlobalData.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
|
||||
CurrentUser.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
|
||||
CurrentUser.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
|
||||
|
||||
SharedDatabase.Entities.User loadedUser = null;
|
||||
try
|
||||
@ -269,10 +269,10 @@ namespace TBF
|
||||
if (Common.Utils.IsPowerUser(loginDlgBench.Alias, loginDlgBench.Password))
|
||||
{
|
||||
loadedUser = new SharedDatabase.Entities.User(loginDlgBench.Alias, 6, true);
|
||||
authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership);
|
||||
authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
if (authorized)
|
||||
{
|
||||
GlobalData.AuthorizedAs = AuthorizedAs.PowerUser;
|
||||
CurrentUser.AuthorizedAs = AuthorizedAs.PowerUser;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ namespace TBF
|
||||
///
|
||||
if (!authorized)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
|
||||
|
||||
authorizedAs = AuthorizedAs.RemoteUser; /// Try remote DB first
|
||||
|
||||
@ -293,7 +293,7 @@ namespace TBF
|
||||
if (loginDlgBench.Password == LoginDlgWithBenchSelection.UseTheTagPassword)
|
||||
{
|
||||
loadedUser = SharedDatabase.Entities.User.LoadUserByTag(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeTag(loginDlgBench.Alias, reqGrpMembership);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeTag(loginDlgBench.Alias, reqGrpMembership, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -302,17 +302,17 @@ namespace TBF
|
||||
default:
|
||||
case LoginMethod.UserName:
|
||||
loadedUser = SharedDatabase.Entities.User.LoadUserByName(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership);
|
||||
if (loadedUser != null) authorized = loadedUser.Authorize(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
case LoginMethod.FullName:
|
||||
loadedUser = SharedDatabase.Entities.User.LoadUserByFullName(loginDlgBench.Alias, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeFullName(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeFullName(loginDlgBench.Alias, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
case LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(loginDlgBench.Alias, out number)) break;
|
||||
loadedUser = SharedDatabase.Entities.User.LoadUserByNumber(number, db);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeNumber(number, loginDlgBench.Password, reqGrpMembership);
|
||||
if (loadedUser != null) authorized = loadedUser.AuthorizeNumber(number, loginDlgBench.Password, reqGrpMembership, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ namespace TBF
|
||||
if (authorized)
|
||||
{
|
||||
loadedUser.SetLegalizator(loginDlgBench.Legalizator);
|
||||
GlobalData.AuthorizedAs = authorizedAs;
|
||||
CurrentUser.AuthorizedAs = authorizedAs;
|
||||
|
||||
LocalSettings.LoginMethod = loginDlgBench.Method; /// Save the login method actually used
|
||||
|
||||
|
||||
@ -32,8 +32,8 @@ namespace TBF.Rig.DataContainer.BackupAndSecurityOptions
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
CurrentUser.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
CurrentUser.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
StepRecord stepRecord = new StepRecord(refRecord,
|
||||
wflowSummary.WorkstepName,
|
||||
workplace,
|
||||
Common.GlobalData.GetCurrentUserName(),
|
||||
Common.CurrentUser.UserName(),
|
||||
wm.PassedFromTests() ? 0 : 1);
|
||||
if (refRecord.StepRecords == null)
|
||||
{
|
||||
|
||||
@ -430,10 +430,10 @@ namespace TBF.Rig.Sequences
|
||||
/// Water meter failed but the failure is not an assembly error
|
||||
wm.Disabled = true;
|
||||
}
|
||||
else if (!wm.Disabled && (GlobalData.GetCurrentUserName() == "milan" ||
|
||||
GlobalData.GetCurrentUserName() == "augustin" ||
|
||||
GlobalData.GetCurrentUserName() == "michal" ||
|
||||
GlobalData.GetCurrentUserName() == "michal2"))
|
||||
else if (!wm.Disabled && (CurrentUser.UserName() == "milan" ||
|
||||
CurrentUser.UserName() == "augustin" ||
|
||||
CurrentUser.UserName() == "michal" ||
|
||||
CurrentUser.UserName() == "michal2"))
|
||||
{
|
||||
/// Water meter failed, is not disabled, there is an assembly error and user is one of above
|
||||
/// ... => reset flag E28
|
||||
@ -641,7 +641,7 @@ namespace TBF.Rig.Sequences
|
||||
log.ErrorFormat("StartInfoReader failed to read data from the database");
|
||||
/// TODO: Message for an operator? Error?
|
||||
}
|
||||
else if ((selection == Selection.RestoreAndFixBatch) && (GlobalData.GetCurrentUserName() != "milan"))
|
||||
else if ((selection == Selection.RestoreAndFixBatch) && (CurrentUser.UserName() != "milan"))
|
||||
{
|
||||
/// Restore and fix a batch - part 2
|
||||
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
|
||||
|
||||
@ -614,8 +614,8 @@ namespace TBF.Rig.Sequences
|
||||
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
|
||||
GlobalData.GetCurrentUserName(),
|
||||
(GlobalData.CurrentUser != null) ? GlobalData.CurrentUser.Number : 0,
|
||||
CurrentUser.UserName(),
|
||||
CurrentUser.Number(),
|
||||
Program.Version,
|
||||
StateMachine.Procedure,
|
||||
waterMeterData,
|
||||
|
||||
@ -34,9 +34,9 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
ITabWithListViewEx seqStepsCtrl;
|
||||
|
||||
|
||||
public CycleDlg()
|
||||
: this(new List<CycleStep>())
|
||||
CycleDlg()
|
||||
{
|
||||
EnduranceCycle = new List<CycleStep>();
|
||||
}
|
||||
|
||||
public CycleDlg(IList<CycleStep> cycle)
|
||||
@ -47,6 +47,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
@ -264,5 +265,10 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
97
TBF/Rig/TestMethods/Endurance/CycleDlg.designer.cs
generated
97
TBF/Rig/TestMethods/Endurance/CycleDlg.designer.cs
generated
@ -31,54 +31,55 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleDlg));
|
||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||
this.mainSplitContainer.Panel1.SuspendLayout();
|
||||
this.mainSplitContainer.Panel2.SuspendLayout();
|
||||
this.mainSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainSplitContainer
|
||||
//
|
||||
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
|
||||
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.mainSplitContainer.Name = "mainSplitContainer";
|
||||
//
|
||||
// mainSplitContainer.Panel1
|
||||
//
|
||||
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
|
||||
//
|
||||
// mainSplitContainer.Panel2
|
||||
//
|
||||
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
resources.ApplyResources(this.tabControl, "tabControl");
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
resources.ApplyResources(this.sharedButtons, "sharedButtons");
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
//
|
||||
// CycleDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.mainSplitContainer);
|
||||
this.Name = "CycleDlg";
|
||||
this.Load += new System.EventHandler(this.CycleDlg_Load);
|
||||
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
|
||||
this.mainSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleDlg));
|
||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||
this.mainSplitContainer.Panel1.SuspendLayout();
|
||||
this.mainSplitContainer.Panel2.SuspendLayout();
|
||||
this.mainSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainSplitContainer
|
||||
//
|
||||
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
|
||||
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.mainSplitContainer.Name = "mainSplitContainer";
|
||||
//
|
||||
// mainSplitContainer.Panel1
|
||||
//
|
||||
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
|
||||
//
|
||||
// mainSplitContainer.Panel2
|
||||
//
|
||||
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
resources.ApplyResources(this.tabControl, "tabControl");
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
resources.ApplyResources(this.sharedButtons, "sharedButtons");
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
//
|
||||
// CycleDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.mainSplitContainer);
|
||||
this.Name = "CycleDlg";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CycleDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.CycleDlg_Load);
|
||||
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
|
||||
this.mainSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.SharedButtons, TBF, Version=2.12.404.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2017-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
@ -55,20 +55,17 @@ namespace TBF.Rig.Various.CoverTest
|
||||
|
||||
private void bypassButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!(GlobalData.CurrentUser is SharedDatabase.Entities.User) ||
|
||||
!(GlobalData.CurrentUser as SharedDatabase.Entities.User).IsMemberOf(bypassLevel))
|
||||
if (!CurrentUser.IsMemberOf(bypassLevel))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(bypassLevel)).ShowDialog() != DialogResult.OK)
|
||||
if ((new SharedDatabase.Forms.LoginDlg(bypassLevel, this)).ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
bypassLog.InfoFormat("{0} bypassed by {1}", message, GlobalData.GetCurrentUserName());
|
||||
bypassLog.InfoFormat("{0} bypassed by {1}", message, CurrentUser.UserName());
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@ -111,5 +108,10 @@ namespace TBF.Rig.Various.CoverTest
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void CoverTestForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ namespace TBF.Rig.Various.CoverTest
|
||||
this.Name = "CoverTestForm";
|
||||
this.Text = "Message";
|
||||
this.TopMost = true;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CoverTestForm_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
||||
@ -37,25 +37,31 @@ namespace TBF.UI.Bench.Components
|
||||
|
||||
int cmpntEntityId;
|
||||
|
||||
ComponentParametersDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a window to edit component configuration
|
||||
/// </summary>
|
||||
/// <param name="cmpntEntityId">Config.Entities.Component.Id or 0 when this is a new/copied/immported component</param>
|
||||
public ComponentParametersDlg(int cmpntEntityId = 0)
|
||||
public ComponentParametersDlg(Form parentForm, int cmpntEntityId = 0)
|
||||
: this()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.cmpntEntityId = cmpntEntityId;
|
||||
Flags = CfgUpdateFlags.None;
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = parentForm;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
sharedButtons.MoreButtonTop = ComponentCfgCtrlHeight - 45;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
|
||||
sharedButtons.Unlocked += Unlock;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.MoreClicked += moreButton_Click;
|
||||
sharedButtons.Unlocked += Unlock;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.MoreClicked += moreButton_Click;
|
||||
|
||||
Flags = CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
private void ComponentCfgForm_Load(object sender, EventArgs e)
|
||||
|
||||
@ -69,6 +69,7 @@ namespace TBF.UI.Bench.Components
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
@ -421,7 +422,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@ -502,7 +503,7 @@ namespace TBF.UI.Bench.Components
|
||||
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
|
||||
if (cfg != null)
|
||||
{
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(component.Id);
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this, component.Id);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfg.GetControl(cmpntEntities);
|
||||
cfgForm.ComponentCfgCtrl.Config = cfg;
|
||||
@ -544,7 +545,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@ -589,7 +590,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config.Name = cfgControl.Config.Name + " imported";
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@ -698,6 +699,8 @@ namespace TBF.UI.Bench.Components
|
||||
SaveDBChanges(session);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
this.splitContainer3 = new System.Windows.Forms.SplitContainer();
|
||||
this.isLargeStepLabel = new System.Windows.Forms.Label();
|
||||
this.radioButton9 = new System.Windows.Forms.RadioButton();
|
||||
this.radioButton8 = new System.Windows.Forms.RadioButton();
|
||||
this.deletePipeButton = new System.Windows.Forms.Button();
|
||||
@ -52,7 +53,6 @@
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.itemsListBox = new System.Windows.Forms.ListBox();
|
||||
this.isLargeStepLabel = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@ -90,11 +90,13 @@
|
||||
//
|
||||
this.drawingCtrl.AltStrings = null;
|
||||
this.drawingCtrl.BenchControlMode = false;
|
||||
this.drawingCtrl.CustomBitmaps = null;
|
||||
this.drawingCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.drawingCtrl.EditMode = false;
|
||||
this.drawingCtrl.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.drawingCtrl.Location = new System.Drawing.Point(0, 0);
|
||||
this.drawingCtrl.MeasuredValues = null;
|
||||
this.drawingCtrl.MsrmntAvailableFlags = null;
|
||||
this.drawingCtrl.Name = "drawingCtrl";
|
||||
this.drawingCtrl.PipesL = new string[0];
|
||||
this.drawingCtrl.PipesM = new string[0];
|
||||
@ -175,6 +177,19 @@
|
||||
this.splitContainer3.SplitterDistance = 138;
|
||||
this.splitContainer3.TabIndex = 0;
|
||||
//
|
||||
// isLargeStepLabel
|
||||
//
|
||||
this.isLargeStepLabel.AutoSize = true;
|
||||
this.isLargeStepLabel.BackColor = System.Drawing.Color.DarkOrchid;
|
||||
this.isLargeStepLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.isLargeStepLabel.ForeColor = System.Drawing.Color.Snow;
|
||||
this.isLargeStepLabel.Location = new System.Drawing.Point(33, 29);
|
||||
this.isLargeStepLabel.Name = "isLargeStepLabel";
|
||||
this.isLargeStepLabel.Size = new System.Drawing.Size(14, 13);
|
||||
this.isLargeStepLabel.TabIndex = 17;
|
||||
this.isLargeStepLabel.Text = "L";
|
||||
this.isLargeStepLabel.Visible = false;
|
||||
//
|
||||
// radioButton9
|
||||
//
|
||||
this.radioButton9.AutoSize = true;
|
||||
@ -396,19 +411,6 @@
|
||||
this.itemsListBox.TabIndex = 0;
|
||||
this.itemsListBox.SelectedIndexChanged += new System.EventHandler(this.itemsListBox_SelectedIndexChanged);
|
||||
//
|
||||
// isLargeStepLabel
|
||||
//
|
||||
this.isLargeStepLabel.AutoSize = true;
|
||||
this.isLargeStepLabel.BackColor = System.Drawing.Color.DarkOrchid;
|
||||
this.isLargeStepLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.isLargeStepLabel.ForeColor = System.Drawing.Color.Snow;
|
||||
this.isLargeStepLabel.Location = new System.Drawing.Point(33, 29);
|
||||
this.isLargeStepLabel.Name = "isLargeStepLabel";
|
||||
this.isLargeStepLabel.Size = new System.Drawing.Size(14, 13);
|
||||
this.isLargeStepLabel.TabIndex = 17;
|
||||
this.isLargeStepLabel.Text = "L";
|
||||
this.isLargeStepLabel.Visible = false;
|
||||
//
|
||||
// EditSchDrawingDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -419,6 +421,7 @@
|
||||
this.Name = "EditSchDrawingDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Schematic drawing";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditSchDrawingDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.EditSchDrawingDlg_Load);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.drawingCtrl_MouseDown);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
|
||||
@ -49,12 +49,16 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
InitializeComponent();
|
||||
Controls.Add(new TextBox() { Visible = false });
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg("Various.Drawing.");
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Administrators };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add;
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.AddClicked += addButton_Click;
|
||||
|
||||
radioButton1.Checked = true; /// Auto selection mode
|
||||
UpdateTitle();
|
||||
}
|
||||
@ -264,7 +268,7 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@ -1003,5 +1007,10 @@ namespace TBF.UI.Bench.EditSchDrawing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EditSchDrawingDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
121
TBF/UI/Bench/Metrology/MetrologyDlg.Designer.cs
generated
121
TBF/UI/Bench/Metrology/MetrologyDlg.Designer.cs
generated
@ -31,66 +31,67 @@ namespace TBF.UI.Bench.Metrology
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.metrologyTabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
this.splitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer.Name = "splitContainer";
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.metrologyTabControl);
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
this.splitContainer.Size = new System.Drawing.Size(965, 344);
|
||||
this.splitContainer.SplitterDistance = 863;
|
||||
this.splitContainer.TabIndex = 0;
|
||||
//
|
||||
// metrologyTabControl
|
||||
//
|
||||
this.metrologyTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.metrologyTabControl.ItemSize = new System.Drawing.Size(60, 30);
|
||||
this.metrologyTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.metrologyTabControl.Name = "metrologyTabControl";
|
||||
this.metrologyTabControl.SelectedIndex = 0;
|
||||
this.metrologyTabControl.Size = new System.Drawing.Size(863, 344);
|
||||
this.metrologyTabControl.TabIndex = 0;
|
||||
this.metrologyTabControl.SelectedIndexChanged += new System.EventHandler(this.metrologyTabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
this.sharedButtons.Location = new System.Drawing.Point(-2, 0);
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
this.sharedButtons.Size = new System.Drawing.Size(100, 400);
|
||||
this.sharedButtons.TabIndex = 0;
|
||||
//
|
||||
// MetrologyDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(965, 344);
|
||||
this.Controls.Add(this.splitContainer);
|
||||
this.Name = "MetrologyDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Metrology";
|
||||
this.Load += new System.EventHandler(this.MetrologyDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
this.splitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
|
||||
this.splitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.metrologyTabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
this.splitContainer.Panel2.SuspendLayout();
|
||||
this.splitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// splitContainer
|
||||
//
|
||||
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer.Name = "splitContainer";
|
||||
//
|
||||
// splitContainer.Panel1
|
||||
//
|
||||
this.splitContainer.Panel1.Controls.Add(this.metrologyTabControl);
|
||||
//
|
||||
// splitContainer.Panel2
|
||||
//
|
||||
this.splitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
this.splitContainer.Size = new System.Drawing.Size(965, 344);
|
||||
this.splitContainer.SplitterDistance = 863;
|
||||
this.splitContainer.TabIndex = 0;
|
||||
//
|
||||
// metrologyTabControl
|
||||
//
|
||||
this.metrologyTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.metrologyTabControl.ItemSize = new System.Drawing.Size(60, 30);
|
||||
this.metrologyTabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.metrologyTabControl.Name = "metrologyTabControl";
|
||||
this.metrologyTabControl.SelectedIndex = 0;
|
||||
this.metrologyTabControl.Size = new System.Drawing.Size(863, 344);
|
||||
this.metrologyTabControl.TabIndex = 0;
|
||||
this.metrologyTabControl.SelectedIndexChanged += new System.EventHandler(this.metrologyTabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
this.sharedButtons.Location = new System.Drawing.Point(-2, 0);
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
this.sharedButtons.Size = new System.Drawing.Size(100, 400);
|
||||
this.sharedButtons.TabIndex = 0;
|
||||
//
|
||||
// MetrologyDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(965, 344);
|
||||
this.Controls.Add(this.splitContainer);
|
||||
this.Name = "MetrologyDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Metrology";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MetrologyDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.MetrologyDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
this.splitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
|
||||
this.splitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -27,6 +27,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists, Common.GID.MetrologicalAuthority };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove;
|
||||
sharedButtons.Unlocked += unlockButton_Click;
|
||||
@ -342,5 +343,10 @@ namespace TBF.UI.Bench.Metrology
|
||||
{
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
|
||||
}
|
||||
|
||||
private void MetrologyDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
TBF/UI/Bench/Paths/PathsDlg.Designer.cs
generated
1
TBF/UI/Bench/Paths/PathsDlg.Designer.cs
generated
@ -162,6 +162,7 @@ namespace TBF.UI.Bench.Paths
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.splitContainer);
|
||||
this.Name = "PathsDlg";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PathsDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.PathsDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
this.splitContainer.Panel2.ResumeLayout(false);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -51,7 +51,8 @@ namespace TBF.UI.Bench.Paths
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
@ -350,5 +351,10 @@ namespace TBF.UI.Bench.Paths
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
||||
}
|
||||
}
|
||||
|
||||
private void PathsDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<value>pathsFeedingCtrl</value>
|
||||
</data>
|
||||
<data name=">>pathsFeedingCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.PathsFeedingCtrl, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Bench.Paths.PathsFeedingCtrl, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pathsFeedingCtrl.Parent" xml:space="preserve">
|
||||
<value>feedingTabPage</value>
|
||||
@ -196,7 +196,7 @@
|
||||
<value>pathsBenchCtrl</value>
|
||||
</data>
|
||||
<data name=">>pathsBenchCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.PathsBenchCtrl, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Bench.Paths.PathsBenchCtrl, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pathsBenchCtrl.Parent" xml:space="preserve">
|
||||
<value>benchTabPage</value>
|
||||
@ -247,7 +247,7 @@
|
||||
<value>pathsOutputCtrl</value>
|
||||
</data>
|
||||
<data name=">>pathsOutputCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.PathsOutputCtrl, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Bench.Paths.PathsOutputCtrl, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pathsOutputCtrl.Parent" xml:space="preserve">
|
||||
<value>outputTabPage</value>
|
||||
@ -298,7 +298,7 @@
|
||||
<value>pathsMetersCtrl</value>
|
||||
</data>
|
||||
<data name=">>pathsMetersCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.PathsMetersCtrl, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Bench.Paths.PathsMetersCtrl, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pathsMetersCtrl.Parent" xml:space="preserve">
|
||||
<value>metersTabPage</value>
|
||||
@ -330,54 +330,6 @@
|
||||
<data name=">>metersTabPage.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="pathsHeatMetersCtrl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="pathsHeatMetersCtrl.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="pathsHeatMetersCtrl.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>831, 277</value>
|
||||
</data>
|
||||
<data name="pathsHeatMetersCtrl.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>pathsHeatMetersCtrl.Name" xml:space="preserve">
|
||||
<value>pathsHeatMetersCtrl</value>
|
||||
</data>
|
||||
<data name=">>pathsHeatMetersCtrl.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.PathsHeatMetersCtrl, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>pathsHeatMetersCtrl.Parent" xml:space="preserve">
|
||||
<value>heatMetersTabPage</value>
|
||||
</data>
|
||||
<data name=">>pathsHeatMetersCtrl.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="heatMetersTabPage.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 34</value>
|
||||
</data>
|
||||
<data name="heatMetersTabPage.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>831, 277</value>
|
||||
</data>
|
||||
<data name="heatMetersTabPage.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="heatMetersTabPage.Text" xml:space="preserve">
|
||||
<value>Heat meter sensors</value>
|
||||
</data>
|
||||
<data name=">>heatMetersTabPage.Name" xml:space="preserve">
|
||||
<value>heatMetersTabPage</value>
|
||||
</data>
|
||||
<data name=">>heatMetersTabPage.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>heatMetersTabPage.Parent" xml:space="preserve">
|
||||
<value>pathsTabControl</value>
|
||||
</data>
|
||||
<data name=">>heatMetersTabPage.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="pathsTabControl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
@ -430,7 +382,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.SharedButtons, TBF, Version=2.8.315.1, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel2</value>
|
||||
|
||||
@ -36,28 +36,40 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
bool unlocked;
|
||||
|
||||
public TestProfileDlg()
|
||||
TestProfileDlg()
|
||||
{
|
||||
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||
InitializeComponent();
|
||||
|
||||
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||
Dpi = (int)this.CreateGraphics().DpiX;
|
||||
openUnlocked = false;
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
public TestProfileDlg(Profile profile, IList<string> usedNames, bool openUnlocked, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
if (profile == null) throw new ArgumentNullException("profile");
|
||||
|
||||
LoadedProfile = profile;
|
||||
this.usedNames = usedNames;
|
||||
this.openUnlocked = openUnlocked;
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = parentForm;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.MetrologicalAuthority };
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up |
|
||||
SharedButtons.Buttons.Down;
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.AddClicked += addButton_Click;
|
||||
sharedButtons.RemoveClicked += removeButton_Click;
|
||||
sharedButtons.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.AddClicked += addButton_Click;
|
||||
sharedButtons.RemoveClicked += removeButton_Click;
|
||||
sharedButtons.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
|
||||
/// ListViewEx-es configuration
|
||||
/// ListViewEx-es configuration
|
||||
metrologyListViewEx.SubItemClicked += new SubItemEventHandler(metrologyListViewEx_SubItemClicked);
|
||||
metrologyListViewEx.SubItemRightClicked += new SubItemEventHandler(metrologyListViewEx_SubItemRightClicked);
|
||||
metrologyListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrologyListViewEx_SubItemEndEditing);
|
||||
@ -71,19 +83,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
errorFlags2ListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(errorFlags2ListViewEx_SubItemEndEditing);
|
||||
|
||||
SelectedTestIx = -1;
|
||||
}
|
||||
|
||||
public TestProfileDlg(Config.Entities.Profile profile, IList<string> usedNames, bool openUnlocked = false)
|
||||
: this()
|
||||
{
|
||||
if (profile == null) throw new ArgumentNullException("profile");
|
||||
|
||||
LoadedProfile = profile;
|
||||
this.usedNames = usedNames;
|
||||
this.openUnlocked = openUnlocked;
|
||||
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.MetrologicalAuthority };
|
||||
}
|
||||
}
|
||||
|
||||
private void TestProfileDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@ -745,7 +745,7 @@
|
||||
<value>metrologyListViewEx</value>
|
||||
</data>
|
||||
<data name=">>metrologyListViewEx.Type" xml:space="preserve">
|
||||
<value>Common.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>metrologyListViewEx.Parent" xml:space="preserve">
|
||||
<value>metrologyTabPage</value>
|
||||
@ -796,7 +796,7 @@
|
||||
<value>errorFlagsListViewEx</value>
|
||||
</data>
|
||||
<data name=">>errorFlagsListViewEx.Type" xml:space="preserve">
|
||||
<value>Common.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>errorFlagsListViewEx.Parent" xml:space="preserve">
|
||||
<value>errorFlagsTabPage</value>
|
||||
@ -844,7 +844,7 @@
|
||||
<value>errorFlags2ListViewEx</value>
|
||||
</data>
|
||||
<data name=">>errorFlags2ListViewEx.Type" xml:space="preserve">
|
||||
<value>Common.Forms.ListViewEx, Results, Version=2.24.1369.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>errorFlags2ListViewEx.Parent" xml:space="preserve">
|
||||
<value>errorFlags2TabPage</value>
|
||||
@ -928,7 +928,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.24.1372.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
|
||||
@ -212,10 +212,10 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
}
|
||||
|
||||
Profile newProfile = new Profile(newName, MyItems.Count);
|
||||
newProfile.CreationUser = GlobalData.CurrentUser.UserName;
|
||||
newProfile.CreationUser = CurrentUser.UserName();
|
||||
newProfile.CreationTime = DateTime.Now;
|
||||
|
||||
if (new TestProfileDlg(newProfile, GetUsedNames(false), true).ShowDialog() == DialogResult.OK)
|
||||
if (new TestProfileDlg(newProfile, GetUsedNames(false), true, parent).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
@ -224,7 +224,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
try
|
||||
{
|
||||
newProfile.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProfile.LastChgUser = CurrentUser.UserName();
|
||||
newProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProfile);
|
||||
@ -295,7 +295,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
IList<string> usedNames = GetUsedNames(false);
|
||||
usedNames.Remove(editedProfile.Name.ToLower()); /// Allow original procedure name
|
||||
///
|
||||
if (new TestProfileDlg(editedProfile, usedNames).ShowDialog() == DialogResult.OK)
|
||||
if (new TestProfileDlg(editedProfile, usedNames, false, parent).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
parent.Unlock();
|
||||
|
||||
@ -303,7 +303,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
try
|
||||
{
|
||||
editedProfile.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
editedProfile.LastChgUser = CurrentUser.UserName();
|
||||
editedProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
session.SaveOrUpdate(editedProfile);
|
||||
@ -337,17 +337,17 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
newProfile.Name = selectedProfile.Name + Strings.New_name_copy;
|
||||
newProfile.ItemNr = MyItems.Count;
|
||||
newProfile.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProfile.CreationUser = CurrentUser.UserName();
|
||||
newProfile.CreationTime = DateTime.Now;
|
||||
|
||||
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
|
||||
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true, parent)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
newProfile.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProfile.LastChgUser = CurrentUser.UserName();
|
||||
newProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProfile);
|
||||
@ -386,17 +386,17 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
newProfile.Name = newProfile.Name + " imported";
|
||||
newProfile.ItemNr = MyItems.Count;
|
||||
newProfile.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProfile.CreationUser = CurrentUser.UserName();
|
||||
newProfile.CreationTime = DateTime.Now;
|
||||
|
||||
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true)).ShowDialog() == DialogResult.OK)
|
||||
if ((new TestProfileDlg(newProfile, GetUsedNames(false), true, parent)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
newProfile.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProfile.LastChgUser = CurrentUser.UserName();
|
||||
newProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProfile);
|
||||
|
||||
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
|
||||
@ -25,7 +26,8 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.MetrologicalAuthority };
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.MetrologicalAuthority };
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
|
||||
@ -217,5 +219,10 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
||||
}
|
||||
}
|
||||
|
||||
private void TestProfilesDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,6 +88,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
this.Name = "TestProfilesDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "TestProfilesDlg";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TestProfilesDlg_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProceduresDlg_FormClosed);
|
||||
this.Load += new System.EventHandler(this.TestProfilesDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
|
||||
97
TBF/UI/Bench/Transitions/TransitionsDlg.Designer.cs
generated
97
TBF/UI/Bench/Transitions/TransitionsDlg.Designer.cs
generated
@ -31,54 +31,55 @@ namespace TBF.UI.Bench.Transitions
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransitionsDlg));
|
||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||
this.mainSplitContainer.Panel1.SuspendLayout();
|
||||
this.mainSplitContainer.Panel2.SuspendLayout();
|
||||
this.mainSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainSplitContainer
|
||||
//
|
||||
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
|
||||
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.mainSplitContainer.Name = "mainSplitContainer";
|
||||
//
|
||||
// mainSplitContainer.Panel1
|
||||
//
|
||||
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
|
||||
//
|
||||
// mainSplitContainer.Panel2
|
||||
//
|
||||
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
resources.ApplyResources(this.tabControl, "tabControl");
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
resources.ApplyResources(this.sharedButtons, "sharedButtons");
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
//
|
||||
// TransitionsDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.mainSplitContainer);
|
||||
this.Name = "TransitionsDlg";
|
||||
this.Load += new System.EventHandler(this.TransitionsDlg_Load);
|
||||
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
|
||||
this.mainSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TransitionsDlg));
|
||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.tabControl = new System.Windows.Forms.TabControl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||
this.mainSplitContainer.Panel1.SuspendLayout();
|
||||
this.mainSplitContainer.Panel2.SuspendLayout();
|
||||
this.mainSplitContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// mainSplitContainer
|
||||
//
|
||||
resources.ApplyResources(this.mainSplitContainer, "mainSplitContainer");
|
||||
this.mainSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.mainSplitContainer.Name = "mainSplitContainer";
|
||||
//
|
||||
// mainSplitContainer.Panel1
|
||||
//
|
||||
this.mainSplitContainer.Panel1.Controls.Add(this.tabControl);
|
||||
//
|
||||
// mainSplitContainer.Panel2
|
||||
//
|
||||
this.mainSplitContainer.Panel2.Controls.Add(this.sharedButtons);
|
||||
//
|
||||
// tabControl
|
||||
//
|
||||
resources.ApplyResources(this.tabControl, "tabControl");
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged);
|
||||
//
|
||||
// sharedButtons
|
||||
//
|
||||
resources.ApplyResources(this.sharedButtons, "sharedButtons");
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
//
|
||||
// TransitionsDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.mainSplitContainer);
|
||||
this.Name = "TransitionsDlg";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TransitionsDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.TransitionsDlg_Load);
|
||||
this.mainSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.mainSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).EndInit();
|
||||
this.mainSplitContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -66,7 +66,8 @@ namespace TBF.UI.Bench.Transitions
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Export | SharedButtons.Buttons.Import |
|
||||
@ -703,5 +704,10 @@ namespace TBF.UI.Bench.Transitions
|
||||
{
|
||||
MessageBox.Show("Comparing sequences in not implemented yet");
|
||||
}
|
||||
|
||||
private void TransitionsDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UiControls.SharedButtons, TBF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=3.2.1913.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
@ -231,9 +231,6 @@
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>863, 366</value>
|
||||
</data>
|
||||
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
|
||||
@ -27,6 +27,7 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
#if KEMPNO_50
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.MetrologicalAuthority };
|
||||
#else
|
||||
@ -304,5 +305,10 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
|
||||
}
|
||||
|
||||
private void UncertaintiesDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,6 +85,7 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
this.Name = "UncertaintiesDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Uncertainty";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UncertaintiesDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.UncertaintiesDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
this.splitContainer.Panel2.ResumeLayout(false);
|
||||
|
||||
@ -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;
|
||||
@ -13,6 +13,7 @@ using Common;
|
||||
using Config.Entities;
|
||||
using Dirichlet.Numerics;
|
||||
using SchematicDrawing;
|
||||
using SharedDatabase;
|
||||
using TBF.Resources;
|
||||
using TBF.UiBridge;
|
||||
using TBF.UI.Shared;
|
||||
@ -628,24 +629,22 @@ namespace TBF.UI
|
||||
|
||||
public void UpdateUser()
|
||||
{
|
||||
userInfoStatusLabel.Text = string.Format("{0}: {1}{2}, ", Strings.User, GlobalData.CurrentUser.UserName,
|
||||
(GlobalData.AuthorizedAs == AuthorizedAs.PowerUser) ? "(S)" :
|
||||
(GlobalData.AuthorizedAs == AuthorizedAs.LocalUser) ? "(L)" : "(R)");
|
||||
userInfoStatusLabel.Text = string.Format("{0}: {1}{2}, ", Strings.User, CurrentUser.UserName(),
|
||||
(CurrentUser.AuthorizedAs == AuthorizedAs.PowerUser) ? "(S)" :
|
||||
(CurrentUser.AuthorizedAs == AuthorizedAs.LocalUser) ? "(L)" : "(R)");
|
||||
|
||||
UpdateMenuItemsVisibility();
|
||||
}
|
||||
|
||||
void UpdateMenuItemsVisibility()
|
||||
{
|
||||
SharedDatabase.Entities.User cu = GlobalData.CurrentUser as SharedDatabase.Entities.User;
|
||||
|
||||
usersTSMenuItem.Visible = cu != null && (cu.IsMemberOf(GID.Administrators) || cu.IsMemberOf(GID.HeadOfLab));
|
||||
databaseSettingsTSMenuItem.Visible = cu != null && cu.IsMemberOf(GID.Administrators) && cu.IsPowerUser();
|
||||
upgradeTSMenuItem.Visible = cu != null && cu.IsMemberOf(GID.Administrators) && cu.IsPowerUser();
|
||||
clearCountersToolStripMenuItem.Visible = cu != null && (cu.IsMemberOf(GID.Administrators) ||
|
||||
cu.IsMemberOf(GID.HeadOfLab) ||
|
||||
cu.IsMemberOf(GID.TestingSpecialists) ||
|
||||
cu.IsMemberOf(GID.Metrologists));
|
||||
usersTSMenuItem.Visible = CurrentUser.IsMemberOf(GID.Administrators) || CurrentUser.IsMemberOf(GID.HeadOfLab);
|
||||
databaseSettingsTSMenuItem.Visible = CurrentUser.IsMemberOf(GID.Administrators) && CurrentUser.IsPowerUser();
|
||||
upgradeTSMenuItem.Visible = CurrentUser.IsMemberOf(GID.Administrators) && CurrentUser.IsPowerUser();
|
||||
clearCountersToolStripMenuItem.Visible = CurrentUser.IsMemberOf(GID.Administrators) ||
|
||||
CurrentUser.IsMemberOf(GID.HeadOfLab) ||
|
||||
CurrentUser.IsMemberOf(GID.TestingSpecialists) ||
|
||||
CurrentUser.IsMemberOf(GID.Metrologists);
|
||||
}
|
||||
|
||||
public void UpdateStatusP(string statusPStr)
|
||||
@ -714,7 +713,7 @@ namespace TBF.UI
|
||||
}
|
||||
private void backUpConfigTSMItem_Click(object s, EventArgs e) { BackupConfiguration(); }
|
||||
private void backUpResultsTSMItem_Click(object s, EventArgs e) { BackupResults(); }
|
||||
private void passwdTSMItem_Click(object s, EventArgs e) { new SharedDatabase.Forms.PasswordChangeDlg(GlobalData.GetCurrentUserName()).ShowDialog(); }
|
||||
private void passwdTSMItem_Click(object s, EventArgs e) { new SharedDatabase.Forms.PasswordChangeDlg(CurrentUser.UserName()).ShowDialog(); }
|
||||
private void aboutTSMItem_Click(object s, EventArgs e) { new TBF.UI.Help.AboutDlg().ShowDialog(); }
|
||||
|
||||
/// <summary>
|
||||
@ -1107,7 +1106,7 @@ namespace TBF.UI
|
||||
GID[] reqGrpMembership = null;
|
||||
#endif
|
||||
|
||||
if (new SharedDatabase.Forms.LoginDlg(reqGrpMembership).ShowDialog() == DialogResult.OK)
|
||||
if (new SharedDatabase.Forms.LoginDlg(reqGrpMembership, this).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
UpdateUser();
|
||||
}
|
||||
|
||||
@ -65,26 +65,38 @@ namespace TBF.UI.Procedures
|
||||
|
||||
bool unlocked;
|
||||
|
||||
public ProcedureDlg()
|
||||
ProcedureDlg()
|
||||
{
|
||||
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||
Dpi = (int)this.CreateGraphics().DpiX;
|
||||
initialMode = Mode.Locked;
|
||||
InitializeComponent();
|
||||
|
||||
InitializeComponent();
|
||||
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||
Dpi = (int)this.CreateGraphics().DpiX;
|
||||
}
|
||||
|
||||
public ProcedureDlg(Procedure procedure, IList<string> usedNames, Mode initialMode, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
if (procedure == null) throw new ArgumentNullException("procedure");
|
||||
|
||||
LoadedProcedure = procedure;
|
||||
this.usedNames = usedNames;
|
||||
this.initialMode = initialMode;
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = parentForm;
|
||||
#if KEMPNO_50 || KRAKOW_50
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.WaterMeterAuthority }
|
||||
: new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.Metrologists }
|
||||
: new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
#endif
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up |
|
||||
SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Copy;
|
||||
|
||||
#if TURA_SPECIAL || TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Custom button 'Načítaj testy iPerl z Oracle'
|
||||
sharedButtons.OptionalButtons |= SharedButtons.Buttons.Custom1;
|
||||
@ -92,15 +104,16 @@ namespace TBF.UI.Procedures
|
||||
sharedButtons.Custom1Clicked += iPerlWizardButton_Click;
|
||||
#endif
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.AddClicked += addButton_Click;
|
||||
sharedButtons.RemoveClicked += removeButton_Click;
|
||||
sharedButtons.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.AddClicked += addButton_Click;
|
||||
sharedButtons.RemoveClicked += removeButton_Click;
|
||||
sharedButtons.UpClicked += upButton_Click;
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.CopyClicked += copyButton_Click;
|
||||
if (initialMode == Mode.PermanentlyLocked) sharedButtons.DisableUnlock();
|
||||
|
||||
/// ListViewEx-es configuration
|
||||
/// ListViewEx-es configuration
|
||||
metrology1ListViewEx.SubItemClicked += new SubItemEventHandler(metrology1ListViewEx_SubItemClicked);
|
||||
metrology1ListViewEx.SubItemRightClicked += new SubItemEventHandler(metrology1ListViewEx_SubItemRightClicked);
|
||||
metrology1ListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(metrology1ListViewEx_SubItemEndEditing);
|
||||
@ -118,25 +131,6 @@ namespace TBF.UI.Procedures
|
||||
parametersListViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(parametersListViewEx_SubItemEndEditing);
|
||||
|
||||
SelectedTestIx = -1;
|
||||
}
|
||||
|
||||
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames, Mode initialMode)
|
||||
: this()
|
||||
{
|
||||
if (procedure == null) throw new ArgumentNullException("procedure");
|
||||
|
||||
LoadedProcedure = procedure;
|
||||
this.usedNames = usedNames;
|
||||
this.initialMode = initialMode;
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.WaterMeterAuthority }
|
||||
: new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.Metrologists }
|
||||
: new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
#endif
|
||||
if (initialMode == Mode.PermanentlyLocked) sharedButtons.DisableUnlock();
|
||||
|
||||
using (NHibernate.ISession session = TBF.DB.CreateSession(DBKind.Config))
|
||||
{
|
||||
@ -2117,7 +2111,7 @@ namespace TBF.UI.Procedures
|
||||
procNameTextBox.Enabled = true;
|
||||
descriptionTextBox.Enabled = true;
|
||||
variantTextBox.Enabled = true;
|
||||
protectedCheckBox.Enabled = GlobalData.CurrentUser.IsMemberOf(GID.Metrologists);
|
||||
protectedCheckBox.Enabled = CurrentUser.IsMemberOf(GID.Metrologists);
|
||||
mustBeCompleteCheckBox.Enabled = true;
|
||||
manualControlDisabledCheckBox.Enabled = true;
|
||||
dataEntryComboBox.Enabled = true;
|
||||
@ -2857,7 +2851,7 @@ namespace TBF.UI.Procedures
|
||||
/// <param name="procedure">Loaded procedure</param>
|
||||
/// <param name="sensorsPath">Selected sensors path</param>
|
||||
/// <param name="roiData">ROI data</param>
|
||||
void AddProcedureParamsToRoiComponents(Config.Entities.Procedure procedure, string sensorsPathName, TestWizard.RoiData roiData)
|
||||
void AddProcedureParamsToRoiComponents(Procedure procedure, string sensorsPathName, TestWizard.RoiData roiData)
|
||||
{
|
||||
IList<IComponent> cmpntsInSensPath = new List<IComponent>();
|
||||
|
||||
@ -3087,7 +3081,7 @@ namespace TBF.UI.Procedures
|
||||
|
||||
if (lvi.Tag is Procedure)
|
||||
{
|
||||
(new ProcedureDlg(lvi.Tag as Procedure, new List<string>(), ProcedureDlg.Mode.PermanentlyLocked)).ShowDialog();
|
||||
(new ProcedureDlg(lvi.Tag as Procedure, new List<string>(), ProcedureDlg.Mode.PermanentlyLocked, sharedButtons.ParentForm)).ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -304,10 +304,10 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.CreationUser = CurrentUser.UserName();
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
|
||||
if (new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked).ShowDialog() == DialogResult.OK)
|
||||
if (new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked, parent).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
@ -316,7 +316,7 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
try
|
||||
{
|
||||
newProcedure.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.LastChgUser = CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -542,7 +542,7 @@ namespace TBF.UI.Procedures
|
||||
IList<string> usedNames = GetUsedNames(false);
|
||||
usedNames.Remove(originalProcedure.Name.ToLower()); /// Allow original procedure name
|
||||
///
|
||||
if (new ProcedureDlg(modifiedProcedure, usedNames, ProcedureDlg.Mode.Locked).ShowDialog() == DialogResult.OK)
|
||||
if (new ProcedureDlg(modifiedProcedure, usedNames, ProcedureDlg.Mode.Locked, parent).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
parent.Unlock();
|
||||
|
||||
@ -551,7 +551,7 @@ namespace TBF.UI.Procedures
|
||||
try
|
||||
{
|
||||
originalProcedure.ProcedureState = ProcedureState.History;
|
||||
modifiedProcedure.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
modifiedProcedure.LastChgUser = CurrentUser.UserName();
|
||||
modifiedProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
session.SaveOrUpdate(originalProcedure);
|
||||
@ -591,18 +591,18 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = selectedProcedure.Id;
|
||||
newProcedure.ObtainedByCopy = true;
|
||||
newProcedure.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.CreationUser = CurrentUser.UserName();
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
newProcedure.Protected = false;
|
||||
|
||||
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked)).ShowDialog() == DialogResult.OK)
|
||||
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked, parent)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
newProcedure.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.LastChgUser = CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -645,17 +645,17 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.CreationUser = CurrentUser.UserName();
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
|
||||
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked)).ShowDialog() == DialogResult.OK)
|
||||
if ((new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked, parent)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
newProcedure.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.LastChgUser = CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -726,7 +726,9 @@ namespace TBF.UI.Procedures
|
||||
IList<IParamsProvider> errorFlagsParamsOfCreatedTests = new List<IParamsProvider>();
|
||||
IList<IParamsProvider> waterMeterParamsOfNewProcedure = new List<IParamsProvider>();
|
||||
|
||||
var cmpntEntities = session.QueryOver<Component>().OrderBy(x => x.ItemNr).Asc.List<Component>();
|
||||
var cmpntEntities = session.QueryOver<Component>()
|
||||
.OrderBy(x => x.ItemNr).Asc
|
||||
.List<Component>();
|
||||
IList<Rig.Generic.IComponent> components = Rig.TbfComponents.LoadComponentsFromDB(cmpntEntities);
|
||||
foreach (var cmptn in components)
|
||||
{
|
||||
@ -860,10 +862,10 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.CreationUser = CurrentUser.UserName();
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
|
||||
if (new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked).ShowDialog() == DialogResult.OK)
|
||||
if (new ProcedureDlg(newProcedure, GetUsedNames(false), ProcedureDlg.Mode.Unlocked, parent).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
@ -872,7 +874,7 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
try
|
||||
{
|
||||
newProcedure.LastChgUser = GlobalData.GetCurrentUserName();
|
||||
newProcedure.LastChgUser = CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
|
||||
5
TBF/UI/Procedures/ProceduresDlg.Designer.cs
generated
5
TBF/UI/Procedures/ProceduresDlg.Designer.cs
generated
@ -32,7 +32,7 @@ namespace TBF.UI.Procedures
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.proceduresCtrl = new ProceduresCtrl();
|
||||
this.proceduresCtrl = new TBF.UI.Procedures.ProceduresCtrl();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
|
||||
this.splitContainer.Panel1.SuspendLayout();
|
||||
@ -63,7 +63,7 @@ namespace TBF.UI.Procedures
|
||||
this.proceduresCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.proceduresCtrl.Location = new System.Drawing.Point(0, 0);
|
||||
this.proceduresCtrl.Name = "proceduresCtrl";
|
||||
this.proceduresCtrl.Size = new System.Drawing.Size(412, 402);
|
||||
this.proceduresCtrl.Size = new System.Drawing.Size(606, 402);
|
||||
this.proceduresCtrl.TabIndex = 0;
|
||||
//
|
||||
// sharedButtons
|
||||
@ -82,6 +82,7 @@ namespace TBF.UI.Procedures
|
||||
this.Name = "ProceduresDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "ProceduresDlg";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProceduresDlg_FormClosing);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProceduresDlg_FormClosed);
|
||||
this.Load += new System.EventHandler(this.ProceduresDlg_Load);
|
||||
this.splitContainer.Panel1.ResumeLayout(false);
|
||||
|
||||
@ -25,6 +25,7 @@ namespace TBF.UI.Procedures
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
|
||||
#if TEST_PROFILES
|
||||
@ -252,5 +253,10 @@ namespace TBF.UI.Procedures
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProceduresDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
TBF/UI/ResultsMI/DeleteFromOracleForm.Designer.cs
generated
19
TBF/UI/ResultsMI/DeleteFromOracleForm.Designer.cs
generated
@ -29,9 +29,9 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.selectWhatToDeleteGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.waterMetersTextBox = new System.Windows.Forms.TextBox();
|
||||
this.waterMetersRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.batchRadioButton = new System.Windows.Forms.RadioButton();
|
||||
this.waterMetersTextBox = new System.Windows.Forms.TextBox();
|
||||
this.startButton = new System.Windows.Forms.Button();
|
||||
this.activityGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.activityTextBox = new System.Windows.Forms.TextBox();
|
||||
@ -61,14 +61,6 @@
|
||||
this.selectWhatToDeleteGroupBox.TabStop = false;
|
||||
this.selectWhatToDeleteGroupBox.Text = "Select what to delete";
|
||||
//
|
||||
// waterMetersTextBox
|
||||
//
|
||||
this.waterMetersTextBox.Location = new System.Drawing.Point(267, 70);
|
||||
this.waterMetersTextBox.Multiline = true;
|
||||
this.waterMetersTextBox.Name = "waterMetersTextBox";
|
||||
this.waterMetersTextBox.Size = new System.Drawing.Size(211, 56);
|
||||
this.waterMetersTextBox.TabIndex = 2;
|
||||
//
|
||||
// waterMetersRadioButton
|
||||
//
|
||||
this.waterMetersRadioButton.AutoSize = true;
|
||||
@ -91,6 +83,14 @@
|
||||
this.batchRadioButton.Text = "Batch";
|
||||
this.batchRadioButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// waterMetersTextBox
|
||||
//
|
||||
this.waterMetersTextBox.Location = new System.Drawing.Point(267, 70);
|
||||
this.waterMetersTextBox.Multiline = true;
|
||||
this.waterMetersTextBox.Name = "waterMetersTextBox";
|
||||
this.waterMetersTextBox.Size = new System.Drawing.Size(211, 56);
|
||||
this.waterMetersTextBox.TabIndex = 2;
|
||||
//
|
||||
// startButton
|
||||
//
|
||||
this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -209,6 +209,7 @@
|
||||
this.MinimumSize = new System.Drawing.Size(600, 500);
|
||||
this.Name = "DeleteFromOracleForm";
|
||||
this.Text = "Delete Data From Oracle";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DeleteFromOracleForm_FormClosing);
|
||||
this.selectWhatToDeleteGroupBox.ResumeLayout(false);
|
||||
this.selectWhatToDeleteGroupBox.PerformLayout();
|
||||
this.activityGroupBox.ResumeLayout(false);
|
||||
|
||||
@ -383,5 +383,10 @@ namespace TBF.UI.ResultsMI
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteFromOracleForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,6 +249,7 @@ namespace TBF.UI.ResultsMI
|
||||
this.Name = "ResultsArrangementDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "ResultsConfig";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ResultsArrangementDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.ResultsConfig_Load);
|
||||
this.testsArangementGroupBox.ResumeLayout(false);
|
||||
this.testsArangementGroupBox.PerformLayout();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2017 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -91,19 +91,17 @@ namespace TBF.UI.ResultsMI
|
||||
{
|
||||
if (!Unlocked)
|
||||
{
|
||||
if (!GlobalData.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
if (!CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new SharedDatabase.Forms.LoginDlg(RequiredGroupMembership, this)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
else if (Program.LocalSettings.AlwaysAskPasswdWhenUnlocking)
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(GlobalData.GetCurrentUserName(), RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new SharedDatabase.Forms.LoginDlg(CurrentUser.UserName(), RequiredGroupMembership, this)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
|
||||
Unlocked = true;
|
||||
|
||||
///
|
||||
@ -121,7 +119,9 @@ namespace TBF.UI.ResultsMI
|
||||
minWidthTextBox.Enabled = true;
|
||||
minHeightTextBox.Enabled = true;
|
||||
resultsConfigCtrl.Unlocked = true;
|
||||
}
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
|
||||
void okButton_Click(object sender, EventArgs e)
|
||||
@ -138,5 +138,10 @@ namespace TBF.UI.ResultsMI
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ResultsArrangementDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
@ -218,16 +218,17 @@ namespace TBF.UI.ResultsMI
|
||||
/// </summary>
|
||||
private void configureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ResultsArrangementDlg dlg = new ResultsArrangementDlg();
|
||||
|
||||
dlg.MetersKind = metersKind;
|
||||
dlg.TestsArrangement = TestsArrangement;
|
||||
dlg.MetersArrangement = MetersArrangement;
|
||||
dlg.NrMetersInOneGroup = NrMetersInOneGroup;
|
||||
dlg.ShowDisabledPositions = ShowDisabledPositions;
|
||||
dlg.MinWidth = MinWidth;
|
||||
dlg.MinHeight = MinHeight;
|
||||
dlg.SelectedItems = GetRsltItems(metersKind);
|
||||
ResultsArrangementDlg dlg = new ResultsArrangementDlg()
|
||||
{
|
||||
MetersKind = metersKind,
|
||||
TestsArrangement = TestsArrangement,
|
||||
MetersArrangement = MetersArrangement,
|
||||
NrMetersInOneGroup = NrMetersInOneGroup,
|
||||
ShowDisabledPositions = ShowDisabledPositions,
|
||||
MinWidth = MinWidth,
|
||||
MinHeight = MinHeight,
|
||||
SelectedItems = GetRsltItems(metersKind)
|
||||
};
|
||||
|
||||
DialogResult dr = dlg.ShowDialog();
|
||||
if (dr == DialogResult.OK && dlg.Unlocked)
|
||||
|
||||
@ -283,7 +283,7 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !GlobalData.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !GlobalData.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(new GID[] { GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
@ -300,7 +300,7 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !GlobalData.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !GlobalData.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(new GID[] { GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
@ -317,7 +317,7 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !GlobalData.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !GlobalData.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(new GID[] { GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
@ -72,9 +72,9 @@ namespace TBF.UI.Shared
|
||||
Middle,
|
||||
}
|
||||
|
||||
public GID[] RequiredGroupMembership;
|
||||
public Form ParentForm; /// Used as a current form reference when changing and restoring a user
|
||||
|
||||
IUser originalUser;
|
||||
public GID[] RequiredGroupMembership;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
@ -82,7 +82,6 @@ namespace TBF.UI.Shared
|
||||
public SharedButtons()
|
||||
{
|
||||
InitializeComponent();
|
||||
originalUser = GlobalData.CurrentUser;
|
||||
lockState = LockState.Locked;
|
||||
MoreActive = false;
|
||||
RequiredGroupMembership = null;
|
||||
@ -199,12 +198,6 @@ namespace TBF.UI.Shared
|
||||
EnableOrDisableButtons(selectedButtons, false);
|
||||
}
|
||||
|
||||
void RestoreUser()
|
||||
{
|
||||
GlobalData.CurrentUser = originalUser;
|
||||
Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Events invoked when buttons are clicked (and in case of Unlock kbutton also accepted)
|
||||
/// </summary>
|
||||
@ -237,14 +230,14 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
if (lockState == LockState.Locked)
|
||||
{
|
||||
if (!GlobalData.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
if (!CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new SharedDatabase.Forms.LoginDlg(RequiredGroupMembership, ParentForm)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
else if (Program.LocalSettings.AlwaysAskPasswdWhenUnlocking)
|
||||
{
|
||||
if ((new SharedDatabase.Forms.LoginDlg(GlobalData.CurrentUser.UserName, RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new SharedDatabase.Forms.LoginDlg(CurrentUser.UserName(), RequiredGroupMembership, ParentForm)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ namespace WorkflowConfigurator
|
||||
|
||||
if (!string.IsNullOrEmpty(Program.LocalSettings.UsersDBConnString))
|
||||
{
|
||||
GlobalData.LocalUsersDB = new DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
CurrentUser.LocalUsersDB = new DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ namespace WorkflowConfigurator
|
||||
|
||||
public static void PrintTitle(bool busy)
|
||||
{
|
||||
string user = GlobalData.GetCurrentUserName();
|
||||
string user = CurrentUser.UserName();
|
||||
if (!string.IsNullOrEmpty(user)) user = string.Format(" ({0})", user);
|
||||
|
||||
Program.MainWnd.Text = string.Format(busy ? "{0} v.{1}{2} ... reading database" : "{0} v.{1}{2}",
|
||||
|
||||
@ -555,8 +555,8 @@ namespace WorkflowConfigurator.UserControls
|
||||
/// Unlock button pressed
|
||||
if (unlocked) return; /// Already unlocked
|
||||
|
||||
if ((GlobalData.CurrentUser!= null && GlobalData.CurrentUser.IsMemberOf(UnlockAccessLevel)) ||
|
||||
new SharedDatabase.Forms.LoginDlg(UnlockAccessLevel).ShowDialog() == DialogResult.OK)
|
||||
if (CurrentUser.IsMemberOf(UnlockAccessLevel) ||
|
||||
new SharedDatabase.Forms.LoginDlg(UnlockAccessLevel, null).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MainWnd.PrintTitle(false);
|
||||
UpdateLockState(true, (Process.ReleaseStatus == ReleaseStatus.In_preparation));
|
||||
@ -594,7 +594,7 @@ namespace WorkflowConfigurator.UserControls
|
||||
if (!GetAccessToStateChange(true)) return; /// Obligatory login when releasing a process to production
|
||||
UpdateLockState(false, false);
|
||||
Process.ReleaseStatus = ReleaseStatus.Released;
|
||||
Process.ApprovedBy = GlobalData.GetCurrentUserName();
|
||||
Process.ApprovedBy = CurrentUser.UserName();
|
||||
Process.TimeStamp2 = DateTime.Now;
|
||||
break;
|
||||
|
||||
@ -716,12 +716,12 @@ namespace WorkflowConfigurator.UserControls
|
||||
GID[] rqrdMmbrshp = ChangeReleaseState;
|
||||
if (forceLogin)
|
||||
{
|
||||
return new LoginDlg(rqrdMmbrshp).ShowDialog() == DialogResult.OK;
|
||||
return new LoginDlg(rqrdMmbrshp, null).ShowDialog() == DialogResult.OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (GlobalData.CurrentUser != null && GlobalData.CurrentUser.IsMemberOf(rqrdMmbrshp)) ||
|
||||
new LoginDlg(rqrdMmbrshp).ShowDialog() == DialogResult.OK;
|
||||
return CurrentUser.IsMemberOf(rqrdMmbrshp) ||
|
||||
new LoginDlg(rqrdMmbrshp, null).ShowDialog() == DialogResult.OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ namespace WorkflowConfigurator.UserControls
|
||||
{
|
||||
GID[] rqrdMmbrshp = Program.SettingsAccessLevel;
|
||||
///
|
||||
if ((GlobalData.CurrentUser != null && GlobalData.CurrentUser.IsMemberOf(rqrdMmbrshp)) ||
|
||||
new LoginDlg(rqrdMmbrshp).ShowDialog() == DialogResult.OK)
|
||||
if (CurrentUser.IsMemberOf(rqrdMmbrshp) ||
|
||||
new LoginDlg(rqrdMmbrshp, null).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MainWnd.PrintTitle(false);
|
||||
new Forms.SettingsDlg().ShowDialog(); /// Logged in => Show settings dialog
|
||||
@ -279,15 +279,15 @@ namespace WorkflowConfigurator.UserControls
|
||||
{
|
||||
GID[] rqrdMmbrshp = EditProcessCtrl.UnlockAccessLevel;
|
||||
///
|
||||
if ((GlobalData.CurrentUser != null && GlobalData.CurrentUser.IsMemberOf(rqrdMmbrshp)) ||
|
||||
new LoginDlg(rqrdMmbrshp).ShowDialog() == DialogResult.OK)
|
||||
if (CurrentUser.IsMemberOf(rqrdMmbrshp) ||
|
||||
new LoginDlg(rqrdMmbrshp, null).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MainWnd.PrintTitle(false);
|
||||
|
||||
if (editProcessCtrl.FinishEditing() == EditFinishedInfo.Cancel) return;
|
||||
|
||||
Process newProcess = new Process(NewProcessName(Strings.Workflow));
|
||||
newProcess.CreatedBy = GlobalData.GetCurrentUserName();
|
||||
newProcess.CreatedBy = CurrentUser.UserName();
|
||||
allProcesses.Add(newProcess);
|
||||
editProcessCtrl.UpdateProcess(newProcess, Reason.NewProcess, allProcesses);
|
||||
RedrawLeftPane(RedrawType.FromScratch, newProcess); /// By this the new process will be selected
|
||||
@ -300,7 +300,7 @@ namespace WorkflowConfigurator.UserControls
|
||||
|
||||
if ((editProcessCtrl.Process == null) || (editProcessCtrl.FinishEditing() == EditFinishedInfo.Cancel)) return;
|
||||
|
||||
Process processCopy = editProcessCtrl.Process.Clone(NewProcessName(string.Format("{0} - {1}", editProcessCtrl.Process.Name, Strings.copy)), GlobalData.GetCurrentUserName());
|
||||
Process processCopy = editProcessCtrl.Process.Clone(NewProcessName(string.Format("{0} - {1}", editProcessCtrl.Process.Name, Strings.copy)), CurrentUser.UserName());
|
||||
allProcesses.Add(processCopy);
|
||||
editProcessCtrl.UpdateProcess(processCopy, Reason.CopyProcess, allProcesses);
|
||||
RedrawLeftPane(RedrawType.FromScratch, processCopy); /// By this the copied process will be selected
|
||||
@ -312,7 +312,7 @@ namespace WorkflowConfigurator.UserControls
|
||||
|
||||
if ((editProcessCtrl.Process == null) || (editProcessCtrl.FinishEditing() == EditFinishedInfo.Cancel)) return;
|
||||
|
||||
Process processFromTemplate = editProcessCtrl.Process.Clone(NewProcessName(string.Format(Strings.Workflow_from_template_0, editProcessCtrl.Process.Name)), GlobalData.GetCurrentUserName());
|
||||
Process processFromTemplate = editProcessCtrl.Process.Clone(NewProcessName(string.Format(Strings.Workflow_from_template_0, editProcessCtrl.Process.Name)), CurrentUser.UserName());
|
||||
allProcesses.Add(processFromTemplate);
|
||||
editProcessCtrl.UpdateProcess(processFromTemplate, Reason.CopyProcess, allProcesses);
|
||||
RedrawLeftPane(RedrawType.FromScratch, processFromTemplate); /// By this the process created from a template will be selected
|
||||
|
||||
@ -148,7 +148,7 @@ namespace Workplace
|
||||
///
|
||||
/// User login
|
||||
///
|
||||
Common.GlobalData.LocalUsersDB = new DBSettings(DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
Common.CurrentUser.LocalUsersDB = new DBSettings(DBType.MySql, LocalSettings.UsersDBConnString);
|
||||
|
||||
DialogResult dr;
|
||||
switch (LocalSettings.LocalWorkplacesCount)
|
||||
@ -159,11 +159,14 @@ namespace Workplace
|
||||
break;
|
||||
|
||||
case 2:
|
||||
dr = new DoubleLoginDlg(Program.LocalSettings.LocalWorkplace1, Program.LocalSettings.LocalWorkplace2).ShowDialog();
|
||||
dr = new DoubleLoginDlg(Program.LocalSettings.LocalWorkplace1,
|
||||
Program.LocalSettings.LocalWorkplace2, null).ShowDialog();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
dr = new TripleLoginDlg(Program.LocalSettings.LocalWorkplace1, Program.LocalSettings.LocalWorkplace2, Program.LocalSettings.LocalWorkplace3).ShowDialog();
|
||||
dr = new TripleLoginDlg(Program.LocalSettings.LocalWorkplace1,
|
||||
Program.LocalSettings.LocalWorkplace2,
|
||||
Program.LocalSettings.LocalWorkplace3, null).ShowDialog();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -181,7 +181,7 @@ namespace Workplace
|
||||
|
||||
workplaceTextBox.Text = Program.LocalSettings.WorkplaceId;
|
||||
|
||||
workerTextBox.Text = Common.GlobalData.GetCurrentUserName();
|
||||
workerTextBox.Text = Common.CurrentUser.UserName();
|
||||
lastLoginTime = DateTime.Now;
|
||||
isLoggedOut = false;
|
||||
|
||||
@ -622,7 +622,7 @@ namespace Workplace
|
||||
UpdateTitle(); /// Show acrive verification
|
||||
wplaceRegistration.UpdateRegistration(dbSession,
|
||||
Program.LocalSettings.WorkplaceId,
|
||||
Common.GlobalData.CurrentUser.UserName,
|
||||
Common.CurrentUser.UserName(),
|
||||
"1.2.3.4",
|
||||
(CurrentWorkflow != null) ? CurrentWorkflow.Name : string.Empty,
|
||||
(CurrentWorkstep != null) ? CurrentWorkstep.Name : string.Empty,
|
||||
@ -1693,7 +1693,7 @@ namespace Workplace
|
||||
{
|
||||
ResetIdleTime();
|
||||
|
||||
if (new LoginDlg(Program.SettingsAccessLevel).ShowDialog() == DialogResult.OK)
|
||||
if (new LoginDlg(Program.SettingsAccessLevel, null).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string oriWorkplace = Program.LocalSettings.WorkplaceId;
|
||||
if (Configure() == DialogResult.OK)
|
||||
@ -1706,7 +1706,7 @@ namespace Workplace
|
||||
|
||||
wplaceRegistration.UpdateRegistration(dbSession,
|
||||
Program.LocalSettings.WorkplaceId,
|
||||
Common.GlobalData.CurrentUser.UserName,
|
||||
Common.CurrentUser.UserName(),
|
||||
"1.2.3.4",
|
||||
(CurrentWorkflow != null) ? CurrentWorkflow.Name : string.Empty,
|
||||
(CurrentWorkstep != null) ? CurrentWorkstep.Name : string.Empty,
|
||||
@ -1813,23 +1813,26 @@ namespace Workplace
|
||||
dr = new LoginDlg().ShowDialog();
|
||||
break;
|
||||
case 2:
|
||||
dr = new DoubleLoginDlg(Program.LocalSettings.LocalWorkplace1, Program.LocalSettings.LocalWorkplace2).ShowDialog();
|
||||
dr = new DoubleLoginDlg(Program.LocalSettings.LocalWorkplace1,
|
||||
Program.LocalSettings.LocalWorkplace2, this).ShowDialog();
|
||||
break;
|
||||
case 3:
|
||||
dr = new TripleLoginDlg(Program.LocalSettings.LocalWorkplace1, Program.LocalSettings.LocalWorkplace2, Program.LocalSettings.LocalWorkplace3).ShowDialog();
|
||||
dr = new TripleLoginDlg(Program.LocalSettings.LocalWorkplace1,
|
||||
Program.LocalSettings.LocalWorkplace2,
|
||||
Program.LocalSettings.LocalWorkplace3, this).ShowDialog();
|
||||
break;
|
||||
}
|
||||
|
||||
if (dr == DialogResult.OK) break;
|
||||
}
|
||||
|
||||
workerTextBox.Text = Common.GlobalData.GetCurrentUserName();
|
||||
workerTextBox.Text = Common.CurrentUser.UserName();
|
||||
lastLoginTime = DateTime.Now;
|
||||
isLoggedOut = false;
|
||||
ClearBatchNumbers();
|
||||
wplaceRegistration.UpdateRegistration(dbSession,
|
||||
Program.LocalSettings.WorkplaceId,
|
||||
Common.GlobalData.CurrentUser.UserName,
|
||||
Common.CurrentUser.UserName(),
|
||||
"1.2.3.4",
|
||||
(CurrentWorkflow != null) ? CurrentWorkflow.Name : string.Empty,
|
||||
(CurrentWorkstep != null) ? CurrentWorkstep.Name : string.Empty,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user