From dc4a3fa73ad2adf7e1816deae1cb4e9878543eca Mon Sep 17 00:00:00 2001 From: Stoyan Zlatev Date: Tue, 13 Feb 2024 11:45:50 +0100 Subject: [PATCH] Register new AD user control Change password control --- Common/CommonConsole/Program.cs | 193 ++------- .../Ctls/ChangePassword.Designer.cs | 211 ++++++++++ .../Ui/GenesisToolBox/Ctls/ChangePassword.cs | 60 +++ .../GenesisToolBox/Ctls/ChangePassword.resx | 123 ++++++ .../GenesisToolBox/Ctls/LoginForm.Designer.cs | 16 + Common/Ui/GenesisToolBox/Ctls/LoginForm.cs | 7 + .../Ctls/RegisterLDAPUser.Designer.cs | 377 ++++++++++++++++++ .../GenesisToolBox/Ctls/RegisterLDAPUser.cs | 81 ++++ .../GenesisToolBox/Ctls/RegisterLDAPUser.resx | 123 ++++++ .../Ui/GenesisToolBox/GenesisToolBox.csproj | 22 +- .../Infrastructure/LDAPLoginModel.cs | 12 - .../GenesisToolBox/Infrastructure/LDAPUser.cs | 27 +- .../GenesisToolBox/Infrastructure/Software.cs | 121 +++--- .../Infrastructure/UserLoginModel.cs | 2 +- Common/Ui/GenesisToolBox/Program.cs | 1 - .../Ui/GenesisToolBox/frmMainForm.Designer.cs | 28 +- Common/Ui/GenesisToolBox/frmMainForm.cs | 59 ++- Common/Ui/GenesisToolBox/frmMainForm.resx | 2 +- .../LaaProductionWeb/API/APIExtensions.cs | 2 +- .../LaaProductionWeb/API/ControllerBase.cs | 42 ++ .../LaaProductionWeb/API/LoginController.cs | 8 +- .../App_Infrastructure/HttpExtensions.cs | 2 +- .../Controllers/EmployeesController.cs | 2 +- .../Controllers/EmployeesRolesController.cs | 2 +- .../Controllers/SoftwareController.cs | 2 +- .../Controllers/SearchController.cs | 2 +- .../LaaProductionWeb/Global.asax.cs | 3 +- .../Hubs/SIRTBroadcasterHub.cs | 17 - .../LaaProductionWeb/LaaProductionWeb.csproj | 3 +- 29 files changed, 1256 insertions(+), 294 deletions(-) create mode 100644 Common/Ui/GenesisToolBox/Ctls/ChangePassword.Designer.cs create mode 100644 Common/Ui/GenesisToolBox/Ctls/ChangePassword.cs create mode 100644 Common/Ui/GenesisToolBox/Ctls/ChangePassword.resx create mode 100644 Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.Designer.cs create mode 100644 Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.cs create mode 100644 Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.resx create mode 100644 LaaProductionWeb/LaaProductionWeb/API/ControllerBase.cs delete mode 100644 LaaProductionWeb/LaaProductionWeb/Hubs/SIRTBroadcasterHub.cs diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs index 91a86a8a..5d237d55 100644 --- a/Common/CommonConsole/Program.cs +++ b/Common/CommonConsole/Program.cs @@ -1,184 +1,43 @@ namespace CommonConsole { + using Newtonsoft.Json; using System; using System.Collections.Generic; - using System.Globalization; - using System.IO; - using System.IO.Ports; - using System.Linq; - using System.Runtime.InteropServices; - using System.Threading; + using System.Net.Http; + using System.Text; + using System.Threading.Tasks; public class Program { - //[DllImport("GMH3x32E.dll")] - //public static extern Int16 UniversalOpenCom(Int16 ini16COMPortNumber, UInt32 inui32BaudRate, Int16 inui16ConverterType, Int16 ini16Parity, Int16 ini16StoppBits); - //[DllImport("GMH3x32E.dll")] - //public static extern Int16 GMH_CloseCom(); - //[DllImport("GMH3x32E.dll")] - //unsafe public static extern Int16 GMH_Transmit(Int16 ini16DeviceAddress, Int16 ini16TransmitCode, Int16* refi16ptrPriority, double* refdblptrFloatValue, Int32* refi32ptrIntegerValue); + private static readonly HttpClient httpClient = new HttpClient(); public static void Main() { - // UniversalOpenCom(12, 4800, 8, 0, 0); + Task.Factory + .StartNew(async () => + { + using (var httpRequestMessage = new HttpRequestMessage()) + { + httpRequestMessage.Content = new StringContent("{}", Encoding.UTF8, "application/json"); + httpRequestMessage.Method = HttpMethod.Post; + httpRequestMessage.RequestUri = new Uri("http://localhost:52822/LaaProductionWeb/api/Login/AD"); - // Int16 i16Priority; - // Double dblFloatValue; - // Int32 i32IntergerValue; + using (var httpResponseMessage = await httpClient.SendAsync(httpRequestMessage)) + { + Console.WriteLine(httpResponseMessage); - // unsafe - // { - // var i16ErrorCode = GMH_Transmit(1, 0, &i16Priority, &dblFloatValue, &i32IntergerValue); - // } + using (var httpContent = httpResponseMessage.Content) + { + var content = await httpContent.ReadAsStringAsync(); + var obj = JsonConvert.DeserializeObject(content); + Console.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented)); + } + } + } + }); - // Console.WriteLine(dblFloatValue); - - // GMH_CloseCom(); + Console.ReadKey(); } - - - //public static void Main(string[] args) - //{ - // var messurementLines = File.ReadLines(@".\messurements.txt"); - // var messurements = new List(); - - // var parsedData = new List(); - // var us = new CultureInfo("en-US"); - // var de = new CultureInfo("de-DE"); - // var any = NumberStyles.Any; - // var skipNext = true; - - // foreach (var line in messurementLines) - // { - // if (string.IsNullOrWhiteSpace(line)) - // { - // if (parsedData.Count > 0) - // { - // messurements.Add(new Messurement - // { - // PcbId = parsedData.First().PcbId, - // Start = parsedData.Min(x => x.Timestamp), - // MinT = parsedData.Min(x => x.CurrentT), - // MinTOF = parsedData.Min(x => x.CurrentTOF), - // AvgT = parsedData.Average(x => x.CurrentT), - // AvgTOF = parsedData.Average(x => x.CurrentTOF), - // MaxT = parsedData.Max(x => x.CurrentT), - // MaxTOF = parsedData.Max(x => x.CurrentTOF), - // End = parsedData.Max(x => x.Timestamp), - // }); - // } - - // parsedData = new List(); - // skipNext = true; - - // continue; - // } - - // if (skipNext) - // { - // skipNext = false; - - // continue; - // } - - // var lineTokens = line.Split(new[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); - - // if (lineTokens.Length != 4) - // { - // continue; - // } - - // var dateString = lineTokens[0]; - // var pcbId = lineTokens[1]; - // var temperatureString = lineTokens[2]; - // var tofString = lineTokens[3]; - - // _ = DateTime.TryParse(dateString.Substring(1, dateString.Length - 2), out var timestamp); - // _ = double.TryParse(temperatureString, any, us, out var currentT) || double.TryParse(temperatureString, any, de, out currentT); - // _ = double.TryParse(tofString, any, us, out var currentTOF) || double.TryParse(tofString, any, de, out currentT); - - // parsedData.Add(new MessurementData - // { - // PcbId = pcbId, - // CurrentT = currentT, - // CurrentTOF = currentTOF, - // Timestamp = timestamp - // }); - // } - - // File.WriteAllLines(@".\messurements.csv", messurements.Select(x - // => $"{x.PcbId,10}\t" - // + $"{x.AvgT,5:0.00}\t" - // + $"{x.AvgTOF,12:0.0000000000}\t" - // + $"{x.DifferenceT,5:00.00}\t" - // + $"{x.DifferenceTOF,12:0.0000000000}")); - - // Console.WriteLine(Messurement.Header); - - // messurements.ForEach(Console.WriteLine); - //} - } - - public class MessurementData - { - public string PcbId { get; set; } - - public double CurrentT { get; set; } - - public double CurrentTOF { get; set; } - - public DateTime Timestamp { get; set; } - } - - public class Messurement - { - public string PcbId { get; set; } - - public DateTime Start { get; set; } - - public double MinTOF { get; set; } - - public double MinT { get; set; } - - public double AvgTOF { get; set; } - - public double AvgT { get; set; } - - public double MaxTOF { get; set; } - - public double MaxT { get; set; } - - public DateTime End { get; set; } - - public double DifferenceT => Math.Abs(this.MaxT - this.MinT); - - public double DifferenceTOF => Math.Abs(this.MaxTOF - this.MinTOF); - - public override String ToString() - => $"{this.PcbId,10}\t" - + $"{this.Start,21:yyyy-MM-dd hh:mm:ss}\t" - + $"{this.MinT,5:0.00}\t" - + $"{this.MinTOF,12:0.0000000000}\t" - + $"{this.AvgT,5:0.00}\t" - + $"{this.AvgTOF,12:0.0000000000}\t" - + $"{this.MaxT,5:0.00}\t" - + $"{this.MaxTOF,12:0.0000000000}\t" - + $"{this.End,21:yyyy-MM-dd hh:mm:ss}\t" - + $"{this.DifferenceT,5:00.00}\t" - + $"{this.DifferenceTOF,12:0.0000000000}"; - - public static string Header - => $"{"PcbId",10}\t" - + $"{"Start",21}\t" - + $"{"Min T",5}\t" - + $"{"Min TOF",12}\t" - + $"{"Avg T",5}\t" - + $"{"Avg TOF",12}\t" - + $"{"Max T",5}\t" - + $"{"Max TOF",12}\t" - + $"{"End",21}\t" - + $"{"Dif T",5}\t" - + $"{"Dif TOF",12}"; } } diff --git a/Common/Ui/GenesisToolBox/Ctls/ChangePassword.Designer.cs b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.Designer.cs new file mode 100644 index 00000000..c62107c0 --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.Designer.cs @@ -0,0 +1,211 @@ +namespace Xylem.Common.Ui.GenesisToolBox.Ctls +{ + partial class ChangePassword + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.layout = new System.Windows.Forms.TableLayoutPanel(); + this.oldPasswordLbl = new System.Windows.Forms.Label(); + this.newPasswordLbl = new System.Windows.Forms.Label(); + this.confirmPasswordLbl = new System.Windows.Forms.Label(); + this.oldPassword = new System.Windows.Forms.TextBox(); + this.newPassword = new System.Windows.Forms.TextBox(); + this.confirmPassword = new System.Windows.Forms.TextBox(); + this.submitBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.ChangePasswordErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); + this.layout.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ChangePasswordErrorProvider)).BeginInit(); + this.SuspendLayout(); + // + // layout + // + this.layout.AutoSize = true; + this.layout.ColumnCount = 3; + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.layout.Controls.Add(this.oldPasswordLbl, 1, 1); + this.layout.Controls.Add(this.newPasswordLbl, 1, 4); + this.layout.Controls.Add(this.confirmPasswordLbl, 1, 7); + this.layout.Controls.Add(this.oldPassword, 1, 2); + this.layout.Controls.Add(this.newPassword, 1, 5); + this.layout.Controls.Add(this.confirmPassword, 1, 8); + this.layout.Controls.Add(this.submitBtn, 1, 10); + this.layout.Controls.Add(this.cancelBtn, 1, 12); + this.layout.Dock = System.Windows.Forms.DockStyle.Fill; + this.layout.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.layout.Location = new System.Drawing.Point(0, 0); + this.layout.Name = "layout"; + this.layout.RowCount = 14; + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.layout.Size = new System.Drawing.Size(517, 584); + this.layout.TabIndex = 0; + // + // oldPasswordLbl + // + this.oldPasswordLbl.AutoSize = true; + this.oldPasswordLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.oldPasswordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.oldPasswordLbl.Location = new System.Drawing.Point(129, 188); + this.oldPasswordLbl.Margin = new System.Windows.Forms.Padding(0); + this.oldPasswordLbl.Name = "oldPasswordLbl"; + this.oldPasswordLbl.Size = new System.Drawing.Size(258, 15); + this.oldPasswordLbl.TabIndex = 0; + this.oldPasswordLbl.Text = "Old password"; + this.oldPasswordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // newPasswordLbl + // + this.newPasswordLbl.AutoSize = true; + this.newPasswordLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.newPasswordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.newPasswordLbl.Location = new System.Drawing.Point(129, 236); + this.newPasswordLbl.Margin = new System.Windows.Forms.Padding(0); + this.newPasswordLbl.Name = "newPasswordLbl"; + this.newPasswordLbl.Size = new System.Drawing.Size(258, 15); + this.newPasswordLbl.TabIndex = 1; + this.newPasswordLbl.Text = "New password"; + this.newPasswordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // confirmPasswordLbl + // + this.confirmPasswordLbl.AutoSize = true; + this.confirmPasswordLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.confirmPasswordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.confirmPasswordLbl.Location = new System.Drawing.Point(129, 284); + this.confirmPasswordLbl.Margin = new System.Windows.Forms.Padding(0); + this.confirmPasswordLbl.Name = "confirmPasswordLbl"; + this.confirmPasswordLbl.Size = new System.Drawing.Size(258, 15); + this.confirmPasswordLbl.TabIndex = 2; + this.confirmPasswordLbl.Text = "Confirm password"; + this.confirmPasswordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // oldPassword + // + this.oldPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.oldPassword.Dock = System.Windows.Forms.DockStyle.Fill; + this.oldPassword.Location = new System.Drawing.Point(132, 203); + this.oldPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.oldPassword.Name = "oldPassword"; + this.oldPassword.Size = new System.Drawing.Size(255, 23); + this.oldPassword.TabIndex = 3; + // + // newPassword + // + this.newPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.newPassword.Dock = System.Windows.Forms.DockStyle.Fill; + this.newPassword.Location = new System.Drawing.Point(132, 251); + this.newPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.newPassword.Name = "newPassword"; + this.newPassword.Size = new System.Drawing.Size(255, 23); + this.newPassword.TabIndex = 4; + // + // confirmPassword + // + this.confirmPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.confirmPassword.Dock = System.Windows.Forms.DockStyle.Fill; + this.confirmPassword.Location = new System.Drawing.Point(132, 299); + this.confirmPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.confirmPassword.Name = "confirmPassword"; + this.confirmPassword.Size = new System.Drawing.Size(255, 23); + this.confirmPassword.TabIndex = 5; + // + // submitBtn + // + this.submitBtn.AutoSize = true; + this.submitBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.submitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.submitBtn.Location = new System.Drawing.Point(132, 332); + this.submitBtn.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.submitBtn.Name = "submitBtn"; + this.submitBtn.Size = new System.Drawing.Size(255, 27); + this.submitBtn.TabIndex = 6; + this.submitBtn.Text = "Change password"; + this.submitBtn.UseVisualStyleBackColor = true; + this.submitBtn.Click += new System.EventHandler(this.OnFormSubmittedClick); + // + // cancelBtn + // + this.cancelBtn.AutoSize = true; + this.cancelBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.cancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cancelBtn.Location = new System.Drawing.Point(132, 369); + this.cancelBtn.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(255, 27); + this.cancelBtn.TabIndex = 7; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + // + // ChangePasswordErrorProvider + // + this.ChangePasswordErrorProvider.ContainerControl = this; + // + // ResetPassword + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.layout); + this.Name = "ResetPassword"; + this.Size = new System.Drawing.Size(517, 584); + this.layout.ResumeLayout(false); + this.layout.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ChangePasswordErrorProvider)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel layout; + private System.Windows.Forms.Label oldPasswordLbl; + private System.Windows.Forms.Label newPasswordLbl; + private System.Windows.Forms.Label confirmPasswordLbl; + private System.Windows.Forms.TextBox oldPassword; + private System.Windows.Forms.TextBox newPassword; + private System.Windows.Forms.TextBox confirmPassword; + private System.Windows.Forms.Button submitBtn; + private System.Windows.Forms.Button cancelBtn; + private System.Windows.Forms.ErrorProvider ChangePasswordErrorProvider; + } +} diff --git a/Common/Ui/GenesisToolBox/Ctls/ChangePassword.cs b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.cs new file mode 100644 index 00000000..8e3c7195 --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.cs @@ -0,0 +1,60 @@ +namespace Xylem.Common.Ui.GenesisToolBox.Ctls +{ + using System; + using System.Collections.Generic; + using System.Windows.Forms; + + using Xylem.Common.Ui.GenesisToolBox.Infrastructure; + + public partial class ChangePassword : UserControl + { + private readonly Action changePasswordSubmitted; + private readonly IDictionary fields; + + public ChangePassword() + { + this.InitializeComponent(); + + this.Dock = DockStyle.Fill; + } + + public ChangePassword(Action resetPasswordSubmitted) : this() + { + this.changePasswordSubmitted = resetPasswordSubmitted; + + this.fields = new Dictionary + { + { "OldPassword", this.oldPassword }, + { "NewPassword", this.newPassword }, + { "ConfirmPassword", this.confirmPassword }, + }; + } + + public event Action OnCancellation; + + private void OnCancellationClick(Object sender, EventArgs args) + { + this.OnCancellation?.Invoke(this); + } + + private void OnFormSubmittedClick(Object sender, EventArgs args) + { + this.ChangePasswordErrorProvider.Clear(); + + if (!Software.ChangePassword(this.oldPassword.Text, this.newPassword.Text, this.confirmPassword.Text, out var errors)) + { + foreach (var kvp in errors) + { + if (this.fields.TryGetValue(kvp.Key, out var control)) + { + this.ChangePasswordErrorProvider.SetError(control, kvp.Value); + } + } + } + else + { + this.changePasswordSubmitted?.Invoke(this); + } + } + } +} diff --git a/Common/Ui/GenesisToolBox/Ctls/ChangePassword.resx b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.resx new file mode 100644 index 00000000..9d3ead17 --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/ChangePassword.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/Ctls/LoginForm.Designer.cs b/Common/Ui/GenesisToolBox/Ctls/LoginForm.Designer.cs index c18c0208..2bc98d2d 100644 --- a/Common/Ui/GenesisToolBox/Ctls/LoginForm.Designer.cs +++ b/Common/Ui/GenesisToolBox/Ctls/LoginForm.Designer.cs @@ -37,12 +37,14 @@ this.Username = new System.Windows.Forms.TextBox(); this.PasswordLabel = new System.Windows.Forms.Label(); this.LoginErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); + this.cancelBtn = new System.Windows.Forms.Button(); this.LoginFormPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.LoginErrorProvider)).BeginInit(); this.SuspendLayout(); // // LoginFormPanel // + this.LoginFormPanel.Controls.Add(this.cancelBtn); this.LoginFormPanel.Controls.Add(this.ErrorMessage); this.LoginFormPanel.Controls.Add(this.LoginButton); this.LoginFormPanel.Controls.Add(this.Password); @@ -132,6 +134,19 @@ this.LoginErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; this.LoginErrorProvider.ContainerControl = this; // + // cancelBtn + // + this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.cancelBtn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cancelBtn.Location = new System.Drawing.Point(97, 246); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(266, 23); + this.cancelBtn.TabIndex = 6; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.OnCancelClick); + // // LoginForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -156,5 +171,6 @@ private System.Windows.Forms.Label PasswordLabel; private System.Windows.Forms.ErrorProvider LoginErrorProvider; private System.Windows.Forms.Label ErrorMessage; + private System.Windows.Forms.Button cancelBtn; } } diff --git a/Common/Ui/GenesisToolBox/Ctls/LoginForm.cs b/Common/Ui/GenesisToolBox/Ctls/LoginForm.cs index 83d12734..8b72b837 100644 --- a/Common/Ui/GenesisToolBox/Ctls/LoginForm.cs +++ b/Common/Ui/GenesisToolBox/Ctls/LoginForm.cs @@ -19,6 +19,8 @@ public LoginForm(Action submittedCallback) : this() => this.submittedCallback = submittedCallback; + public event Action OnCancellation; + private void LoginButtonClick(object sender, EventArgs e) { this.ErrorMessage.Text = default(string); @@ -48,5 +50,10 @@ internal void ShowError(string errorMessage) => this.ErrorMessage.Text = errorMessage; + + private void OnCancelClick(Object sender, EventArgs e) + { + this.OnCancellation?.Invoke(this); + } } } diff --git a/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.Designer.cs b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.Designer.cs new file mode 100644 index 00000000..806cc460 --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.Designer.cs @@ -0,0 +1,377 @@ +namespace Xylem.Common.Ui.GenesisToolBox.Ctls +{ + partial class RegisterLDAPUser + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.layout = new System.Windows.Forms.TableLayoutPanel(); + this.employeeIdLbl = new System.Windows.Forms.Label(); + this.employeeId = new System.Windows.Forms.TextBox(); + this.firstnameLbl = new System.Windows.Forms.Label(); + this.lastnameLbl = new System.Windows.Forms.Label(); + this.phoneLbl = new System.Windows.Forms.Label(); + this.emailLbl = new System.Windows.Forms.Label(); + this.usernameLbl = new System.Windows.Forms.Label(); + this.passwordLbl = new System.Windows.Forms.Label(); + this.confirmPasswordLbl = new System.Windows.Forms.Label(); + this.firstname = new System.Windows.Forms.TextBox(); + this.lastname = new System.Windows.Forms.TextBox(); + this.phone = new System.Windows.Forms.TextBox(); + this.email = new System.Windows.Forms.TextBox(); + this.username = new System.Windows.Forms.TextBox(); + this.password = new System.Windows.Forms.TextBox(); + this.confirmPassword = new System.Windows.Forms.TextBox(); + this.submitBtn = new System.Windows.Forms.Button(); + this.cancelBtn = new System.Windows.Forms.Button(); + this.RegisterErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); + this.layout.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.RegisterErrorProvider)).BeginInit(); + this.SuspendLayout(); + // + // layout + // + this.layout.AutoSize = true; + this.layout.ColumnCount = 3; + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.51852F)); + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 62.96296F)); + this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 18.51852F)); + this.layout.Controls.Add(this.employeeIdLbl, 1, 1); + this.layout.Controls.Add(this.employeeId, 1, 2); + this.layout.Controls.Add(this.firstnameLbl, 1, 4); + this.layout.Controls.Add(this.lastnameLbl, 1, 7); + this.layout.Controls.Add(this.phoneLbl, 1, 10); + this.layout.Controls.Add(this.emailLbl, 1, 13); + this.layout.Controls.Add(this.usernameLbl, 1, 16); + this.layout.Controls.Add(this.passwordLbl, 1, 19); + this.layout.Controls.Add(this.confirmPasswordLbl, 1, 22); + this.layout.Controls.Add(this.firstname, 1, 5); + this.layout.Controls.Add(this.lastname, 1, 8); + this.layout.Controls.Add(this.phone, 1, 11); + this.layout.Controls.Add(this.email, 1, 14); + this.layout.Controls.Add(this.username, 1, 17); + this.layout.Controls.Add(this.password, 1, 20); + this.layout.Controls.Add(this.confirmPassword, 1, 23); + this.layout.Controls.Add(this.submitBtn, 1, 25); + this.layout.Controls.Add(this.cancelBtn, 1, 27); + this.layout.Dock = System.Windows.Forms.DockStyle.Fill; + this.layout.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.layout.Location = new System.Drawing.Point(0, 0); + this.layout.Margin = new System.Windows.Forms.Padding(0); + this.layout.Name = "layout"; + this.layout.RowCount = 29; + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 5F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.layout.Size = new System.Drawing.Size(371, 545); + this.layout.TabIndex = 1; + // + // employeeIdLbl + // + this.employeeIdLbl.AutoSize = true; + this.employeeIdLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.employeeIdLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.employeeIdLbl.Location = new System.Drawing.Point(68, 66); + this.employeeIdLbl.Margin = new System.Windows.Forms.Padding(0); + this.employeeIdLbl.Name = "employeeIdLbl"; + this.employeeIdLbl.Size = new System.Drawing.Size(233, 15); + this.employeeIdLbl.TabIndex = 0; + this.employeeIdLbl.Text = "Employee Id"; + this.employeeIdLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // employeeId + // + this.employeeId.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.employeeId.Dock = System.Windows.Forms.DockStyle.Fill; + this.employeeId.Location = new System.Drawing.Point(71, 81); + this.employeeId.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.employeeId.Name = "employeeId"; + this.employeeId.ReadOnly = true; + this.employeeId.Size = new System.Drawing.Size(230, 23); + this.employeeId.TabIndex = 1; + // + // firstnameLbl + // + this.firstnameLbl.AutoSize = true; + this.firstnameLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.firstnameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.firstnameLbl.Location = new System.Drawing.Point(68, 109); + this.firstnameLbl.Margin = new System.Windows.Forms.Padding(0); + this.firstnameLbl.Name = "firstnameLbl"; + this.firstnameLbl.Size = new System.Drawing.Size(233, 15); + this.firstnameLbl.TabIndex = 2; + this.firstnameLbl.Text = "First name"; + this.firstnameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // lastnameLbl + // + this.lastnameLbl.AutoSize = true; + this.lastnameLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.lastnameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lastnameLbl.Location = new System.Drawing.Point(68, 152); + this.lastnameLbl.Margin = new System.Windows.Forms.Padding(0); + this.lastnameLbl.Name = "lastnameLbl"; + this.lastnameLbl.Size = new System.Drawing.Size(233, 15); + this.lastnameLbl.TabIndex = 3; + this.lastnameLbl.Text = "Last name"; + this.lastnameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // phoneLbl + // + this.phoneLbl.AutoSize = true; + this.phoneLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.phoneLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.phoneLbl.Location = new System.Drawing.Point(68, 195); + this.phoneLbl.Margin = new System.Windows.Forms.Padding(0); + this.phoneLbl.Name = "phoneLbl"; + this.phoneLbl.Size = new System.Drawing.Size(233, 15); + this.phoneLbl.TabIndex = 4; + this.phoneLbl.Text = "Phone"; + this.phoneLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // emailLbl + // + this.emailLbl.AutoSize = true; + this.emailLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.emailLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.emailLbl.Location = new System.Drawing.Point(68, 238); + this.emailLbl.Margin = new System.Windows.Forms.Padding(0); + this.emailLbl.Name = "emailLbl"; + this.emailLbl.Size = new System.Drawing.Size(233, 15); + this.emailLbl.TabIndex = 5; + this.emailLbl.Text = "Email"; + this.emailLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // usernameLbl + // + this.usernameLbl.AutoSize = true; + this.usernameLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.usernameLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.usernameLbl.Location = new System.Drawing.Point(68, 281); + this.usernameLbl.Margin = new System.Windows.Forms.Padding(0); + this.usernameLbl.Name = "usernameLbl"; + this.usernameLbl.Size = new System.Drawing.Size(233, 15); + this.usernameLbl.TabIndex = 6; + this.usernameLbl.Text = "Username"; + this.usernameLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // passwordLbl + // + this.passwordLbl.AutoSize = true; + this.passwordLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.passwordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.passwordLbl.Location = new System.Drawing.Point(68, 324); + this.passwordLbl.Margin = new System.Windows.Forms.Padding(0); + this.passwordLbl.Name = "passwordLbl"; + this.passwordLbl.Size = new System.Drawing.Size(233, 15); + this.passwordLbl.TabIndex = 7; + this.passwordLbl.Text = "Password"; + this.passwordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // confirmPasswordLbl + // + this.confirmPasswordLbl.AutoSize = true; + this.confirmPasswordLbl.Dock = System.Windows.Forms.DockStyle.Fill; + this.confirmPasswordLbl.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.confirmPasswordLbl.Location = new System.Drawing.Point(68, 367); + this.confirmPasswordLbl.Margin = new System.Windows.Forms.Padding(0); + this.confirmPasswordLbl.Name = "confirmPasswordLbl"; + this.confirmPasswordLbl.Size = new System.Drawing.Size(233, 15); + this.confirmPasswordLbl.TabIndex = 8; + this.confirmPasswordLbl.Text = "Confirm password"; + this.confirmPasswordLbl.TextAlign = System.Drawing.ContentAlignment.BottomLeft; + // + // firstname + // + this.firstname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.firstname.Dock = System.Windows.Forms.DockStyle.Fill; + this.firstname.Location = new System.Drawing.Point(71, 124); + this.firstname.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.firstname.Name = "firstname"; + this.firstname.ReadOnly = true; + this.firstname.Size = new System.Drawing.Size(230, 23); + this.firstname.TabIndex = 9; + // + // lastname + // + this.lastname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.lastname.Dock = System.Windows.Forms.DockStyle.Fill; + this.lastname.Location = new System.Drawing.Point(71, 167); + this.lastname.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.lastname.Name = "lastname"; + this.lastname.ReadOnly = true; + this.lastname.Size = new System.Drawing.Size(230, 23); + this.lastname.TabIndex = 10; + // + // phone + // + this.phone.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.phone.Dock = System.Windows.Forms.DockStyle.Fill; + this.phone.Location = new System.Drawing.Point(71, 210); + this.phone.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.phone.Name = "phone"; + this.phone.ReadOnly = true; + this.phone.Size = new System.Drawing.Size(230, 23); + this.phone.TabIndex = 11; + // + // email + // + this.email.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.email.Dock = System.Windows.Forms.DockStyle.Fill; + this.email.Location = new System.Drawing.Point(71, 253); + this.email.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.email.Name = "email"; + this.email.ReadOnly = true; + this.email.Size = new System.Drawing.Size(230, 23); + this.email.TabIndex = 12; + // + // username + // + this.username.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.username.Dock = System.Windows.Forms.DockStyle.Fill; + this.username.Location = new System.Drawing.Point(71, 296); + this.username.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.username.Name = "username"; + this.username.Size = new System.Drawing.Size(230, 23); + this.username.TabIndex = 13; + // + // password + // + this.password.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.password.Dock = System.Windows.Forms.DockStyle.Fill; + this.password.Location = new System.Drawing.Point(71, 339); + this.password.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.password.Name = "password"; + this.password.Size = new System.Drawing.Size(230, 23); + this.password.TabIndex = 14; + // + // confirmPassword + // + this.confirmPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.confirmPassword.Dock = System.Windows.Forms.DockStyle.Fill; + this.confirmPassword.Location = new System.Drawing.Point(71, 382); + this.confirmPassword.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.confirmPassword.Name = "confirmPassword"; + this.confirmPassword.Size = new System.Drawing.Size(230, 23); + this.confirmPassword.TabIndex = 15; + // + // submitBtn + // + this.submitBtn.AutoSize = true; + this.submitBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.submitBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.submitBtn.Location = new System.Drawing.Point(71, 415); + this.submitBtn.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.submitBtn.Name = "submitBtn"; + this.submitBtn.Size = new System.Drawing.Size(230, 27); + this.submitBtn.TabIndex = 16; + this.submitBtn.Text = "Complete Registration"; + this.submitBtn.UseVisualStyleBackColor = true; + this.submitBtn.Click += new System.EventHandler(this.SubmitBtn_Click); + // + // cancelBtn + // + this.cancelBtn.AutoSize = true; + this.cancelBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.cancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cancelBtn.Location = new System.Drawing.Point(71, 452); + this.cancelBtn.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.cancelBtn.Name = "cancelBtn"; + this.cancelBtn.Size = new System.Drawing.Size(230, 27); + this.cancelBtn.TabIndex = 17; + this.cancelBtn.Text = "Cancel"; + this.cancelBtn.UseVisualStyleBackColor = true; + this.cancelBtn.Click += new System.EventHandler(this.OnCancellationClick); + // + // RegisterErrorProvider + // + this.RegisterErrorProvider.ContainerControl = this; + // + // RegisterLDAPUser + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.layout); + this.Name = "RegisterLDAPUser"; + this.Size = new System.Drawing.Size(371, 545); + this.layout.ResumeLayout(false); + this.layout.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.RegisterErrorProvider)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.TableLayoutPanel layout; + private System.Windows.Forms.Label employeeIdLbl; + private System.Windows.Forms.TextBox employeeId; + private System.Windows.Forms.Label firstnameLbl; + private System.Windows.Forms.Label lastnameLbl; + private System.Windows.Forms.Label phoneLbl; + private System.Windows.Forms.Label emailLbl; + private System.Windows.Forms.Label usernameLbl; + private System.Windows.Forms.Label passwordLbl; + private System.Windows.Forms.Label confirmPasswordLbl; + private System.Windows.Forms.TextBox firstname; + private System.Windows.Forms.TextBox lastname; + private System.Windows.Forms.TextBox phone; + private System.Windows.Forms.TextBox email; + private System.Windows.Forms.TextBox username; + private System.Windows.Forms.TextBox password; + private System.Windows.Forms.TextBox confirmPassword; + private System.Windows.Forms.Button submitBtn; + private System.Windows.Forms.ErrorProvider RegisterErrorProvider; + private System.Windows.Forms.Button cancelBtn; + } +} diff --git a/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.cs b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.cs new file mode 100644 index 00000000..d46aa91c --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.cs @@ -0,0 +1,81 @@ +namespace Xylem.Common.Ui.GenesisToolBox.Ctls +{ + using System; + using System.Collections.Generic; + using System.Windows.Forms; + + using Xylem.Common.Ui.GenesisToolBox.Infrastructure; + + public partial class RegisterLDAPUser : UserControl + { + private readonly Action initializeFormState; + private readonly IDictionary fields; + + public RegisterLDAPUser() + { + this.InitializeComponent(); + + this.Dock = DockStyle.Fill; + + var user = Software.PendingUser; + this.employeeId.Text = user.EmployeeId.ToString(); + this.firstname.Text = user.FirstName; + this.lastname.Text = user.LastName; + this.phone.Text = user.Phone; + this.email.Text = user.Email; + this.username.Text = user.Username; + this.password.Text = user.Password; + this.confirmPassword.Text = user.ConfirmPassword; + + this.fields = new Dictionary + { + { nameof(user.EmployeeId), this.employeeId }, + { nameof(user.FirstName), this.firstname }, + { nameof(user.LastName), this.lastname }, + { nameof(user.Phone), this.phone }, + { nameof(user.Email), this.email }, + { nameof(user.Username), this.username }, + { nameof(user.Password), this.password }, + { nameof(user.ConfirmPassword), this.confirmPassword }, + }; + } + + public RegisterLDAPUser(Action initializeFormState) : this() + { + this.initializeFormState = initializeFormState; + } + + public event Action OnCancellation; + + private void SubmitBtn_Click(Object sender, EventArgs args) + { + this.RegisterErrorProvider.Clear(); + + var user = Software.PendingUser; + + user.Username = this.username.Text; + user.Password = this.password.Text; + user.ConfirmPassword = this.confirmPassword.Text; + + if (!Software.Register(user, out var errors)) + { + foreach (var kvp in errors) + { + if (this.fields.TryGetValue(kvp.Key, out var control)) + { + this.RegisterErrorProvider.SetError(control, kvp.Value); + } + } + } + else + { + this.initializeFormState?.Invoke(this); + } + } + + private void OnCancellationClick(Object sender, EventArgs args) + { + this.OnCancellation?.Invoke(this); + } + } +} diff --git a/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.resx b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.resx new file mode 100644 index 00000000..5754106b --- /dev/null +++ b/Common/Ui/GenesisToolBox/Ctls/RegisterLDAPUser.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj index df6aeb88..a6d54a22 100644 --- a/Common/Ui/GenesisToolBox/GenesisToolBox.csproj +++ b/Common/Ui/GenesisToolBox/GenesisToolBox.csproj @@ -216,6 +216,18 @@ LoginForm.cs + + UserControl + + + RegisterLDAPUser.cs + + + UserControl + + + ChangePassword.cs + Component @@ -436,10 +448,10 @@ FrmTempMeter.cs - + + - @@ -466,6 +478,12 @@ LoginForm.cs + + RegisterLDAPUser.cs + + + ChangePassword.cs + FrmCalibrationResults.cs diff --git a/Common/Ui/GenesisToolBox/Infrastructure/LDAPLoginModel.cs b/Common/Ui/GenesisToolBox/Infrastructure/LDAPLoginModel.cs index 376ee6ac..e0252dd2 100644 --- a/Common/Ui/GenesisToolBox/Infrastructure/LDAPLoginModel.cs +++ b/Common/Ui/GenesisToolBox/Infrastructure/LDAPLoginModel.cs @@ -11,17 +11,5 @@ public int BuildV { get; set; } public int EmployeeId { get; set; } - - public string FirstName { get; set; } - - public string LastName { get; set; } - - public string Username { get; set; } - - public string Phone { get; set; } - - public string Email { get; set; } - - public string DomainName { get; set; } } } diff --git a/Common/Ui/GenesisToolBox/Infrastructure/LDAPUser.cs b/Common/Ui/GenesisToolBox/Infrastructure/LDAPUser.cs index 5b9a03cc..f8b887be 100644 --- a/Common/Ui/GenesisToolBox/Infrastructure/LDAPUser.cs +++ b/Common/Ui/GenesisToolBox/Infrastructure/LDAPUser.cs @@ -12,15 +12,23 @@ public int EmployeeId { get; private set; } - public string FirstName { get; private set; } + public string FirstName { get; set; } - public string LastName { get; private set; } + public string LastName { get; set; } - public string Username { get; private set; } + public string Phone { get; set; } - public string Phone { get; private set; } + public string Email { get; set; } - public string Email { get; private set; } + public string Username { get; set; } + + public string DomainName { get; private set; } + + public string Password { get; set; } + + public string ConfirmPassword { get; set; } + + public bool Found { get; private set; } private void InitializeLDAPUser() { @@ -97,18 +105,21 @@ { if (dictionaryEntryValues.Count > 0 && dictionaryEntryValues[0] is string username) { - this.Username = username.ToLower(); + this.DomainName = username.ToLower(); + this.Username = this.DomainName; } } } + + this.Found = this.EmployeeId > 0; } } } } } - catch (Exception e) + catch (Exception) { - Console.WriteLine(e); + } } } diff --git a/Common/Ui/GenesisToolBox/Infrastructure/Software.cs b/Common/Ui/GenesisToolBox/Infrastructure/Software.cs index 473e603d..cd277cab 100644 --- a/Common/Ui/GenesisToolBox/Infrastructure/Software.cs +++ b/Common/Ui/GenesisToolBox/Infrastructure/Software.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; + using System.Net; using System.Security.Cryptography; using System.Text; @@ -18,50 +19,40 @@ internal static class Software { private static String bearer; + private static LDAPUser user; private static IEnumerable softwareFunctions = Array.Empty(); - public static String UserName; + public static String UserName { get; private set; } - private static Boolean HasUser => !string.IsNullOrWhiteSpace(bearer); + public static Boolean IsRegistrationPending { get; set; } //=> user.Found && string.IsNullOrWhiteSpace(bearer); + + public static LDAPUser PendingUser => user; public static void Initialize() { var version = SoftwareVersion.Current; - var user = new LDAPUser(); + user = new LDAPUser(); - Login(new LDAPLoginModel - { - Assembly = version.AssemblyName.Name, - Email = user.Email, - EmployeeId = user.EmployeeId, - FirstName = user.FirstName, - LastName = user.LastName, - Phone = user.Phone, - Username = user.Username, - MajorV = version.MajorV, - MinorV = version.MinorV, - BuildV = version.BuildV, - }); - } - - /// - /// Sends login request and obtains an bearer authorization token. - /// - /// - containing all software and user info required for authentication. - public static void Login(LDAPLoginModel model) - { var authenticationResponse = LocalWebRequest.PostRequestAndGetResponseAsync( url: $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/AD", - json: model); - bearer = authenticationResponse - ?.Content - ?.Trim() - ?.Trim('"'); - softwareFunctions = GetFunctions(); + json: user); - if (HasUser) + if (authenticationResponse.StatusCode == HttpStatusCode.Accepted) { - UserName = $"{model.FirstName} {model.LastName}"; + IsRegistrationPending = true; + } + else + { + bearer = authenticationResponse + ?.Content + ?.Trim() + ?.Trim('"'); + softwareFunctions = GetFunctions(); + + if (!string.IsNullOrWhiteSpace(bearer)) + { + UserName = $"{user.FirstName} {user.LastName}"; + } } if (string.IsNullOrWhiteSpace(UserName)) @@ -70,6 +61,49 @@ } } + internal static Boolean ChangePassword(String text1, String text2, String text3, out Dictionary errors) + { + errors = new Dictionary(); + + var changePasswordResponse = LocalWebRequest.PostRequestAndGetResponseAsync( + url: $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/AD", + json: user); + + if (changePasswordResponse.StatusCode != HttpStatusCode.OK) + { + if (!string.IsNullOrWhiteSpace(changePasswordResponse.Content)) + { + errors = JsonConvert.DeserializeObject>(changePasswordResponse.Content); + } + } + + return changePasswordResponse.StatusCode == HttpStatusCode.OK; + } + + internal static Boolean Register(LDAPUser user, out Dictionary errors) + { + errors = new Dictionary(); + + var registerLDAPResponse = LocalWebRequest.PostRequestAndGetResponseAsync( + url: $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Login/AD", + json: user); + + if (registerLDAPResponse.StatusCode == HttpStatusCode.OK) + { + bearer = registerLDAPResponse + ?.Content + ?.Trim() + ?.Trim('"'); + softwareFunctions = GetFunctions(); + } + else if (!string.IsNullOrWhiteSpace(registerLDAPResponse.Content)) + { + errors = JsonConvert.DeserializeObject>(registerLDAPResponse.Content); + } + + return registerLDAPResponse.StatusCode == HttpStatusCode.OK; + } + /// /// Sends login request and obtains an bearer authorization token. /// @@ -92,21 +126,14 @@ ?.Trim('"'); softwareFunctions = GetFunctions(); - if (HasUser) + if (!string.IsNullOrWhiteSpace(bearer)) { - try - { - UserName = LocalWebRequest - .GetRequest( - timeoutMs: 1200, - url: $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Personalization/Login", - header: new Dictionary { { "Authorization", $"Bearer {bearer}" } }) - .Trim('"'); - } - catch (Exception ) - { - // ignored - } + UserName = LocalWebRequest + .GetRequest( + timeoutMs: 1200, + url: $"{ServiceUrls.LaaProductionAPI}/LaaProductionWeb/API/Personalization/Login", + header: new Dictionary { { "Authorization", $"Bearer {bearer}" } }) + .Trim('"'); } if (string.IsNullOrWhiteSpace(UserName)) @@ -114,7 +141,7 @@ UserName = "Options"; } - return HasUser; + return !string.IsNullOrWhiteSpace(bearer); } public static IEnumerable GetFunctions() diff --git a/Common/Ui/GenesisToolBox/Infrastructure/UserLoginModel.cs b/Common/Ui/GenesisToolBox/Infrastructure/UserLoginModel.cs index 9a583b20..ec0ea0e6 100644 --- a/Common/Ui/GenesisToolBox/Infrastructure/UserLoginModel.cs +++ b/Common/Ui/GenesisToolBox/Infrastructure/UserLoginModel.cs @@ -9,7 +9,7 @@ public int MinorV { get; set; } public int BuildV { get; set; } - + public string Username { get; set; } public string Password { get; set; } diff --git a/Common/Ui/GenesisToolBox/Program.cs b/Common/Ui/GenesisToolBox/Program.cs index eb81b0f1..afc01e11 100644 --- a/Common/Ui/GenesisToolBox/Program.cs +++ b/Common/Ui/GenesisToolBox/Program.cs @@ -2,7 +2,6 @@ { using System; using System.Windows.Forms; - using Xylem.Common.Ui.GenesisToolBox.Infrastructure; internal static class Program diff --git a/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs b/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs index 0dd54a3f..dadf71cc 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs +++ b/Common/Ui/GenesisToolBox/frmMainForm.Designer.cs @@ -54,7 +54,7 @@ this.optionsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.loginMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.logoutMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.registerMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.resetPasswordMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.gpGerneral.SuspendLayout(); this.gpLAA.SuspendLayout(); this.gbDeveloper.SuspendLayout(); @@ -262,7 +262,7 @@ // // btnLowLevelTools // - this.btnLowLevelTools.Location = new System.Drawing.Point(4, 153); + this.btnLowLevelTools.Location = new System.Drawing.Point(4, 162); this.btnLowLevelTools.Name = "btnLowLevelTools"; this.btnLowLevelTools.Size = new System.Drawing.Size(157, 40); this.btnLowLevelTools.TabIndex = 22; @@ -278,9 +278,9 @@ this.gbDeveloper.Controls.Add(this.btnFiles); this.gbDeveloper.Controls.Add(this.btnLegacyTestApp); this.gbDeveloper.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.gbDeveloper.Location = new System.Drawing.Point(186, 293); + this.gbDeveloper.Location = new System.Drawing.Point(186, 278); this.gbDeveloper.Name = "gbDeveloper"; - this.gbDeveloper.Size = new System.Drawing.Size(168, 193); + this.gbDeveloper.Size = new System.Drawing.Size(168, 208); this.gbDeveloper.TabIndex = 21; this.gbDeveloper.TabStop = false; this.gbDeveloper.Text = "Developer"; @@ -289,7 +289,7 @@ // BtnFileSplit // this.BtnFileSplit.Enabled = false; - this.BtnFileSplit.Location = new System.Drawing.Point(4, 111); + this.BtnFileSplit.Location = new System.Drawing.Point(4, 118); this.BtnFileSplit.Name = "BtnFileSplit"; this.BtnFileSplit.Size = new System.Drawing.Size(157, 40); this.BtnFileSplit.TabIndex = 18; @@ -301,7 +301,7 @@ // btnFiles // this.btnFiles.Enabled = false; - this.btnFiles.Location = new System.Drawing.Point(4, 65); + this.btnFiles.Location = new System.Drawing.Point(4, 72); this.btnFiles.Name = "btnFiles"; this.btnFiles.Size = new System.Drawing.Size(157, 40); this.btnFiles.TabIndex = 16; @@ -312,7 +312,7 @@ // btnLegacyTestApp // this.btnLegacyTestApp.Enabled = false; - this.btnLegacyTestApp.Location = new System.Drawing.Point(4, 19); + this.btnLegacyTestApp.Location = new System.Drawing.Point(4, 27); this.btnLegacyTestApp.Name = "btnLegacyTestApp"; this.btnLegacyTestApp.Size = new System.Drawing.Size(157, 40); this.btnLegacyTestApp.TabIndex = 15; @@ -336,7 +336,7 @@ this.optionsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.loginMenuItem, this.logoutMenuItem, - this.registerMenuItem}); + this.resetPasswordMenuItem}); this.optionsMenuItem.Name = "optionsMenuItem"; this.optionsMenuItem.Size = new System.Drawing.Size(61, 20); this.optionsMenuItem.Text = "Options"; @@ -356,12 +356,12 @@ this.logoutMenuItem.Text = "Logout"; this.logoutMenuItem.Click += new System.EventHandler(this.OnLogoutClick); // - // registerMenuItem + // resetPasswordMenuItem // - this.registerMenuItem.Name = "registerMenuItem"; - this.registerMenuItem.Size = new System.Drawing.Size(180, 22); - this.registerMenuItem.Text = "Register"; - this.registerMenuItem.Click += new System.EventHandler(this.OnRegisterClick); + this.resetPasswordMenuItem.Name = "resetPasswordMenuItem"; + this.resetPasswordMenuItem.Size = new System.Drawing.Size(180, 22); + this.resetPasswordMenuItem.Text = "Change Password"; + this.resetPasswordMenuItem.Click += new System.EventHandler(this.OnChangePasswordClick); // // FrmMainForm // @@ -419,7 +419,7 @@ private System.Windows.Forms.ToolStripMenuItem optionsMenuItem; private System.Windows.Forms.ToolStripMenuItem loginMenuItem; private System.Windows.Forms.ToolStripMenuItem logoutMenuItem; - private System.Windows.Forms.ToolStripMenuItem registerMenuItem; + private System.Windows.Forms.ToolStripMenuItem resetPasswordMenuItem; } } diff --git a/Common/Ui/GenesisToolBox/frmMainForm.cs b/Common/Ui/GenesisToolBox/frmMainForm.cs index b0f67f50..a3f40989 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.cs +++ b/Common/Ui/GenesisToolBox/frmMainForm.cs @@ -407,7 +407,7 @@ /// private void SetSoftwareFunctions() { - registerMenuItem.Tag = SoftwareFunctions.LAA_ADMIN; + resetPasswordMenuItem.Tag = SoftwareFunctions.LAA_ADMIN; btnSetup.Tag = SoftwareFunctions.GENERAL_SETUP; btnAlarm.Tag = SoftwareFunctions.GENERAL_ALARM; @@ -516,11 +516,29 @@ /// Hides all members but the login form if the app is initialized otherwise shows error message. /// In case that the app is initialized and user is authorized shows all buttons as enabled or disabled depending on the user permissions. /// - private void InitializeFormState() + private void InitializeFormState(RegisterLDAPUser registerForm = null) { + if (registerForm != null) + { + Software.Initialize(); + + this.Controls.Remove(registerForm); + } + HideContent(); - SetSoftwareFunctions(); - ShowAvailableSoftwareFunctions(); + + if (Software.IsRegistrationPending) + { + registerForm = new RegisterLDAPUser(InitializeFormState); + registerForm.OnCancellation += this.OnControlCancellation; + + this.Controls.Add(registerForm); + } + else + { + SetSoftwareFunctions(); + ShowAvailableSoftwareFunctions(); + } } private void OnLogoutClick(Object sender, EventArgs e) @@ -558,7 +576,10 @@ if (!hasLoginForm) { - Controls.Add(new LoginForm(LoginFormSubmitted)); + var loginForm = new LoginForm(LoginFormSubmitted); + loginForm.OnCancellation += OnControlCancellation; + + Controls.Add(loginForm); } } @@ -577,7 +598,6 @@ Controls.Remove(loginForm); ShowAvailableSoftwareFunctions(); - optionsMenuItem.Text = Software.UserName; } else @@ -587,6 +607,28 @@ } } + private void OnChangePasswordClick(Object _, EventArgs _1) + { + this.HideContent(); + + var control = new ChangePassword(this.OnControlCancellation); + control.OnCancellation += this.OnControlCancellation; + + this.Controls.Add(control); + } + + private void OnControlCancellation(Control control) + { + if (control != null) + { + Software.Initialize(); + + this.Controls.Remove(control); + } + + this.InitializeFormState(); + } + #endregion Form initialization private void btnQsTool_Click(Object sender, EventArgs e) @@ -596,10 +638,5 @@ form.Closed += Form_Closed; Hide(); } - - private void OnRegisterClick(Object _, EventArgs _1) - { - MessageBox.Show("Register new user"); - } } } diff --git a/Common/Ui/GenesisToolBox/frmMainForm.resx b/Common/Ui/GenesisToolBox/frmMainForm.resx index c99000d9..9fcb69e5 100644 --- a/Common/Ui/GenesisToolBox/frmMainForm.resx +++ b/Common/Ui/GenesisToolBox/frmMainForm.resx @@ -121,6 +121,6 @@ 17, 17 - 25 + 124 \ No newline at end of file diff --git a/LaaProductionWeb/LaaProductionWeb/API/APIExtensions.cs b/LaaProductionWeb/LaaProductionWeb/API/APIExtensions.cs index fb6ae352..43f595eb 100644 --- a/LaaProductionWeb/LaaProductionWeb/API/APIExtensions.cs +++ b/LaaProductionWeb/LaaProductionWeb/API/APIExtensions.cs @@ -11,7 +11,7 @@ { public static object Errors(this ModelStateDictionary modelStateDictionary) { - var errors = new Dictionary(); + var errors = new Dictionary(); foreach (var error in modelStateDictionary) { diff --git a/LaaProductionWeb/LaaProductionWeb/API/ControllerBase.cs b/LaaProductionWeb/LaaProductionWeb/API/ControllerBase.cs new file mode 100644 index 00000000..acab556e --- /dev/null +++ b/LaaProductionWeb/LaaProductionWeb/API/ControllerBase.cs @@ -0,0 +1,42 @@ +namespace LaaProductionWeb.API +{ + using Newtonsoft.Json; + using System.Net; + using System.Net.Http; + using System.Text; + using System.Threading; + using System.Threading.Tasks; + using System.Web.Http; + using System.Web.Http.Results; + + public class ControllerBase : ApiController + { + protected override BadRequestResult BadRequest() + { + return new BadRequestModelResult(this); + } + } + + public class BadRequestModelResult : BadRequestResult + { + private readonly ApiController controller; + + public BadRequestModelResult(ApiController controller) : base(controller) + { + this.controller = controller; + } + + public override Task ExecuteAsync(CancellationToken cancellationToken) + { + var errors = this.controller.ModelState.Errors(); + var errorsJson = JsonConvert.SerializeObject(errors); + var httpResponseMessage = new HttpResponseMessage(); + httpResponseMessage.Content = new StringContent(errorsJson, Encoding.UTF8, "application/json"); + httpResponseMessage.ReasonPhrase = nameof(HttpStatusCode.BadRequest); + httpResponseMessage.RequestMessage = controller.Request; + httpResponseMessage.StatusCode = HttpStatusCode.BadRequest; + + return Task.FromResult(httpResponseMessage); + } + } +} \ No newline at end of file diff --git a/LaaProductionWeb/LaaProductionWeb/API/LoginController.cs b/LaaProductionWeb/LaaProductionWeb/API/LoginController.cs index 4fb6740c..4b784699 100644 --- a/LaaProductionWeb/LaaProductionWeb/API/LoginController.cs +++ b/LaaProductionWeb/LaaProductionWeb/API/LoginController.cs @@ -7,9 +7,9 @@ using System.Net; using System.Web.Http; - + [RoutePrefix("api/Login")] - public class LoginController : ApiController + public class LoginController : ControllerBase { private readonly IAccountManager accountManager; @@ -31,7 +31,7 @@ { if (!this.ModelState.IsValid) { - return this.BadRequest(this.ModelState.ErrorsJson()); + return this.BadRequest(); } var bearer = this.accountManager.Login(model); @@ -45,7 +45,7 @@ { if (!this.ModelState.IsValid) { - return this.BadRequest(this.ModelState.ErrorsJson()); + return this.BadRequest(); } var bearer = this.accountManager.Login(model); diff --git a/LaaProductionWeb/LaaProductionWeb/App_Infrastructure/HttpExtensions.cs b/LaaProductionWeb/LaaProductionWeb/App_Infrastructure/HttpExtensions.cs index 0796a241..24aa4683 100644 --- a/LaaProductionWeb/LaaProductionWeb/App_Infrastructure/HttpExtensions.cs +++ b/LaaProductionWeb/LaaProductionWeb/App_Infrastructure/HttpExtensions.cs @@ -1,6 +1,6 @@ namespace LaaProductionWeb.App_Infrastructure { - using LaaProductionHttp.Interfaces; + using LaaProduction.Http.Interfaces; using Newtonsoft.Json; diff --git a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesController.cs b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesController.cs index 59fc5775..7b3d53e4 100644 --- a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesController.cs +++ b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesController.cs @@ -1,7 +1,7 @@ namespace LaaProductionWeb.Areas.Personalization.Controllers { using LaaProduction.Personalization; - using LaaProductionHttp.Interfaces; + using LaaProduction.Http.Interfaces; using LaaProductionWeb.App_Infrastructure; using LaaProductionWeb.Areas.Personalization.Models.Employees; using LaaProductionDI; diff --git a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesRolesController.cs b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesRolesController.cs index 47776548..f6640782 100644 --- a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesRolesController.cs +++ b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/EmployeesRolesController.cs @@ -3,7 +3,7 @@ using LaaProductionWeb.App_Infrastructure; using LaaProductionWeb.Areas.Personalization.Models.EmployeesRoles; using LaaProductionDI; - using LaaProductionHttp.Interfaces; + using LaaProduction.Http.Interfaces; using System; using System.Collections.Generic; diff --git a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/SoftwareController.cs b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/SoftwareController.cs index 1b167016..c781a00d 100644 --- a/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/SoftwareController.cs +++ b/LaaProductionWeb/LaaProductionWeb/Areas/Personalization/Controllers/SoftwareController.cs @@ -4,7 +4,7 @@ using LaaProductionWeb.App_Infrastructure; using LaaProductionWeb.Areas.Personalization.Models.Software; using LaaProductionDI; - using LaaProductionHttp.Interfaces; + using LaaProduction.Http.Interfaces; using System; using System.Collections.Generic; diff --git a/LaaProductionWeb/LaaProductionWeb/Controllers/SearchController.cs b/LaaProductionWeb/LaaProductionWeb/Controllers/SearchController.cs index 6b79aad1..41fe4c42 100644 --- a/LaaProductionWeb/LaaProductionWeb/Controllers/SearchController.cs +++ b/LaaProductionWeb/LaaProductionWeb/Controllers/SearchController.cs @@ -1,7 +1,7 @@ namespace LaaProductionWeb.Controllers { using LaaProduction.Personalization; - using LaaProductionHttp.Interfaces; + using LaaProduction.Http.Interfaces; using LaaProductionWeb.App_Infrastructure; using LaaProduction.Services.Interfaces; using LaaProduction.Services.Models.Search; diff --git a/LaaProductionWeb/LaaProductionWeb/Global.asax.cs b/LaaProductionWeb/LaaProductionWeb/Global.asax.cs index 287536f5..6d451f87 100644 --- a/LaaProductionWeb/LaaProductionWeb/Global.asax.cs +++ b/LaaProductionWeb/LaaProductionWeb/Global.asax.cs @@ -5,10 +5,9 @@ using LaaProduction.Services; using LaaProduction.Services.Interfaces; using LaaProductionDI; - using LaaProductionHttp; + using LaaProduction.Http; using LaaProductionSMTP; using LaaProductionSQL; - using LaaProductionWeb; using LaaProductionWeb.App_Infrastructure; using System.Web; diff --git a/LaaProductionWeb/LaaProductionWeb/Hubs/SIRTBroadcasterHub.cs b/LaaProductionWeb/LaaProductionWeb/Hubs/SIRTBroadcasterHub.cs deleted file mode 100644 index aa481758..00000000 --- a/LaaProductionWeb/LaaProductionWeb/Hubs/SIRTBroadcasterHub.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace LaaProductionWeb.Hubs -{ - using Microsoft.AspNet.SignalR; - using Microsoft.AspNet.SignalR.Hubs; - - using SIRTBroadcaster.Abstraction; - - [HubName(SIRTFixed.SIRT_HUB)] - public class SIRTBroadcasterHub : Hub, ISIRTBroadcaster - { - public void MessageReceived(SIRTMessage message) - => this.Clients.All.MessageReceived(message); - - public void SendMessage(SIRTMessage message) - => this.Clients.All.SendMessage(message); - } -} \ No newline at end of file diff --git a/LaaProductionWeb/LaaProductionWeb/LaaProductionWeb.csproj b/LaaProductionWeb/LaaProductionWeb/LaaProductionWeb.csproj index 2ddede65..d08f7e03 100644 --- a/LaaProductionWeb/LaaProductionWeb/LaaProductionWeb.csproj +++ b/LaaProductionWeb/LaaProductionWeb/LaaProductionWeb.csproj @@ -172,6 +172,7 @@ + @@ -220,7 +221,6 @@ Global.asax - @@ -314,6 +314,7 @@ + 10.0