More users management changes : Localization of user groups.
This commit is contained in:
@@ -67,16 +67,8 @@ namespace Users.Forms
|
||||
|
||||
bool boolIsMember = oriGroupMember[i] = user.IsMemberOf((Grp.GID)group.Gid);
|
||||
|
||||
if (boolIsMember == true)
|
||||
{
|
||||
checkedListBoxGroups.Items.Add(group.Name);
|
||||
checkedListBoxGroups.SetItemCheckState(i, CheckState.Checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkedListBoxGroups.Items.Add(group.Name);
|
||||
checkedListBoxGroups.SetItemCheckState(i, CheckState.Unchecked);
|
||||
}
|
||||
checkedListBoxGroups.Items.Add(Grp.Gid2Str(i));
|
||||
checkedListBoxGroups.SetItemCheckState(i, boolIsMember ? CheckState.Checked : CheckState.Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,15 +182,15 @@ namespace Users.Forms
|
||||
}
|
||||
|
||||
|
||||
private void txtName_Validated(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtName_KeyPress(object sender, KeyPressEventArgs e) { UpdateOKButton(); }
|
||||
private void txtName_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtPassword_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtRepeatPassword_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtDescription_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtName_Validated(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtName_KeyPress(object sender, KeyPressEventArgs e) { UpdateOKButton(); }
|
||||
private void txtName_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtPassword_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtRepeatPassword_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtDescription_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtDescription_KeyPress(object sender, KeyPressEventArgs e) { UpdateOKButton(); }
|
||||
private void checkedListBoxGroups_Click(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtCode_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void checkedListBoxGroups_Click(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
private void txtCode_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
||||
|
||||
private void UpdateOKButton()
|
||||
{
|
||||
|
||||
@@ -60,13 +60,21 @@ namespace Users.Forms
|
||||
foreach (User u in ListOfUsers)
|
||||
{
|
||||
string grps = string.Empty;
|
||||
if (u.IsMemberOf(Grp.GID.Administrators)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "administrátor"; }
|
||||
if (u.IsMemberOf(Grp.GID.HeadOfLab)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "vedúci"; }
|
||||
if (u.IsMemberOf(Grp.GID.Metrologists)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "metrológ"; }
|
||||
if (u.IsMemberOf(Grp.GID.CalibrationSpecialists)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "môže kalibrovať"; }
|
||||
if (u.IsMemberOf(Grp.GID.TestingSpecialists)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "špecialista"; }
|
||||
if (u.IsMemberOf(Grp.GID.MaintenanceSpecialists)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "údržbár"; }
|
||||
if (u.IsMemberOf(Grp.GID.Testers)) { if (!string.IsNullOrEmpty(grps)) { grps += ", "; } grps += "tester"; }
|
||||
///
|
||||
foreach (var gid in new Grp.GID[] { Grp.GID.Administrators,
|
||||
Grp.GID.HeadOfLab,
|
||||
Grp.GID.Metrologists,
|
||||
Grp.GID.CalibrationSpecialists,
|
||||
Grp.GID.TestingSpecialists,
|
||||
Grp.GID.TestingSpecialists,
|
||||
Grp.GID.Testers })
|
||||
{
|
||||
if (u.IsMemberOf(gid))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(grps)) grps += ", ";
|
||||
grps += Grp.Gid2Str(gid);
|
||||
}
|
||||
}
|
||||
|
||||
ListViewItem item = new ListViewItem(u.UserName);
|
||||
item.SubItems.Add(u.Number.ToString());
|
||||
@@ -152,7 +160,7 @@ namespace Users.Forms
|
||||
try
|
||||
{
|
||||
///
|
||||
/// Read remote users
|
||||
/// Remote DB session, read remote users
|
||||
///
|
||||
DB.DbType = GlobalData.RemoteUsersDB.DbType;
|
||||
DB.ConnectionString = GlobalData.RemoteUsersDB.ConnectionString;
|
||||
@@ -161,23 +169,23 @@ namespace Users.Forms
|
||||
IList<Group> remoteGroups = session.QueryOver<Group>().List();
|
||||
|
||||
///
|
||||
/// Delete all local users
|
||||
/// Local DB session
|
||||
///
|
||||
DB.DbType = GlobalData.LocalUsersDB.DbType;
|
||||
DB.ConnectionString = GlobalData.LocalUsersDB.ConnectionString;
|
||||
session = DB.CreateSession();
|
||||
|
||||
///
|
||||
/// Delete all local users
|
||||
///
|
||||
IList<User> users = session.QueryOver<User>().List();
|
||||
foreach (var user in users) DB.DeleteObject(session, user);
|
||||
foreach (var user in users) session.Delete(user);
|
||||
IList<Group> groups = session.QueryOver<Group>().List();
|
||||
foreach (var group in groups) DB.DeleteObject(session, group);
|
||||
session.Flush();
|
||||
foreach (var group in groups) session.Delete(group);
|
||||
|
||||
///
|
||||
/// Save all remote users to the local DB
|
||||
///
|
||||
DB.DbType = GlobalData.LocalUsersDB.DbType;
|
||||
DB.ConnectionString = GlobalData.LocalUsersDB.ConnectionString;
|
||||
session = DB.CreateSession();
|
||||
IList<User> newUsers = session.QueryOver<User>().List();
|
||||
IList<Group> newGroups = session.QueryOver<Group>().List();
|
||||
foreach (var user in remoteUsers)
|
||||
|
||||
+23
-2
@@ -4,10 +4,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using Users.Entities;
|
||||
using NHibernate;
|
||||
using FluentNHibernate;
|
||||
using Users.Entities;
|
||||
using Users.Resources;
|
||||
|
||||
namespace Users
|
||||
{
|
||||
@@ -37,6 +37,27 @@ namespace Users
|
||||
Invalid = -1, // Not a GroupID, indicates a variable has not been properly set so far
|
||||
}
|
||||
|
||||
public static string Gid2Str(int gid)
|
||||
{
|
||||
return Gid2Str((GID)gid);
|
||||
}
|
||||
|
||||
public static string Gid2Str(GID gid)
|
||||
{
|
||||
switch (gid)
|
||||
{
|
||||
case GID.Testers: return Strings.tester;
|
||||
case GID.TestingSpecialists: return Strings.specialist;
|
||||
case GID.HeadOfLab: return Strings.head_of_lab;
|
||||
case GID.MaintenanceSpecialists: return Strings.maintenance;
|
||||
case GID.Metrologists: return Strings.metrologist;
|
||||
case GID.CalibrationSpecialists: return Strings.calibration_specialist;
|
||||
case GID.Administrators: return Strings.administrator;
|
||||
default: return Strings.invalid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Number of groups.
|
||||
/// </summary>
|
||||
|
||||
Generated
+72
@@ -69,6 +69,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to administrator.
|
||||
/// </summary>
|
||||
internal static string administrator {
|
||||
get {
|
||||
return ResourceManager.GetString("administrator", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Are you sure?.
|
||||
/// </summary>
|
||||
@@ -78,6 +87,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to calibration specialist.
|
||||
/// </summary>
|
||||
internal static string calibration_specialist {
|
||||
get {
|
||||
return ResourceManager.GetString("calibration_specialist", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel.
|
||||
/// </summary>
|
||||
@@ -168,6 +186,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to head of lab..
|
||||
/// </summary>
|
||||
internal static string head_of_lab {
|
||||
get {
|
||||
return ResourceManager.GetString("head_of_lab", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ID.
|
||||
/// </summary>
|
||||
@@ -177,6 +204,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to invalid.
|
||||
/// </summary>
|
||||
internal static string invalid {
|
||||
get {
|
||||
return ResourceManager.GetString("invalid", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Invalid username or password.
|
||||
/// </summary>
|
||||
@@ -186,6 +222,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to maintenance.
|
||||
/// </summary>
|
||||
internal static string maintenance {
|
||||
get {
|
||||
return ResourceManager.GetString("maintenance", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to (max. {0} alphanumeric characters).
|
||||
/// </summary>
|
||||
@@ -195,6 +240,15 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to metrologist.
|
||||
/// </summary>
|
||||
internal static string metrologist {
|
||||
get {
|
||||
return ResourceManager.GetString("metrologist", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0} users copied.
|
||||
/// </summary>
|
||||
@@ -267,6 +321,24 @@ namespace Users.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to specialist.
|
||||
/// </summary>
|
||||
internal static string specialist {
|
||||
get {
|
||||
return ResourceManager.GetString("specialist", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to tester.
|
||||
/// </summary>
|
||||
internal static string tester {
|
||||
get {
|
||||
return ResourceManager.GetString("tester", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User code.
|
||||
/// </summary>
|
||||
|
||||
@@ -192,4 +192,28 @@
|
||||
<data name="Warning" xml:space="preserve">
|
||||
<value>Varování</value>
|
||||
</data>
|
||||
<data name="administrator" xml:space="preserve">
|
||||
<value>administrátor</value>
|
||||
</data>
|
||||
<data name="calibration_specialist" xml:space="preserve">
|
||||
<value>může kalibrovat</value>
|
||||
</data>
|
||||
<data name="head_of_lab" xml:space="preserve">
|
||||
<value>vedoucí</value>
|
||||
</data>
|
||||
<data name="maintenance" xml:space="preserve">
|
||||
<value>úderžbář</value>
|
||||
</data>
|
||||
<data name="metrologist" xml:space="preserve">
|
||||
<value>metrológ</value>
|
||||
</data>
|
||||
<data name="specialist" xml:space="preserve">
|
||||
<value>specialista</value>
|
||||
</data>
|
||||
<data name="tester" xml:space="preserve">
|
||||
<value>tester</value>
|
||||
</data>
|
||||
<data name="invalid" xml:space="preserve">
|
||||
<value>neplatný</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -204,4 +204,28 @@
|
||||
<data name="Save_or_update_user_failed" xml:space="preserve">
|
||||
<value>Save or update user failed</value>
|
||||
</data>
|
||||
<data name="administrator" xml:space="preserve">
|
||||
<value>administrator</value>
|
||||
</data>
|
||||
<data name="calibration_specialist" xml:space="preserve">
|
||||
<value>calibration specialist</value>
|
||||
</data>
|
||||
<data name="head_of_lab" xml:space="preserve">
|
||||
<value>head of lab.</value>
|
||||
</data>
|
||||
<data name="maintenance" xml:space="preserve">
|
||||
<value>maintenance</value>
|
||||
</data>
|
||||
<data name="metrologist" xml:space="preserve">
|
||||
<value>metrologist</value>
|
||||
</data>
|
||||
<data name="specialist" xml:space="preserve">
|
||||
<value>specialist</value>
|
||||
</data>
|
||||
<data name="tester" xml:space="preserve">
|
||||
<value>tester</value>
|
||||
</data>
|
||||
<data name="invalid" xml:space="preserve">
|
||||
<value>invalid</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user