Users.CurrentUser static class with Stack<UserAndForm> userStack, Change() and Restore().
This commit is contained in:
parent
4197328be9
commit
d8a6404e83
@ -60,7 +60,6 @@
|
||||
<Compile Include="Forms\ModelessForm.designer.cs">
|
||||
<DependentUpon>ModelessForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalData.cs" />
|
||||
<Compile Include="IMeasurementCorrection.cs" />
|
||||
<Compile Include="IOrderInfo.cs" />
|
||||
<Compile Include="IParamsProvider.cs" />
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Config
|
||||
{
|
||||
public class Data : Users.GlobalData
|
||||
public class Data : Users.CurrentUser
|
||||
{
|
||||
public const string AdminUsername = "admin";
|
||||
public const string AdminPassword = "staratura";
|
||||
|
||||
@ -75,7 +75,7 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
|
||||
CreationUser = Users.CurrentUser.UserName();
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Config.Entities
|
||||
///
|
||||
/// Default values
|
||||
///
|
||||
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
|
||||
CreationUser = Users.CurrentUser.UserName();
|
||||
CreationTime = DateTime.Now;
|
||||
LastChgUser = CreationUser;
|
||||
LastChgTime = CreationTime;
|
||||
|
||||
@ -422,7 +422,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);
|
||||
@ -451,7 +451,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());
|
||||
@ -485,7 +485,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());
|
||||
@ -520,7 +520,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());
|
||||
|
||||
@ -291,7 +291,7 @@ namespace EventViewer
|
||||
{
|
||||
try
|
||||
{
|
||||
Users.GlobalData.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
Users.CurrentUser.RemoteUsersDB = new Common.DBSettings(Common.DBType.MySql, Program.LocalSettings.UsersDBConnString);
|
||||
Users.Forms.LoginDlg dlg = new Users.Forms.LoginDlg();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
Users.CurrentUser.Restore(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,8 +256,8 @@ namespace TBF
|
||||
{
|
||||
log.FatalFormat("Test bench name: {0}", loginDlgBench.BenchName);
|
||||
|
||||
Users.GlobalData.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
|
||||
Users.GlobalData.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
|
||||
Users.CurrentUser.RemoteUsersDB = LocalSettings.TestBenches[i].UsersDBSettings;
|
||||
Users.CurrentUser.LocalUsersDB = LocalSettings.TestBenches[i].ProceduresDBSettings;
|
||||
|
||||
Users.Entities.User loadedUser = null;
|
||||
try
|
||||
@ -273,10 +273,10 @@ namespace TBF
|
||||
if (Users.Entities.User.IsPowerUser(loginDlgBench.Alias, loginDlgBench.Password))
|
||||
{
|
||||
loadedUser = new Users.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)
|
||||
{
|
||||
Users.GlobalData.AuthorizedAs = Common.AuthorizedAs.PowerUser;
|
||||
Users.CurrentUser.AuthorizedAs = Common.AuthorizedAs.PowerUser;
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ namespace TBF
|
||||
///
|
||||
if (!authorized)
|
||||
{
|
||||
DBSettings[] dbs = new DBSettings[] { Users.GlobalData.RemoteUsersDB, Users.GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { Users.CurrentUser.RemoteUsersDB, Users.CurrentUser.LocalUsersDB };
|
||||
|
||||
authorizedAs = Common.AuthorizedAs.RemoteUser; /// Try remote DB first
|
||||
|
||||
@ -297,7 +297,7 @@ namespace TBF
|
||||
if (loginDlgBench.Password == LoginDlgWithBenchSelection.UseTheTagPassword)
|
||||
{
|
||||
loadedUser = Users.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
|
||||
{
|
||||
@ -306,17 +306,17 @@ namespace TBF
|
||||
default:
|
||||
case Common.LoginMethod.UserName:
|
||||
loadedUser = Users.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 Common.LoginMethod.FullName:
|
||||
loadedUser = Users.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 Common.LoginMethod.Number:
|
||||
int number;
|
||||
if (!int.TryParse(loginDlgBench.Alias, out number)) break;
|
||||
loadedUser = Users.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;
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,7 @@ namespace TBF
|
||||
if (authorized)
|
||||
{
|
||||
loadedUser.SetLegalizator(loginDlgBench.Legalizator);
|
||||
Users.GlobalData.AuthorizedAs = authorizedAs;
|
||||
Users.CurrentUser.AuthorizedAs = authorizedAs;
|
||||
|
||||
LocalSettings.LoginMethod = loginDlgBench.Method; /// Save the login method actually used
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ namespace TBF.Rig.DataContainers.BackupAndSecurityOptions
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
Users.GlobalData.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
Users.GlobalData.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
Users.CurrentUser.MinPasswdLength = myCfg.MinPasswdLength;
|
||||
Users.CurrentUser.PasswdExpirationPeriodDays = myCfg.PasswdExpirationPeriodDays;
|
||||
log.FatalFormat("{0} initialized: {1}", Name, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -734,7 +734,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
ReferenceRecord refRecord = new ReferenceRecord(currentWorkflow,
|
||||
currentWStep,
|
||||
bodyNrBoxes[wmNr0].Text,
|
||||
Users.GlobalData.GetCurrentUserName(),
|
||||
Users.CurrentUser.UserName(),
|
||||
workplace,
|
||||
passed ? 1 : 0);
|
||||
if (uniqueCodeParts.Count >= 2)
|
||||
|
||||
@ -54,19 +54,17 @@ namespace TBF.Rig.Elde.CoverTest
|
||||
|
||||
private void bypassButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!Users.GlobalData.CurrentUser.IsMemberOf(bypassLevel))
|
||||
if (!Users.CurrentUser.IsMemberOf(bypassLevel))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(bypassLevel)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.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, Users.GlobalData.CurrentUser.UserName);
|
||||
bypassLog.InfoFormat("{0} bypassed by {1}", message, Users.CurrentUser.UserName());
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
@ -109,5 +107,10 @@ namespace TBF.Rig.Elde.CoverTest
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void CoverTestForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
TBF/Rig/Elde/CoverTest/CoverTestForm.designer.cs
generated
1
TBF/Rig/Elde/CoverTest/CoverTestForm.designer.cs
generated
@ -68,6 +68,7 @@ namespace TBF.Rig.Elde.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();
|
||||
|
||||
|
||||
@ -601,7 +601,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
else if ((currentProcess != null) && (wm.ProcessId == currentProcess.Id))
|
||||
{
|
||||
/// Process is already loaded => save a reference record for this WM
|
||||
session.SaveOrUpdate(new ReferenceRecord(currentProcess, currentWorkstep, wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
|
||||
session.SaveOrUpdate(new ReferenceRecord(currentProcess, currentWorkstep, wm.SerialNr, Users.CurrentUser.UserName(), workplace, wm.Passed ? 0 : 1));
|
||||
return 1;
|
||||
}
|
||||
else if (wm.ProcessId != 0)
|
||||
@ -616,7 +616,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
{
|
||||
if (ws.Name == WorkstepName)
|
||||
{
|
||||
session.SaveOrUpdate(new ReferenceRecord(processes[0], ws, wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
|
||||
session.SaveOrUpdate(new ReferenceRecord(processes[0], ws, wm.SerialNr, Users.CurrentUser.UserName(), workplace, wm.Passed ? 0 : 1));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -648,7 +648,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
IList<Workstep> worksteps;
|
||||
if ((refRecords.Count > 0) && workstepsDictionary.TryGetValue(refRecords[0].Process.Id, out worksteps) && (worksteps.Count == 1))
|
||||
{
|
||||
session.SaveOrUpdate(new ReferenceRecord(refRecords[0].Process, worksteps[0], wm.SerialNr, Users.GlobalData.CurrentUser.UserName, workplace, wm.Passed ? 0 : 1));
|
||||
session.SaveOrUpdate(new ReferenceRecord(refRecords[0].Process, worksteps[0], wm.SerialNr, Users.CurrentUser.UserName(), workplace, wm.Passed ? 0 : 1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ namespace TBF.Rig.Output.FlexFlow
|
||||
}
|
||||
}
|
||||
|
||||
public string UserId { get { return Users.GlobalData.GetCurrentUserName(); } }
|
||||
public string UserId { get { return Users.CurrentUser.UserName(); } }
|
||||
|
||||
|
||||
enum Retv
|
||||
|
||||
@ -467,10 +467,10 @@ namespace TBF.Rig.Sequences
|
||||
/// Water meter failed but the failure is not an assembly error
|
||||
wm.Disabled = true;
|
||||
}
|
||||
else if (!wm.Disabled && (Users.GlobalData.GetCurrentUserName() == "milan" ||
|
||||
Users.GlobalData.GetCurrentUserName() == "augustin" ||
|
||||
Users.GlobalData.GetCurrentUserName() == "michal" ||
|
||||
Users.GlobalData.GetCurrentUserName() == "michal2"))
|
||||
else if (!wm.Disabled && (Users.CurrentUser.UserName() == "milan" ||
|
||||
Users.CurrentUser.UserName() == "augustin" ||
|
||||
Users.CurrentUser.UserName() == "michal" ||
|
||||
Users.CurrentUser.UserName() == "michal2"))
|
||||
{
|
||||
/// Water meter failed, is not disabled, there is an assembly error and user is one of above
|
||||
/// ... => reset flag E28
|
||||
@ -673,7 +673,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) && (Users.GlobalData.GetCurrentUserName() != "milan"))
|
||||
else if ((selection == Selection.RestoreAndFixBatch) && (Users.CurrentUser.UserName() != "milan"))
|
||||
{
|
||||
/// Restore and fix a batch - part 2
|
||||
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
|
||||
|
||||
@ -629,8 +629,8 @@ namespace TBF.Rig.Sequences
|
||||
(BenchInfo != null) ? BenchInfo.Address3 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address4 : string.Empty,
|
||||
(BenchInfo != null) ? BenchInfo.Address5 : string.Empty,
|
||||
(Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.ToEncodedStr() : "none",
|
||||
(Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.Number : 0,
|
||||
(Users.CurrentUser.User() != null) ? Users.CurrentUser.User().ToEncodedStr() : "none",
|
||||
Users.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 |
|
||||
@ -260,5 +261,10 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
UpdateButtonStates(SharedButtons.SelectedItemPos.Middle);
|
||||
}
|
||||
}
|
||||
|
||||
private void CycleDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +73,7 @@ namespace TBF.Rig.TestMethods.Endurance
|
||||
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);
|
||||
|
||||
@ -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=2.27.1917.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
|
||||
@ -38,18 +38,22 @@ 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.ParentForm = parentForm;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
sharedButtons.MoreButtonTop = ComponentCfgCtrlHeight - 45;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
|
||||
@ -57,6 +61,8 @@ namespace TBF.UI.Bench.Components
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.MoreClicked += moreButton_Click;
|
||||
|
||||
Flags = CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
private void ComponentCfgForm_Load(object sender, EventArgs e)
|
||||
|
||||
@ -8,8 +8,8 @@ using System.Windows.Forms;
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
@ -69,7 +69,8 @@ namespace TBF.UI.Bench.Components
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// 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 |
|
||||
@ -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 (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
|
||||
|
||||
1
TBF/UI/Bench/Metrology/MetrologyDlg.Designer.cs
generated
1
TBF/UI/Bench/Metrology/MetrologyDlg.Designer.cs
generated
@ -85,6 +85,7 @@ namespace TBF.UI.Bench.Metrology
|
||||
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);
|
||||
|
||||
@ -26,6 +26,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 (Users.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);
|
||||
|
||||
@ -53,6 +53,7 @@ namespace TBF.UI.Bench.Paths
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down;
|
||||
@ -367,5 +368,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 (Users.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=2.27.1917.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=2.27.1917.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=2.27.1917.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=2.27.1917.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=2.27.1917.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>splitContainer.Panel2</value>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -42,19 +42,31 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
bool unlocked;
|
||||
|
||||
public TestProfileDlg()
|
||||
TestProfileDlg()
|
||||
{
|
||||
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 Common.GID[] { Common.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;
|
||||
@ -79,18 +91,6 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
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 Common.GID[] { Common.GID.MetrologicalAuthority };
|
||||
}
|
||||
|
||||
private void TestProfileDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
@ -745,7 +745,7 @@
|
||||
<value>metrologyListViewEx</value>
|
||||
</data>
|
||||
<data name=">>metrologyListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.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>Results.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>Results.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=2.27.1917.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2019-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -214,10 +214,10 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
}
|
||||
|
||||
Profile newProfile = new Profile(newName, MyItems.Count);
|
||||
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.CreationUser = Users.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();
|
||||
@ -226,7 +226,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
try
|
||||
{
|
||||
newProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.LastChgUser = Users.CurrentUser.UserName();
|
||||
newProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProfile);
|
||||
@ -297,7 +297,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();
|
||||
|
||||
@ -305,7 +305,7 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
{
|
||||
try
|
||||
{
|
||||
editedProfile.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
editedProfile.LastChgUser = Users.CurrentUser.UserName();
|
||||
editedProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
session.SaveOrUpdate(editedProfile);
|
||||
@ -339,17 +339,17 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
newProfile.Name = selectedProfile.Name + Strings.New_name_copy;
|
||||
newProfile.ItemNr = MyItems.Count;
|
||||
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.CreationUser = Users.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 = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.LastChgUser = Users.CurrentUser.UserName();
|
||||
newProfile.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProfile);
|
||||
@ -388,17 +388,17 @@ namespace TBF.UI.Bench.TestProfiles
|
||||
|
||||
newProfile.Name = newProfile.Name + " imported";
|
||||
newProfile.ItemNr = MyItems.Count;
|
||||
newProfile.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.CreationUser = Users.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 = Users.GlobalData.CurrentUser.UserName;
|
||||
newProfile.LastChgUser = Users.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 Common.Forms;
|
||||
using TBF.Resources;
|
||||
using TBF.UI.Shared;
|
||||
@ -26,7 +27,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 |
|
||||
@ -218,5 +220,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 (Users.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);
|
||||
|
||||
@ -73,6 +73,7 @@ namespace TBF.UI.Bench.Transitions
|
||||
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);
|
||||
|
||||
@ -67,6 +67,7 @@ namespace TBF.UI.Bench.Transitions
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
|
||||
@ -701,5 +702,10 @@ namespace TBF.UI.Bench.Transitions
|
||||
{
|
||||
MessageBox.Show("Comparing sequences in not implemented yet");
|
||||
}
|
||||
|
||||
private void TransitionsDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.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=2.27.1917.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>
|
||||
|
||||
@ -26,6 +26,7 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
#if KEMPNO_50
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.MetrologicalAuthority };
|
||||
#else
|
||||
@ -305,5 +306,10 @@ namespace TBF.UI.Bench.Uncertainties
|
||||
{
|
||||
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove);
|
||||
}
|
||||
|
||||
private void UncertaintiesDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.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);
|
||||
|
||||
@ -457,23 +457,23 @@ namespace TBF.UI
|
||||
|
||||
public void UpdateUser()
|
||||
{
|
||||
userInfoStatusLabel.Text = string.Format("{0}: {1}{2}, ", Strings.User, Users.GlobalData.CurrentUser.UserName,
|
||||
(Users.GlobalData.AuthorizedAs == Common.AuthorizedAs.PowerUser) ? "(S)" :
|
||||
((Users.GlobalData.AuthorizedAs == Common.AuthorizedAs.LocalUser) ? "(L)" : "(R)"));
|
||||
userInfoStatusLabel.Text = string.Format("{0}: {1}{2}, ", Strings.User, Users.CurrentUser.UserName(),
|
||||
(Users.CurrentUser.AuthorizedAs == Common.AuthorizedAs.PowerUser) ? "(S)" :
|
||||
((Users.CurrentUser.AuthorizedAs == Common.AuthorizedAs.LocalUser) ? "(L)" : "(R)"));
|
||||
|
||||
UpdateMenuItemsVisibility();
|
||||
}
|
||||
|
||||
void UpdateMenuItemsVisibility()
|
||||
{
|
||||
usersTSMenuItem.Visible = Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.Administrators) ||
|
||||
Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.HeadOfLab);
|
||||
databaseSettingsTSMenuItem.Visible = Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.Administrators) && Users.GlobalData.CurrentUser.IsPowerUser(); ;
|
||||
upgradeTSMenuItem.Visible = Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.Administrators) && Users.GlobalData.CurrentUser.IsPowerUser();
|
||||
clearCountersToolStripMenuItem.Visible = Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.Administrators) ||
|
||||
Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.HeadOfLab) ||
|
||||
Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.TestingSpecialists) ||
|
||||
Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.Metrologists);
|
||||
usersTSMenuItem.Visible = Users.CurrentUser.IsMemberOf(Common.GID.Administrators) ||
|
||||
Users.CurrentUser.IsMemberOf(Common.GID.HeadOfLab);
|
||||
databaseSettingsTSMenuItem.Visible = Users.CurrentUser.IsMemberOf(Common.GID.Administrators) && Users.CurrentUser.IsPowerUser();
|
||||
upgradeTSMenuItem.Visible = Users.CurrentUser.IsMemberOf(Common.GID.Administrators) && Users.CurrentUser.IsPowerUser();
|
||||
clearCountersToolStripMenuItem.Visible = Users.CurrentUser.IsMemberOf(Common.GID.Administrators) ||
|
||||
Users.CurrentUser.IsMemberOf(Common.GID.HeadOfLab) ||
|
||||
Users.CurrentUser.IsMemberOf(Common.GID.TestingSpecialists) ||
|
||||
Users.CurrentUser.IsMemberOf(Common.GID.Metrologists);
|
||||
}
|
||||
|
||||
public void UpdateStatusP(string statusPStr)
|
||||
@ -541,7 +541,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 Users.Forms.PasswordChangeDlg(Users.GlobalData.GetCurrentUserName()).ShowDialog(); }
|
||||
private void passwdTSMItem_Click(object s, EventArgs e) { new Users.Forms.PasswordChangeDlg(Users.CurrentUser.UserName()).ShowDialog(); }
|
||||
private void aboutTSMItem_Click(object s, EventArgs e) { new TBF.UI.Help.AboutDlg().ShowDialog(); }
|
||||
|
||||
|
||||
@ -838,7 +838,7 @@ namespace TBF.UI
|
||||
Common.GID[] reqGrpMembership = null;
|
||||
#endif
|
||||
|
||||
if (new Users.Forms.LoginDlg(reqGrpMembership).ShowDialog() == DialogResult.OK)
|
||||
if (new Users.Forms.LoginDlg(reqGrpMembership, this).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
UpdateUser();
|
||||
}
|
||||
|
||||
64
TBF/UI/Procedures/ProcedureDlg.Designer.cs
generated
64
TBF/UI/Procedures/ProcedureDlg.Designer.cs
generated
@ -97,14 +97,14 @@ namespace TBF.UI.Procedures
|
||||
this.procNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.historyTabPage = new System.Windows.Forms.TabPage();
|
||||
this.metrology1TabPage = new System.Windows.Forms.TabPage();
|
||||
this.metrology2TabPage = new System.Windows.Forms.TabPage();
|
||||
this.processTabPage = new System.Windows.Forms.TabPage();
|
||||
this.parametersTabPage = new System.Windows.Forms.TabPage();
|
||||
this.historyListViewEx = new Common.Forms.ListViewEx();
|
||||
this.metrology1TabPage = new System.Windows.Forms.TabPage();
|
||||
this.metrology1ListViewEx = new Common.Forms.ListViewEx();
|
||||
this.metrology2TabPage = new System.Windows.Forms.TabPage();
|
||||
this.metrology2ListViewEx = new Common.Forms.ListViewEx();
|
||||
this.processTabPage = new System.Windows.Forms.TabPage();
|
||||
this.processListViewEx = new Common.Forms.ListViewEx();
|
||||
this.parametersTabPage = new System.Windows.Forms.TabPage();
|
||||
this.parametersListViewEx = new Common.Forms.ListViewEx();
|
||||
this.sharedButtons = new TBF.UI.Shared.SharedButtons();
|
||||
((System.ComponentModel.ISupportInitialize)(this.mainSplitContainer)).BeginInit();
|
||||
@ -587,34 +587,6 @@ namespace TBF.UI.Procedures
|
||||
this.historyTabPage.Name = "historyTabPage";
|
||||
this.historyTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// metrology1TabPage
|
||||
//
|
||||
this.metrology1TabPage.Controls.Add(this.metrology1ListViewEx);
|
||||
resources.ApplyResources(this.metrology1TabPage, "metrology1TabPage");
|
||||
this.metrology1TabPage.Name = "metrology1TabPage";
|
||||
this.metrology1TabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// metrology2TabPage
|
||||
//
|
||||
this.metrology2TabPage.Controls.Add(this.metrology2ListViewEx);
|
||||
resources.ApplyResources(this.metrology2TabPage, "metrology2TabPage");
|
||||
this.metrology2TabPage.Name = "metrology2TabPage";
|
||||
this.metrology2TabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// processTabPage
|
||||
//
|
||||
this.processTabPage.Controls.Add(this.processListViewEx);
|
||||
resources.ApplyResources(this.processTabPage, "processTabPage");
|
||||
this.processTabPage.Name = "processTabPage";
|
||||
this.processTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// parametersTabPage
|
||||
//
|
||||
this.parametersTabPage.Controls.Add(this.parametersListViewEx);
|
||||
resources.ApplyResources(this.parametersTabPage, "parametersTabPage");
|
||||
this.parametersTabPage.Name = "parametersTabPage";
|
||||
this.parametersTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// historyListViewEx
|
||||
//
|
||||
this.historyListViewEx.AllowColumnReorder = true;
|
||||
@ -627,6 +599,13 @@ namespace TBF.UI.Procedures
|
||||
this.historyListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.historyListViewEx.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.historyListViewEx_MouseDoubleClick);
|
||||
//
|
||||
// metrology1TabPage
|
||||
//
|
||||
this.metrology1TabPage.Controls.Add(this.metrology1ListViewEx);
|
||||
resources.ApplyResources(this.metrology1TabPage, "metrology1TabPage");
|
||||
this.metrology1TabPage.Name = "metrology1TabPage";
|
||||
this.metrology1TabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// metrology1ListViewEx
|
||||
//
|
||||
this.metrology1ListViewEx.AllowColumnReorder = true;
|
||||
@ -639,6 +618,13 @@ namespace TBF.UI.Procedures
|
||||
this.metrology1ListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.metrology1ListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrology1ListViewEx_SelectedIndexChanged);
|
||||
//
|
||||
// metrology2TabPage
|
||||
//
|
||||
this.metrology2TabPage.Controls.Add(this.metrology2ListViewEx);
|
||||
resources.ApplyResources(this.metrology2TabPage, "metrology2TabPage");
|
||||
this.metrology2TabPage.Name = "metrology2TabPage";
|
||||
this.metrology2TabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// metrology2ListViewEx
|
||||
//
|
||||
this.metrology2ListViewEx.AllowColumnReorder = true;
|
||||
@ -651,6 +637,13 @@ namespace TBF.UI.Procedures
|
||||
this.metrology2ListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.metrology2ListViewEx.SelectedIndexChanged += new System.EventHandler(this.metrology2ListViewEx_SelectedIndexChanged);
|
||||
//
|
||||
// processTabPage
|
||||
//
|
||||
this.processTabPage.Controls.Add(this.processListViewEx);
|
||||
resources.ApplyResources(this.processTabPage, "processTabPage");
|
||||
this.processTabPage.Name = "processTabPage";
|
||||
this.processTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// processListViewEx
|
||||
//
|
||||
this.processListViewEx.AllowColumnReorder = true;
|
||||
@ -663,6 +656,13 @@ namespace TBF.UI.Procedures
|
||||
this.processListViewEx.View = System.Windows.Forms.View.Details;
|
||||
this.processListViewEx.SelectedIndexChanged += new System.EventHandler(this.processListViewEx_SelectedIndexChanged);
|
||||
//
|
||||
// parametersTabPage
|
||||
//
|
||||
this.parametersTabPage.Controls.Add(this.parametersListViewEx);
|
||||
resources.ApplyResources(this.parametersTabPage, "parametersTabPage");
|
||||
this.parametersTabPage.Name = "parametersTabPage";
|
||||
this.parametersTabPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// parametersListViewEx
|
||||
//
|
||||
this.parametersListViewEx.AllowColumnReorder = true;
|
||||
|
||||
@ -8,8 +8,8 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
@ -65,7 +65,7 @@ namespace TBF.UI.Procedures
|
||||
|
||||
bool unlocked;
|
||||
|
||||
public ProcedureDlg()
|
||||
ProcedureDlg()
|
||||
{
|
||||
/// Detect display setting: 100% = 96dpi, 125% = 120dpi, 150% = 144dpi.
|
||||
Dpi = (int)this.CreateGraphics().DpiX;
|
||||
@ -74,12 +74,6 @@ namespace TBF.UI.Procedures
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
#if KEMPNO_50 || KRAKOW_50
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
|
||||
#else
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
#endif
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up |
|
||||
@ -120,7 +114,7 @@ namespace TBF.UI.Procedures
|
||||
SelectedTestIx = -1;
|
||||
}
|
||||
|
||||
public ProcedureDlg(Config.Entities.Procedure procedure, IList<string> usedNames, Mode initialMode)
|
||||
public ProcedureDlg(Procedure procedure, IList<string> usedNames, Mode initialMode, Form parentForm)
|
||||
: this()
|
||||
{
|
||||
if (procedure == null) throw new ArgumentNullException("procedure");
|
||||
@ -129,6 +123,9 @@ namespace TBF.UI.Procedures
|
||||
this.usedNames = usedNames;
|
||||
this.initialMode = initialMode;
|
||||
|
||||
/// Dynamic SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = parentForm;
|
||||
|
||||
#if KEMPNO_50 || KRAKOW_50
|
||||
sharedButtons.RequiredGroupMembership = procedure.Protected ? new GID[] { GID.WaterMeterAuthority }
|
||||
: new GID[] { GID.TestingSpecialists, GID.WaterMeterAuthority };
|
||||
@ -2125,7 +2122,7 @@ namespace TBF.UI.Procedures
|
||||
procNameTextBox.Enabled = true;
|
||||
descriptionTextBox.Enabled = true;
|
||||
watermetersTextBox.Enabled = true;
|
||||
protectedCheckBox.Enabled = Users.GlobalData.CurrentUser.IsMemberOf(GID.Metrologists);
|
||||
protectedCheckBox.Enabled = Users.CurrentUser.IsMemberOf(GID.Metrologists);
|
||||
mustBeCompleteCheckBox.Enabled = true;
|
||||
manualControlDisabledCheckBox.Enabled = true;
|
||||
dataEntryComboBox.Enabled = true;
|
||||
@ -2848,7 +2845,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>();
|
||||
|
||||
@ -3078,7 +3075,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1882,7 +1882,7 @@
|
||||
<value>historyListViewEx</value>
|
||||
</data>
|
||||
<data name=">>historyListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.26.1622.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>historyListViewEx.Parent" xml:space="preserve">
|
||||
<value>historyTabPage</value>
|
||||
@ -1933,7 +1933,7 @@
|
||||
<value>metrology1ListViewEx</value>
|
||||
</data>
|
||||
<data name=">>metrology1ListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.26.1622.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>metrology1ListViewEx.Parent" xml:space="preserve">
|
||||
<value>metrology1TabPage</value>
|
||||
@ -1984,7 +1984,7 @@
|
||||
<value>metrology2ListViewEx</value>
|
||||
</data>
|
||||
<data name=">>metrology2ListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.26.1622.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>metrology2ListViewEx.Parent" xml:space="preserve">
|
||||
<value>metrology2TabPage</value>
|
||||
@ -2035,7 +2035,7 @@
|
||||
<value>processListViewEx</value>
|
||||
</data>
|
||||
<data name=">>processListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.26.1622.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>processListViewEx.Parent" xml:space="preserve">
|
||||
<value>processTabPage</value>
|
||||
@ -2086,7 +2086,7 @@
|
||||
<value>parametersListViewEx</value>
|
||||
</data>
|
||||
<data name=">>parametersListViewEx.Type" xml:space="preserve">
|
||||
<value>Results.Forms.ListViewEx, Results, Version=2.26.1622.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>Common.Forms.ListViewEx, Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>parametersListViewEx.Parent" xml:space="preserve">
|
||||
<value>parametersTabPage</value>
|
||||
@ -2170,7 +2170,7 @@
|
||||
<value>sharedButtons</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Type" xml:space="preserve">
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.26.1636.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>TBF.UI.Shared.SharedButtons, TBF, Version=2.27.1917.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>sharedButtons.Parent" xml:space="preserve">
|
||||
<value>mainSplitContainer.Panel2</value>
|
||||
@ -2220,9 +2220,6 @@
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1034, 471</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>
|
||||
|
||||
@ -301,10 +301,10 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.CreationUser = Users.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();
|
||||
@ -313,7 +313,7 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
try
|
||||
{
|
||||
newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.LastChgUser = Users.CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -539,7 +539,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();
|
||||
|
||||
@ -548,7 +548,7 @@ namespace TBF.UI.Procedures
|
||||
try
|
||||
{
|
||||
originalProcedure.ProcedureState = ProcedureState.History;
|
||||
modifiedProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
modifiedProcedure.LastChgUser = Users.CurrentUser.UserName();
|
||||
modifiedProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
session.SaveOrUpdate(originalProcedure);
|
||||
@ -588,18 +588,18 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = selectedProcedure.Id;
|
||||
newProcedure.ObtainedByCopy = true;
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.CreationUser = Users.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 = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.LastChgUser = Users.CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -642,17 +642,17 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.CreationUser = Users.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 = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.LastChgUser = Users.CurrentUser.UserName();
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
DoAddOne(newProcedure);
|
||||
@ -860,10 +860,10 @@ namespace TBF.UI.Procedures
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.CreationUser = Users.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 +872,7 @@ namespace TBF.UI.Procedures
|
||||
{
|
||||
try
|
||||
{
|
||||
newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.LastChgUser = Users.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);
|
||||
|
||||
@ -26,6 +26,7 @@ namespace TBF.UI.Procedures
|
||||
InitializeComponent();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.TestingSpecialists, GID.Metrologists };
|
||||
|
||||
#if TEST_PROFILES
|
||||
@ -253,5 +254,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 (Users.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);
|
||||
|
||||
@ -382,5 +382,10 @@ namespace TBF.UI.ResultsMI
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteFromOracleForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.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();
|
||||
|
||||
@ -90,19 +90,17 @@ namespace TBF.UI.ResultsMI
|
||||
{
|
||||
if (!Unlocked)
|
||||
{
|
||||
if (!Users.GlobalData.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
if (!Users.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(RequiredGroupMembership, this)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
else if (Program.LocalSettings.AlwaysAskPasswdWhenUnlocking)
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(Users.CurrentUser.UserName(), RequiredGroupMembership, this)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
|
||||
Unlocked = true;
|
||||
|
||||
///
|
||||
@ -120,6 +118,8 @@ namespace TBF.UI.ResultsMI
|
||||
minWidthTextBox.Enabled = true;
|
||||
minHeightTextBox.Enabled = true;
|
||||
resultsConfigCtrl.Unlocked = true;
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,5 +137,10 @@ namespace TBF.UI.ResultsMI
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ResultsArrangementDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,16 +220,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)
|
||||
@ -643,17 +644,12 @@ namespace TBF.UI.ResultsMI
|
||||
|
||||
private void deleteFromOracleButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
/// Access only to those who manage production tracing
|
||||
Common.GID[] rqrdGroupMembership = new Common.GID[] { Common.GID.TraceabilityManagement };
|
||||
var dlg = new DeleteFromOracleForm();
|
||||
GID[] rqrdGroupMembership = new GID[] { GID.TraceabilityManagement }; /// Restricted access to Delete from Oracle Form
|
||||
|
||||
if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, rqrdGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(Users.CurrentUser.UserName(), rqrdGroupMembership, dlg)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (new DeleteFromOracleForm().ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
MessageBox.Show("Successfully deleted from Oracle");
|
||||
if (dlg.ShowDialog() == DialogResult.OK) MessageBox.Show("Successfully deleted from Oracle");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,9 +72,9 @@ namespace TBF.UI.Shared
|
||||
Middle,
|
||||
}
|
||||
|
||||
public Common.GID[] RequiredGroupMembership;
|
||||
public Form ParentForm; /// Used as a current form reference when changing and restoring a user
|
||||
|
||||
Users.Entities.User originalUser;
|
||||
public Common.GID[] RequiredGroupMembership;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
@ -82,7 +82,6 @@ namespace TBF.UI.Shared
|
||||
public SharedButtons()
|
||||
{
|
||||
InitializeComponent();
|
||||
originalUser = Users.GlobalData.CurrentUser;
|
||||
lockState = LockState.Locked;
|
||||
MoreActive = false;
|
||||
RequiredGroupMembership = null;
|
||||
@ -199,12 +198,6 @@ namespace TBF.UI.Shared
|
||||
EnableOrDisableButtons(selectedButtons, false);
|
||||
}
|
||||
|
||||
void RestoreUser()
|
||||
{
|
||||
Users.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 (!Users.GlobalData.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
if (!Users.CurrentUser.IsMemberOf(RequiredGroupMembership))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(RequiredGroupMembership, ParentForm)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
else if (Program.LocalSettings.AlwaysAskPasswdWhenUnlocking)
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, RequiredGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(Users.CurrentUser.UserName(), RequiredGroupMembership, ParentForm)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
111
Users/CurrentUser.cs
Normal file
111
Users/CurrentUser.cs
Normal file
@ -0,0 +1,111 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using Users.Entities;
|
||||
|
||||
namespace Users
|
||||
{
|
||||
class UserAndForm
|
||||
{
|
||||
public readonly User User;
|
||||
public readonly Form Form;
|
||||
|
||||
public UserAndForm(User user, Form form)
|
||||
{
|
||||
User = user;
|
||||
Form = form;
|
||||
}
|
||||
}
|
||||
|
||||
public class CurrentUser
|
||||
{
|
||||
public static DBSettings RemoteUsersDB = null;
|
||||
public static DBSettings LocalUsersDB = null;
|
||||
|
||||
|
||||
static readonly Stack<UserAndForm> userStack = new Stack<UserAndForm>();
|
||||
|
||||
public static AuthorizedAs AuthorizedAs;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
public static int MinPasswdLength = 0;
|
||||
public static int PasswdExpirationPeriodDays = 0;
|
||||
|
||||
|
||||
/// <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(User 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 User User()
|
||||
{
|
||||
return (userStack.Count > 0) ? userStack.Peek().User : null; /// TODO: Return default user when stack is empty
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the current user name or an empty string
|
||||
/// </summary>
|
||||
public static string UserName()
|
||||
{
|
||||
return (User() != null) ? User().UserName : string.Empty;
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -75,6 +75,11 @@ namespace Users.Entities
|
||||
return newUser;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return (UserName != null) ? UserName : Number.ToString();
|
||||
}
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
/// <summary>
|
||||
@ -138,9 +143,9 @@ namespace Users.Entities
|
||||
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(Strings.Password_must_have_at_least_0_characters, GlobalData.MinPasswdLength);
|
||||
explanation = string.Format(Strings.Password_must_have_at_least_0_characters, CurrentUser.MinPasswdLength);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -165,16 +170,16 @@ namespace Users.Entities
|
||||
/// Checks 'LastPwChange' and returns true when password expired
|
||||
/// </summary>
|
||||
/// <returns></ returns>
|
||||
bool IsPasswordExpired()
|
||||
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>
|
||||
@ -223,13 +228,13 @@ namespace Users.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 (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;
|
||||
}
|
||||
@ -240,7 +245,7 @@ namespace Users.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -254,7 +259,7 @@ namespace Users.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)
|
||||
{
|
||||
@ -262,7 +267,7 @@ namespace Users.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -276,7 +281,7 @@ namespace Users.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())
|
||||
{
|
||||
@ -284,7 +289,7 @@ namespace Users.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
return CompleteAuthorization(password, requiredGroupMembership);
|
||||
return CompleteAuthorization(password, requiredGroupMembership, currentForm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -293,7 +298,7 @@ namespace Users.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))
|
||||
{
|
||||
@ -312,8 +317,8 @@ namespace Users.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;
|
||||
}
|
||||
@ -328,7 +333,7 @@ namespace Users.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)
|
||||
{
|
||||
@ -339,8 +344,8 @@ namespace Users.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;
|
||||
}
|
||||
@ -356,11 +361,12 @@ namespace Users.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;
|
||||
CurrentUser.Change(user, currentForm);
|
||||
CurrentUser.LastAuthorization = DateTime.Now;
|
||||
return user;
|
||||
}
|
||||
|
||||
@ -497,10 +503,10 @@ namespace Users.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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -27,14 +27,15 @@ namespace Users.Forms
|
||||
string user;
|
||||
string password;
|
||||
GID[] requiredGroupMembership;
|
||||
Form parentForm;
|
||||
bool noDatabase;
|
||||
Color oriBackColor;
|
||||
|
||||
/// Smart card support, card S/N is used as user.Tag
|
||||
GemCard.CardNative card;
|
||||
CardNative card;
|
||||
string smartCardReader;
|
||||
|
||||
public Common.LoginMethod Method;
|
||||
public LoginMethod Method;
|
||||
public string VersionString;
|
||||
|
||||
/// <summary>
|
||||
@ -50,11 +51,12 @@ namespace Users.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 Users.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 = "MHA";
|
||||
userNameTextBox.Text = "MHA";
|
||||
@ -83,12 +86,13 @@ namespace Users.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 Users.Forms
|
||||
bool authorized = Entities.User.IsPowerUser(user, password);
|
||||
if (authorized)
|
||||
{
|
||||
Users.GlobalData.CurrentUser = new Users.Entities.User(user, 6, true);
|
||||
CurrentUser.Change(new Users.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 Users.Forms
|
||||
case LoginMethod.UserName:
|
||||
default:
|
||||
var usr1 = Users.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 = Users.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 Users.Forms
|
||||
int number;
|
||||
if (!int.TryParse(user, out number)) break;
|
||||
var usr3 = Users.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 Users.Forms
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
Users.GlobalData.AuthorizedAs = authorizedAs;
|
||||
Users.CurrentUser.AuthorizedAs = authorizedAs;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
@ -254,7 +258,7 @@ namespace Users.Forms
|
||||
{
|
||||
if (requiredGroupMembership == null)
|
||||
{
|
||||
Entities.User.Unauthorize();
|
||||
Entities.User.Unauthorize(parentForm);
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.Cancel;
|
||||
@ -306,7 +310,7 @@ namespace Users.Forms
|
||||
tag = string.Empty;
|
||||
}
|
||||
|
||||
DBSettings[] dbs = new DBSettings[] { GlobalData.RemoteUsersDB, GlobalData.LocalUsersDB };
|
||||
DBSettings[] dbs = new DBSettings[] { CurrentUser.RemoteUsersDB, CurrentUser.LocalUsersDB };
|
||||
bool authorized = false;
|
||||
AuthorizedAs authorizedAs = AuthorizedAs.RemoteUser;
|
||||
///
|
||||
@ -317,7 +321,7 @@ namespace Users.Forms
|
||||
Users.Entities.User loadedUser = Users.Entities.User.LoadUserByTag(tag, db);
|
||||
if (loadedUser != null)
|
||||
{
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership);
|
||||
authorized = loadedUser.AuthorizeTag(tag, requiredGroupMembership, parentForm);
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
@ -333,7 +337,7 @@ namespace Users.Forms
|
||||
|
||||
if (authorized)
|
||||
{
|
||||
Users.GlobalData.AuthorizedAs = authorizedAs;
|
||||
Users.CurrentUser.AuthorizedAs = authorizedAs;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
return;
|
||||
|
||||
@ -97,7 +97,7 @@ namespace Users.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)
|
||||
{
|
||||
|
||||
@ -223,8 +223,8 @@ namespace Users.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 Users.Forms
|
||||
///
|
||||
/// Create remote DB session and read remote users
|
||||
///
|
||||
DB.DbType = GlobalData.RemoteUsersDB.DbType;
|
||||
DB.ConnectionString = GlobalData.RemoteUsersDB.ConnectionString;
|
||||
DB.DbType = CurrentUser.RemoteUsersDB.DbType;
|
||||
DB.ConnectionString = CurrentUser.RemoteUsersDB.ConnectionString;
|
||||
ISession remoteSession = DB.CreateSession();
|
||||
remoteUsers = remoteSession.QueryOver<User>().List();
|
||||
remoteGroups = remoteSession.QueryOver<Group>().List();
|
||||
@ -253,8 +253,8 @@ namespace Users.Forms
|
||||
///
|
||||
/// Prepare local DB session
|
||||
///
|
||||
DB.DbType = GlobalData.LocalUsersDB.DbType;
|
||||
DB.ConnectionString = GlobalData.LocalUsersDB.ConnectionString;
|
||||
DB.DbType = CurrentUser.LocalUsersDB.DbType;
|
||||
DB.ConnectionString = CurrentUser.LocalUsersDB.ConnectionString;
|
||||
ISession localSession = DB.CreateSession();
|
||||
transaction = localSession.BeginTransaction();
|
||||
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using Common;
|
||||
|
||||
namespace Users
|
||||
{
|
||||
public class GlobalData
|
||||
{
|
||||
public static DBSettings RemoteUsersDB = null;
|
||||
public static DBSettings LocalUsersDB = null;
|
||||
|
||||
public static Entities.User CurrentUser;
|
||||
public static AuthorizedAs AuthorizedAs;
|
||||
public static DateTime LastAuthorization = DateTime.Now;
|
||||
|
||||
public static int MinPasswdLength = 0;
|
||||
public static int PasswdExpirationPeriodDays = 0;
|
||||
|
||||
public static string GetCurrentUserName()
|
||||
{
|
||||
return (CurrentUser != null) ? CurrentUser.UserName : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,7 @@
|
||||
<Compile Include="Forms\PasswordChangeDlg.designer.cs">
|
||||
<DependentUpon>PasswordChangeDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalData.cs" />
|
||||
<Compile Include="CurrentUser.cs" />
|
||||
<Compile Include="DB.cs" />
|
||||
<Compile Include="Entities\Group.cs" />
|
||||
<Compile Include="Entities\User.cs" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user