More Users.CurrentUser related changes (IPERL)
This commit is contained in:
parent
d8a6404e83
commit
0983270730
@ -139,7 +139,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
|
||||
/// Only a release version registers a workplace
|
||||
TracingDB.DB.RegisterWorkplace(session,
|
||||
workplace,
|
||||
Users.GlobalData.GetCurrentUserName(),
|
||||
Users.CurrentUser.UserName(),
|
||||
(ipAddress != null) ? ipAddress.ToString() : "1.2.3.4",
|
||||
"<multiple>",
|
||||
WorkstepName,
|
||||
|
||||
@ -2408,6 +2408,12 @@
|
||||
<DependentUpon>PicturesTabPageCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Constants.cs" />
|
||||
<Compile Include="UI\DummyDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\DummyDlg.Designer.cs">
|
||||
<DependentUpon>DummyDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Item\EditDouble.cs" />
|
||||
<Compile Include="UI\Item\EditEnum.cs" />
|
||||
<Compile Include="UI\Item\EditFloat.cs" />
|
||||
|
||||
38
TBF/UI/DummyDlg.Designer.cs
generated
Normal file
38
TBF/UI/DummyDlg.Designer.cs
generated
Normal file
@ -0,0 +1,38 @@
|
||||
namespace TBF.UI
|
||||
{
|
||||
partial class DummyDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Text = "DummyDlg";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
20
TBF/UI/DummyDlg.cs
Normal file
20
TBF/UI/DummyDlg.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TBF.UI
|
||||
{
|
||||
public partial class DummyDlg : Form
|
||||
{
|
||||
public DummyDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2016-2022 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Common;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.UI.ResultsMI
|
||||
@ -22,7 +23,7 @@ namespace TBF.UI.ResultsMI
|
||||
public int FailedCount;
|
||||
public bool Sent;
|
||||
|
||||
protected PreviousResultCtrl()
|
||||
PreviousResultCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@ -106,13 +107,15 @@ namespace TBF.UI.ResultsMI
|
||||
else if (mode == PreviousResultsMode.Fix)
|
||||
{
|
||||
/// Access only to thise who manage production tracing
|
||||
Common.GID[] rqrdGroupMembership = new Common.GID[] { Common.GID.TraceabilityManagement };
|
||||
GID[] rqrdGroupMembership = new GID[] { GID.TraceabilityManagement };
|
||||
|
||||
if ((new Users.Forms.LoginDlg(Users.GlobalData.CurrentUser.UserName, rqrdGroupMembership)).ShowDialog() != DialogResult.OK)
|
||||
if ((new Users.Forms.LoginDlg(Users.CurrentUser.UserName(), rqrdGroupMembership, parent)).ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Program.MainWnd.UpdateUser();
|
||||
|
||||
parent.OnReloadAndFix(this, new PreviousResultIdEventArgs(BatchNr));
|
||||
}
|
||||
#endif
|
||||
|
||||
23
TBF/UI/ResultsMI/PreviousResultsDlg.Designer.cs
generated
23
TBF/UI/ResultsMI/PreviousResultsDlg.Designer.cs
generated
@ -35,13 +35,13 @@
|
||||
this.vertSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.horizSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.filterGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.reloadButton = new System.Windows.Forms.Button();
|
||||
this.procedureTextBox = new System.Windows.Forms.TextBox();
|
||||
this.procedureLabel = new System.Windows.Forms.Label();
|
||||
this.toLabel = new System.Windows.Forms.Label();
|
||||
this.fromLabel = new System.Windows.Forms.Label();
|
||||
this.toDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.fromDateTimePicker = new System.Windows.Forms.DateTimePicker();
|
||||
this.reloadButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.vertSplitContainer)).BeginInit();
|
||||
this.vertSplitContainer.Panel1.SuspendLayout();
|
||||
this.vertSplitContainer.Panel2.SuspendLayout();
|
||||
@ -154,6 +154,16 @@
|
||||
this.filterGroupBox.TabStop = false;
|
||||
this.filterGroupBox.Text = "Filter";
|
||||
//
|
||||
// reloadButton
|
||||
//
|
||||
this.reloadButton.Location = new System.Drawing.Point(1005, 23);
|
||||
this.reloadButton.Name = "reloadButton";
|
||||
this.reloadButton.Size = new System.Drawing.Size(37, 23);
|
||||
this.reloadButton.TabIndex = 0;
|
||||
this.reloadButton.Text = "@";
|
||||
this.reloadButton.UseVisualStyleBackColor = true;
|
||||
this.reloadButton.Click += new System.EventHandler(this.reloadButton_Click);
|
||||
//
|
||||
// procedureTextBox
|
||||
//
|
||||
this.procedureTextBox.Location = new System.Drawing.Point(460, 25);
|
||||
@ -206,16 +216,6 @@
|
||||
this.fromDateTimePicker.Size = new System.Drawing.Size(82, 20);
|
||||
this.fromDateTimePicker.TabIndex = 17;
|
||||
//
|
||||
// reloadButton
|
||||
//
|
||||
this.reloadButton.Location = new System.Drawing.Point(1005, 23);
|
||||
this.reloadButton.Name = "reloadButton";
|
||||
this.reloadButton.Size = new System.Drawing.Size(37, 23);
|
||||
this.reloadButton.TabIndex = 0;
|
||||
this.reloadButton.Text = "@";
|
||||
this.reloadButton.UseVisualStyleBackColor = true;
|
||||
this.reloadButton.Click += new System.EventHandler(this.reloadButton_Click);
|
||||
//
|
||||
// PreviousResultsDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -228,6 +228,7 @@
|
||||
this.Name = "PreviousResultsDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Text = "Previous results";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PreviousResultsDlg_FormClosing);
|
||||
this.Load += new System.EventHandler(this.PreviousResultsDlg_Load);
|
||||
this.vertSplitContainer.Panel1.ResumeLayout(false);
|
||||
this.vertSplitContainer.Panel2.ResumeLayout(false);
|
||||
|
||||
@ -398,5 +398,10 @@ namespace TBF.UI.ResultsMI
|
||||
UpdateButtons();
|
||||
Redraw();
|
||||
}
|
||||
|
||||
private void PreviousResultsDlg_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using TBF.UiBridge;
|
||||
using TBF.Resources;
|
||||
@ -180,12 +181,11 @@ namespace TBF.UI.Shared
|
||||
|
||||
string oriTestName = testComboBox.Text;
|
||||
|
||||
IList<Procedure> procedures = TBF.DB.CreateSession(Program.MainWnd.SelectedProcedure.IsRemote ?
|
||||
Common.DBKind.RemoteConfig : Common.DBKind.Config)
|
||||
.QueryOver<Procedure>()
|
||||
.Where(x => (x.ProcedureState == Common.ProcedureState.Active))
|
||||
.And(x => (x.Name == Program.MainWnd.SelectedProcedure.Name))
|
||||
.List();
|
||||
IList<Procedure> procedures = TBF.DB.CreateSession(Program.MainWnd.SelectedProcedure.IsRemote ? DBKind.RemoteConfig : DBKind.Config)
|
||||
.QueryOver<Procedure>()
|
||||
.Where(x => (x.ProcedureState == ProcedureState.Active))
|
||||
.And(x => (x.Name == Program.MainWnd.SelectedProcedure.Name))
|
||||
.List();
|
||||
if (procedures.Count != 1)
|
||||
{
|
||||
testComboBox.Text = string.Empty;
|
||||
@ -277,13 +277,14 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !Users.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(new Common.GID[] { Common.GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
var dlg = new DummyDlg();
|
||||
if ((new Users.Forms.LoginDlg(new GID[] { GID.TestingSpecialists }, dlg)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
Bridge.Ui2Bench(UI2BenchCmd.StopDrainingTank1);
|
||||
Users.CurrentUser.Restore(dlg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -294,13 +295,14 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !Users.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(new Common.GID[] { Common.GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
var dlg = new DummyDlg();
|
||||
if ((new Users.Forms.LoginDlg(new GID[] { GID.TestingSpecialists }, dlg)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
Bridge.Ui2Bench(UI2BenchCmd.StopDrainingTank2);
|
||||
Users.CurrentUser.Restore(dlg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -311,13 +313,14 @@ namespace TBF.UI.Shared
|
||||
{
|
||||
#if TURA_IPERL || TURA_IPERL_NEW
|
||||
/// Prevent 'Stop draining' by password
|
||||
if (drain1Highlighted && !Users.GlobalData.CurrentUser.IsMemberOf(Common.GID.TestingSpecialists))
|
||||
if (drain1Highlighted && !Users.CurrentUser.IsMemberOf(GID.TestingSpecialists))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(new Common.GID[] { Common.GID.TestingSpecialists })).ShowDialog() != DialogResult.OK)
|
||||
var dlg = new DummyDlg();
|
||||
if ((new Users.Forms.LoginDlg(new GID[] { GID.TestingSpecialists }, dlg)).ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
Bridge.Ui2Bench(UI2BenchCmd.StopDrainingTank3);
|
||||
Users.CurrentUser.Restore(dlg);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user