User number added to EditSelectedUser form.

This commit is contained in:
Milan Hanajik 2017-03-17 09:45:39 +01:00
parent e245ec80c6
commit ccf99a3105
6 changed files with 239 additions and 139 deletions

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("2.12.497.0")]
[assembly: AssemblyFileVersion("2.12.497.0")]

View File

@ -31,120 +31,136 @@ namespace Users.Forms
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditSelectedUser));
this.txtName = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.txtPassword = new System.Windows.Forms.TextBox();
this.passwordLabel = new System.Windows.Forms.Label();
this.txtDescription = new System.Windows.Forms.TextBox();
this.descriptionLabel = new System.Windows.Forms.Label();
this.checkedListBoxGroups = new System.Windows.Forms.CheckedListBox();
this.groupsLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.repeatPasswordLabel = new System.Windows.Forms.Label();
this.txtRepeatPassword = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// txtName
//
resources.ApplyResources(this.txtName, "txtName");
this.txtName.Name = "txtName";
this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
this.txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtName_KeyPress);
this.txtName.Validated += new System.EventHandler(this.txtName_Validated);
//
// nameLabel
//
resources.ApplyResources(this.nameLabel, "nameLabel");
this.nameLabel.Name = "nameLabel";
//
// btnOk
//
resources.ApplyResources(this.btnOk, "btnOk");
this.btnOk.Name = "btnOk";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
resources.ApplyResources(this.btnCancel, "btnCancel");
this.btnCancel.Name = "btnCancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// txtPassword
//
resources.ApplyResources(this.txtPassword, "txtPassword");
this.txtPassword.Name = "txtPassword";
this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
//
// passwordLabel
//
resources.ApplyResources(this.passwordLabel, "passwordLabel");
this.passwordLabel.Name = "passwordLabel";
//
// txtDescription
//
resources.ApplyResources(this.txtDescription, "txtDescription");
this.txtDescription.Name = "txtDescription";
this.txtDescription.TextChanged += new System.EventHandler(this.txtDescription_TextChanged);
this.txtDescription.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDescription_KeyPress);
//
// descriptionLabel
//
resources.ApplyResources(this.descriptionLabel, "descriptionLabel");
this.descriptionLabel.Name = "descriptionLabel";
//
// checkedListBoxGroups
//
this.checkedListBoxGroups.CheckOnClick = true;
this.checkedListBoxGroups.FormattingEnabled = true;
resources.ApplyResources(this.checkedListBoxGroups, "checkedListBoxGroups");
this.checkedListBoxGroups.Name = "checkedListBoxGroups";
this.checkedListBoxGroups.Click += new System.EventHandler(this.checkedListBoxGroups_Click);
//
// groupsLabel
//
resources.ApplyResources(this.groupsLabel, "groupsLabel");
this.groupsLabel.Name = "groupsLabel";
//
// repeatPasswordLabel
//
resources.ApplyResources(this.repeatPasswordLabel, "repeatPasswordLabel");
this.repeatPasswordLabel.Name = "repeatPasswordLabel";
//
// txtRepeatPassword
//
resources.ApplyResources(this.txtRepeatPassword, "txtRepeatPassword");
this.txtRepeatPassword.Name = "txtRepeatPassword";
//
// EditSelectedUser
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.repeatPasswordLabel);
this.Controls.Add(this.txtRepeatPassword);
this.Controls.Add(this.groupsLabel);
this.Controls.Add(this.checkedListBoxGroups);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.descriptionLabel);
this.Controls.Add(this.passwordLabel);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.txtDescription);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.txtName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "EditSelectedUser";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Load += new System.EventHandler(this.EditSelectedUser_Load);
this.Shown += new System.EventHandler(this.EditSelectedUser_Shown);
this.ResumeLayout(false);
this.PerformLayout();
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditSelectedUser));
this.txtName = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.txtPassword = new System.Windows.Forms.TextBox();
this.passwordLabel = new System.Windows.Forms.Label();
this.txtDescription = new System.Windows.Forms.TextBox();
this.descriptionLabel = new System.Windows.Forms.Label();
this.checkedListBoxGroups = new System.Windows.Forms.CheckedListBox();
this.groupsLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.repeatPasswordLabel = new System.Windows.Forms.Label();
this.txtRepeatPassword = new System.Windows.Forms.TextBox();
this.codeLabel = new System.Windows.Forms.Label();
this.txtCode = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// txtName
//
resources.ApplyResources(this.txtName, "txtName");
this.txtName.Name = "txtName";
this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
this.txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtName_KeyPress);
this.txtName.Validated += new System.EventHandler(this.txtName_Validated);
//
// nameLabel
//
resources.ApplyResources(this.nameLabel, "nameLabel");
this.nameLabel.Name = "nameLabel";
//
// btnOk
//
resources.ApplyResources(this.btnOk, "btnOk");
this.btnOk.Name = "btnOk";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
resources.ApplyResources(this.btnCancel, "btnCancel");
this.btnCancel.Name = "btnCancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// txtPassword
//
resources.ApplyResources(this.txtPassword, "txtPassword");
this.txtPassword.Name = "txtPassword";
this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
//
// passwordLabel
//
resources.ApplyResources(this.passwordLabel, "passwordLabel");
this.passwordLabel.Name = "passwordLabel";
//
// txtDescription
//
resources.ApplyResources(this.txtDescription, "txtDescription");
this.txtDescription.Name = "txtDescription";
this.txtDescription.TextChanged += new System.EventHandler(this.txtDescription_TextChanged);
this.txtDescription.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtDescription_KeyPress);
//
// descriptionLabel
//
resources.ApplyResources(this.descriptionLabel, "descriptionLabel");
this.descriptionLabel.Name = "descriptionLabel";
//
// checkedListBoxGroups
//
this.checkedListBoxGroups.CheckOnClick = true;
this.checkedListBoxGroups.FormattingEnabled = true;
resources.ApplyResources(this.checkedListBoxGroups, "checkedListBoxGroups");
this.checkedListBoxGroups.Name = "checkedListBoxGroups";
this.checkedListBoxGroups.Click += new System.EventHandler(this.checkedListBoxGroups_Click);
//
// groupsLabel
//
resources.ApplyResources(this.groupsLabel, "groupsLabel");
this.groupsLabel.Name = "groupsLabel";
//
// repeatPasswordLabel
//
resources.ApplyResources(this.repeatPasswordLabel, "repeatPasswordLabel");
this.repeatPasswordLabel.Name = "repeatPasswordLabel";
//
// txtRepeatPassword
//
resources.ApplyResources(this.txtRepeatPassword, "txtRepeatPassword");
this.txtRepeatPassword.Name = "txtRepeatPassword";
this.txtRepeatPassword.TextChanged += new System.EventHandler(this.txtRepeatPassword_TextChanged);
//
// codeLabel
//
resources.ApplyResources(this.codeLabel, "codeLabel");
this.codeLabel.Name = "codeLabel";
//
// txtCode
//
resources.ApplyResources(this.txtCode, "txtCode");
this.txtCode.Name = "txtCode";
this.txtCode.TextChanged += new System.EventHandler(this.txtCode_TextChanged);
//
// EditSelectedUser
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.codeLabel);
this.Controls.Add(this.txtCode);
this.Controls.Add(this.repeatPasswordLabel);
this.Controls.Add(this.txtRepeatPassword);
this.Controls.Add(this.groupsLabel);
this.Controls.Add(this.checkedListBoxGroups);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.descriptionLabel);
this.Controls.Add(this.passwordLabel);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.txtDescription);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.txtName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "EditSelectedUser";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Load += new System.EventHandler(this.EditSelectedUser_Load);
this.Shown += new System.EventHandler(this.EditSelectedUser_Shown);
this.ResumeLayout(false);
this.PerformLayout();
}
@ -163,5 +179,7 @@ namespace Users.Forms
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Label repeatPasswordLabel;
private System.Windows.Forms.TextBox txtRepeatPassword;
private System.Windows.Forms.Label codeLabel;
private System.Windows.Forms.TextBox txtCode;
}
}

View File

@ -29,6 +29,7 @@ namespace Users.Forms
Localize();
txtName.Text = CurrentEditUser.UserName;
txtCode.Text = CurrentEditUser.Number.ToString();
txtDescription.Text = CurrentEditUser.FullName;
txtPassword.Text = "";
txtRepeatPassword.Text = "";
@ -72,8 +73,7 @@ namespace Users.Forms
public bool Save()
{
{
// todo: check if this name is given to another user
if (IsUserNameAllreadyTaken(txtName.Text))
{
@ -81,6 +81,12 @@ namespace Users.Forms
return false;
}
int userCode;
if (!int.TryParse (txtCode.Text, out userCode))
{
MessageBox.Show(Strings.Invalid_code);
return false;
}
if (txtPassword.Text != "")
{
@ -97,6 +103,7 @@ namespace Users.Forms
CurrentEditUser.UserName = txtName.Text;
CurrentEditUser.FullName = txtDescription.Text;
CurrentEditUser.Number = userCode;
// Groups
CurrentEditUser.Groups.Clear();
@ -156,6 +163,9 @@ namespace Users.Forms
{
btnOk.Enabled = false;
if (txtName.Text == "") return;
int userCode;
if (!int.TryParse(txtCode.Text, out userCode)) return;
if (txtPassword.Text != txtRepeatPassword.Text) return;
btnOk.Enabled = true;
}
@ -172,7 +182,6 @@ namespace Users.Forms
private void txtName_KeyPress(object sender, KeyPressEventArgs e)
{
CheckIfFormCanBeSubmitted();
}
private void txtName_TextChanged(object sender, EventArgs e)
@ -185,6 +194,11 @@ namespace Users.Forms
CheckIfFormCanBeSubmitted();
}
private void txtRepeatPassword_TextChanged(object sender, EventArgs e)
{
CheckIfFormCanBeSubmitted();
}
private void txtDescription_TextChanged(object sender, EventArgs e)
{
CheckIfFormCanBeSubmitted();
@ -199,5 +213,10 @@ namespace Users.Forms
{
CheckIfFormCanBeSubmitted();
}
private void txtCode_TextChanged(object sender, EventArgs e)
{
CheckIfFormCanBeSubmitted();
}
}
}

View File

@ -138,7 +138,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtName.ZOrder" xml:space="preserve">
<value>11</value>
<value>13</value>
</data>
<data name="nameLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -165,10 +165,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;nameLabel.ZOrder" xml:space="preserve">
<value>8</value>
<value>10</value>
</data>
<data name="btnOk.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 330</value>
<value>137, 356</value>
</data>
<data name="btnOk.Size" type="System.Drawing.Size, System.Drawing">
<value>84, 40</value>
@ -189,10 +189,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;btnOk.ZOrder" xml:space="preserve">
<value>5</value>
<value>7</value>
</data>
<data name="btnCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>253, 330</value>
<value>253, 356</value>
</data>
<data name="btnCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>84, 40</value>
@ -213,10 +213,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;btnCancel.ZOrder" xml:space="preserve">
<value>4</value>
<value>6</value>
</data>
<data name="txtPassword.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 40</value>
<value>137, 38</value>
</data>
<data name="txtPassword.PasswordChar" type="System.Char, mscorlib" xml:space="preserve">
<value>*</value>
@ -237,13 +237,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtPassword.ZOrder" xml:space="preserve">
<value>10</value>
<value>12</value>
</data>
<data name="passwordLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="passwordLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 43</value>
<value>9, 41</value>
</data>
<data name="passwordLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 13</value>
@ -264,10 +264,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;passwordLabel.ZOrder" xml:space="preserve">
<value>7</value>
<value>9</value>
</data>
<data name="txtDescription.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 99</value>
<value>137, 122</value>
</data>
<data name="txtDescription.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
@ -288,13 +288,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtDescription.ZOrder" xml:space="preserve">
<value>9</value>
<value>11</value>
</data>
<data name="descriptionLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="descriptionLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 102</value>
<value>9, 125</value>
</data>
<data name="descriptionLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 13</value>
@ -315,10 +315,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;descriptionLabel.ZOrder" xml:space="preserve">
<value>6</value>
<value>8</value>
</data>
<data name="checkedListBoxGroups.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 164</value>
<value>137, 190</value>
</data>
<data name="checkedListBoxGroups.Size" type="System.Drawing.Size, System.Drawing">
<value>200, 154</value>
@ -336,13 +336,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;checkedListBoxGroups.ZOrder" xml:space="preserve">
<value>3</value>
<value>5</value>
</data>
<data name="groupsLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="groupsLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 164</value>
<value>9, 190</value>
</data>
<data name="groupsLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>41, 13</value>
@ -363,7 +363,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;groupsLabel.ZOrder" xml:space="preserve">
<value>2</value>
<value>4</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
@ -397,7 +397,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;repeatPasswordLabel.ZOrder" xml:space="preserve">
<value>0</value>
<value>2</value>
</data>
<data name="txtRepeatPassword.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 66</value>
@ -421,6 +421,57 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtRepeatPassword.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="codeLabel.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="codeLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="codeLabel.Location" type="System.Drawing.Point, System.Drawing">
<value>9, 97</value>
</data>
<data name="codeLabel.Size" type="System.Drawing.Size, System.Drawing">
<value>32, 13</value>
</data>
<data name="codeLabel.TabIndex" type="System.Int32, mscorlib">
<value>12</value>
</data>
<data name="codeLabel.Text" xml:space="preserve">
<value>Code</value>
</data>
<data name="&gt;&gt;codeLabel.Name" xml:space="preserve">
<value>codeLabel</value>
</data>
<data name="&gt;&gt;codeLabel.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;codeLabel.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;codeLabel.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="txtCode.Location" type="System.Drawing.Point, System.Drawing">
<value>137, 94</value>
</data>
<data name="txtCode.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 20</value>
</data>
<data name="txtCode.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="&gt;&gt;txtCode.Name" xml:space="preserve">
<value>txtCode</value>
</data>
<data name="&gt;&gt;txtCode.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtCode.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtCode.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@ -430,7 +481,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>375, 383</value>
<value>375, 408</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Edit User</value>

View File

@ -141,6 +141,15 @@ namespace Users.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid user code..
/// </summary>
internal static string Invalid_code {
get {
return ResourceManager.GetString("Invalid_code", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid username or password.
/// </summary>

View File

@ -183,4 +183,7 @@
<data name="User_name" xml:space="preserve">
<value>User name</value>
</data>
<data name="Invalid_code" xml:space="preserve">
<value>Invalid user code.</value>
</data>
</root>