2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
2018-01-24 16:35:09 +00:00
|
|
|
|
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
|
2015-04-15 18:32:56 +00:00
|
|
|
|
///
|
|
|
|
|
|
using System;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-15 11:56:53 +00:00
|
|
|
|
using System.Text;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using NHibernate;
|
2017-03-16 20:53:12 +00:00
|
|
|
|
using Users.Entities;
|
2017-03-15 11:56:53 +00:00
|
|
|
|
using Users.Resources;
|
2018-05-14 15:11:15 +00:00
|
|
|
|
using GemCard;
|
|
|
|
|
|
using System.Drawing;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2017-03-15 11:56:53 +00:00
|
|
|
|
namespace Users.Forms
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
public partial class EditSelectedUser : Form
|
|
|
|
|
|
{
|
2018-01-24 16:35:09 +00:00
|
|
|
|
NHibernate.ISession session;
|
|
|
|
|
|
User user;
|
2020-01-08 12:04:51 +00:00
|
|
|
|
IList<Group> displayedGroups;
|
2019-12-03 19:57:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
bool[] oriGroupMember; /// index is gid, size is Grp.Count
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2018-05-14 15:11:15 +00:00
|
|
|
|
/// Smart card support, card S/N is used as user.Tag
|
|
|
|
|
|
GemCard.CardNative card;
|
|
|
|
|
|
string smartCardReader;
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public EditSelectedUser()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2017-03-15 11:56:53 +00:00
|
|
|
|
this.toolTip1.SetToolTip(this.txtName, string.Format(Strings.max_0_alphanum_chars, 20));
|
2020-01-08 12:04:51 +00:00
|
|
|
|
oriGroupMember = new bool[(displayedGroups != null) ? displayedGroups.Count : 0];
|
2018-05-14 15:11:15 +00:00
|
|
|
|
okBtn.Enabled = false;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-08 12:04:51 +00:00
|
|
|
|
public EditSelectedUser(NHibernate.ISession session, User user, IList<Group> displayedGroups)
|
2018-01-24 16:35:09 +00:00
|
|
|
|
: this()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.session = session;
|
|
|
|
|
|
this.user = user;
|
2020-01-08 12:04:51 +00:00
|
|
|
|
this.displayedGroups = displayedGroups;
|
2019-12-03 19:57:37 +00:00
|
|
|
|
|
2020-01-08 12:04:51 +00:00
|
|
|
|
oriGroupMember = new bool[(displayedGroups != null) ? displayedGroups.Count : 0];
|
2018-01-24 16:35:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
private void EditSelectedUser_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
2015-10-07 19:33:37 +00:00
|
|
|
|
Localize();
|
|
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
txtName.Text = user.UserName;
|
|
|
|
|
|
txtCode.Text = user.Number.ToString();
|
2018-05-14 15:11:15 +00:00
|
|
|
|
txtTag.Text = string.IsNullOrEmpty(user.Tag) ? string.Empty : user.Tag;
|
2018-01-24 16:35:09 +00:00
|
|
|
|
txtDescription.Text = user.FullName;
|
2017-03-17 09:58:05 +00:00
|
|
|
|
txtPassword.Text = string.Empty;
|
|
|
|
|
|
txtRepeatPassword.Text = string.Empty;
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
ShowGroups();
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
|
|
|
|
|
smartCardReader = null; /// null = No smart card reader detected
|
|
|
|
|
|
|
2018-05-17 09:06:07 +00:00
|
|
|
|
try
|
2018-05-14 15:11:15 +00:00
|
|
|
|
{
|
2018-05-17 09:06:07 +00:00
|
|
|
|
card = new CardNative();
|
|
|
|
|
|
|
|
|
|
|
|
/// Find NFC smart card reader
|
2019-08-05 08:30:50 +00:00
|
|
|
|
string[] cardReaders = card.ListReaders();
|
|
|
|
|
|
if (cardReaders != null)
|
2018-05-14 15:11:15 +00:00
|
|
|
|
{
|
2019-08-05 08:30:50 +00:00
|
|
|
|
foreach (var crd in cardReaders)
|
2018-05-17 09:06:07 +00:00
|
|
|
|
{
|
2019-08-05 08:30:50 +00:00
|
|
|
|
if (crd.Contains("NFC"))
|
|
|
|
|
|
{
|
|
|
|
|
|
smartCardReader = crd; /// NFC smart card reader detected
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2018-05-17 09:06:07 +00:00
|
|
|
|
}
|
2018-05-14 15:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-17 09:06:07 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(smartCardReader))
|
2018-05-14 15:11:15 +00:00
|
|
|
|
{
|
2018-05-17 09:06:07 +00:00
|
|
|
|
/// Reader found, initialize NFC smart card reader
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2018-05-17 09:06:07 +00:00
|
|
|
|
card.OnCardInserted += delegate(object sndr, CardInsertedEventArgs args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (InvokeRequired) { Invoke(new EventHandler<CardInsertedEventArgs>(OnCardInserted), sndr, args); }
|
|
|
|
|
|
else OnCardInserted(sndr, args);
|
|
|
|
|
|
};
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2018-05-17 09:06:07 +00:00
|
|
|
|
card.OnCardRemoved += delegate(object sndr, CardRemovedEventArgs args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (InvokeRequired) { Invoke(new EventHandler<CardRemovedEventArgs>(OnCardRemoved), sndr, args); }
|
|
|
|
|
|
else OnCardRemoved(sndr, args);
|
|
|
|
|
|
};
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2018-05-17 09:06:07 +00:00
|
|
|
|
card.StartCardEvents(smartCardReader);
|
|
|
|
|
|
|
|
|
|
|
|
Text += " (NFC)";
|
|
|
|
|
|
txtTag.Enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
smartCardReader = null;
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2015-10-07 19:33:37 +00:00
|
|
|
|
void Localize()
|
|
|
|
|
|
{
|
|
|
|
|
|
Text = Strings.Edit_User;
|
|
|
|
|
|
nameLabel.Text = Strings.Name;
|
|
|
|
|
|
passwordLabel.Text = Strings.Password;
|
2017-03-15 07:11:54 +00:00
|
|
|
|
repeatPasswordLabel.Text = Strings.Repeat_password;
|
2017-03-17 09:58:05 +00:00
|
|
|
|
codeLabel.Text = Strings.User_code;
|
2018-05-14 15:11:15 +00:00
|
|
|
|
tagLabel.Text = Strings.Tag;
|
2015-10-07 19:33:37 +00:00
|
|
|
|
descriptionLabel.Text = Strings.DescriptionColHdr;
|
|
|
|
|
|
groupsLabel.Text = Strings.Groups;
|
2018-05-14 15:11:15 +00:00
|
|
|
|
okBtn.Text = Strings.OkBtnText;
|
|
|
|
|
|
cancelBtn.Text = Strings.CancelBtnText;
|
2015-10-07 19:33:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
public void ShowGroups()
|
|
|
|
|
|
{
|
|
|
|
|
|
checkedListBoxGroups.Items.Clear();
|
2020-01-08 12:04:51 +00:00
|
|
|
|
for (int i= 0; i < displayedGroups.Count; i++)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2020-01-08 12:04:51 +00:00
|
|
|
|
Group group = displayedGroups[i];
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2020-01-08 12:04:51 +00:00
|
|
|
|
bool boolIsMember = oriGroupMember[i] = user.IsMemberOf(group.GID);
|
|
|
|
|
|
checkedListBoxGroups.Items.Add(group.Gid2Str());
|
2018-01-25 12:30:48 +00:00
|
|
|
|
checkedListBoxGroups.SetItemCheckState(i, boolIsMember ? CheckState.Checked : CheckState.Unchecked);
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
private void EditSelectedUser_Shown(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
txtName.Focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2015-12-04 16:17:20 +00:00
|
|
|
|
public bool Save()
|
2018-01-24 16:35:09 +00:00
|
|
|
|
{
|
2014-07-28 07:54:35 +00:00
|
|
|
|
// todo: check if this name is given to another user
|
2018-05-14 15:11:15 +00:00
|
|
|
|
if (IsUserNameAlreadyTaken(txtName.Text))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(Strings.Username_taken);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-14 15:11:15 +00:00
|
|
|
|
if (IsTagAlreadyTaken(txtTag.Text))
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(Strings.Tag_taken);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
ITransaction transaction = session.BeginTransaction();
|
2017-03-17 09:58:05 +00:00
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
try
|
2017-03-17 09:58:05 +00:00
|
|
|
|
{
|
2018-01-24 16:35:09 +00:00
|
|
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
|
|
|
|
|
|
|
|
|
|
user.UserName = txtName.Text;
|
|
|
|
|
|
user.FullName = txtDescription.Text;
|
|
|
|
|
|
user.Number = int.Parse(txtCode.Text);
|
2018-05-14 15:11:15 +00:00
|
|
|
|
user.Tag = string.IsNullOrEmpty(txtTag.Text) ? null : txtTag.Text;
|
2018-01-24 16:35:09 +00:00
|
|
|
|
|
|
|
|
|
|
if (txtPassword.Text != string.Empty)
|
|
|
|
|
|
{
|
2019-09-14 08:44:20 +00:00
|
|
|
|
if (!userHasToChangePasswdCheckBox.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Password will not be changed, therefore it should meet requirements
|
|
|
|
|
|
string explanation;
|
|
|
|
|
|
if (!Entities.User.IsPasswordMeetsRequirements(txtPassword.Text, out explanation))
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Password does not meet requirements
|
|
|
|
|
|
MessageBox.Show(Strings.Password_does_not_meet_requirements + Environment.NewLine + explanation,
|
|
|
|
|
|
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
user.SetPassword(txtPassword.Text);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-09-14 08:44:20 +00:00
|
|
|
|
if (userHasToChangePasswdCheckBox.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
user.LastPwChange = DateTime.MinValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-01-08 12:04:51 +00:00
|
|
|
|
///
|
2018-01-24 16:35:09 +00:00
|
|
|
|
/// Groups
|
2020-01-08 12:04:51 +00:00
|
|
|
|
///
|
2018-01-24 16:35:09 +00:00
|
|
|
|
IList<Group> groups = user.Groups; /// = session.QueryOver<Group>().Where(x => (x.User.Id == user.Id)).List();
|
2020-01-08 12:04:51 +00:00
|
|
|
|
for (int i = 0; i < displayedGroups.Count; i++ )
|
2018-01-24 16:35:09 +00:00
|
|
|
|
{
|
2020-01-08 12:04:51 +00:00
|
|
|
|
Group group = displayedGroups[i];
|
2019-12-03 19:57:37 +00:00
|
|
|
|
bool newIsMember = checkedListBoxGroups.GetItemChecked(i);
|
2018-01-24 16:35:09 +00:00
|
|
|
|
|
2019-12-03 19:57:37 +00:00
|
|
|
|
if (!newIsMember && oriGroupMember[i])
|
2018-01-24 16:35:09 +00:00
|
|
|
|
{
|
2020-01-08 12:04:51 +00:00
|
|
|
|
user.Groups.Remove(group);
|
2018-01-24 16:35:09 +00:00
|
|
|
|
}
|
2019-12-03 19:57:37 +00:00
|
|
|
|
else if (newIsMember && !oriGroupMember[i])
|
2018-01-24 16:35:09 +00:00
|
|
|
|
{
|
2020-01-08 12:04:51 +00:00
|
|
|
|
user.Groups.Add(group);
|
2018-01-24 16:35:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
session.SaveOrUpdate(user);
|
|
|
|
|
|
transaction.Commit();
|
2018-02-01 21:18:48 +00:00
|
|
|
|
session.Flush();
|
|
|
|
|
|
Cursor.Current = Cursors.Default;
|
|
|
|
|
|
return true;
|
2017-03-17 09:58:05 +00:00
|
|
|
|
}
|
2018-01-24 16:35:09 +00:00
|
|
|
|
catch (Exception exc)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-01-24 16:35:09 +00:00
|
|
|
|
transaction.Rollback();
|
|
|
|
|
|
MessageBox.Show(string.Format("{0}{1}{2}", Strings.Save_or_update_user_failed, Environment.NewLine, exc.Message),
|
|
|
|
|
|
Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
2018-02-01 21:18:48 +00:00
|
|
|
|
Cursor.Current = Cursors.Default;
|
|
|
|
|
|
return false;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-03-28 11:03:38 +00:00
|
|
|
|
/// Returns true if the username already exists for another user
|
2014-07-28 07:54:35 +00:00
|
|
|
|
/// </summary>
|
2018-05-14 15:11:15 +00:00
|
|
|
|
private bool IsUserNameAlreadyTaken(string userName)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
/// Have a look on all other users
|
|
|
|
|
|
foreach (var u in User.GetAllUsers(session))
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
if (u.Id != user.Id)
|
2017-03-15 11:56:53 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
// 'u' is other user then the current one
|
|
|
|
|
|
|
|
|
|
|
|
if (u.UserName.ToLower() == userName.ToLower())
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
return true; /// User name is already used by another user
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-03-28 11:03:38 +00:00
|
|
|
|
|
|
|
|
|
|
return false; /// User name is stil free
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-14 15:11:15 +00:00
|
|
|
|
/// <summary>
|
2023-03-28 11:03:38 +00:00
|
|
|
|
/// Returns true if the tag already exists for another user
|
2018-05-14 15:11:15 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
private bool IsTagAlreadyTaken(string tag)
|
|
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
if (string.IsNullOrEmpty(tag)) return false;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2023-03-28 11:03:38 +00:00
|
|
|
|
/// Have a look on all other users
|
|
|
|
|
|
foreach (var u in User.GetAllUsers(session))
|
2018-05-14 15:11:15 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
if (u.Id != this.user.Id)
|
2018-05-14 15:11:15 +00:00
|
|
|
|
{
|
2023-03-28 11:03:38 +00:00
|
|
|
|
// 'u' is other user then the current one
|
|
|
|
|
|
|
|
|
|
|
|
if (u.Tag == tag) return true; /// Tag is already used by another user
|
2018-05-14 15:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-03-28 11:03:38 +00:00
|
|
|
|
|
|
|
|
|
|
return false; /// Tag is stil free
|
2018-05-14 15:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void okBtn_Click(object sender, EventArgs e)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
if (Save())
|
|
|
|
|
|
{
|
2018-02-01 21:18:48 +00:00
|
|
|
|
DialogResult = DialogResult.OK;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-14 15:11:15 +00:00
|
|
|
|
private void cancelBtn_Click(object sender, EventArgs e)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-02-01 21:18:48 +00:00
|
|
|
|
DialogResult = DialogResult.Cancel;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-25 12:30:48 +00:00
|
|
|
|
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(); }
|
2018-01-24 16:35:09 +00:00
|
|
|
|
private void txtDescription_KeyPress(object sender, KeyPressEventArgs e) { UpdateOKButton(); }
|
2018-01-25 12:30:48 +00:00
|
|
|
|
private void checkedListBoxGroups_Click(object sender, EventArgs e) { UpdateOKButton(); }
|
|
|
|
|
|
private void txtCode_TextChanged(object sender, EventArgs e) { UpdateOKButton(); }
|
2017-03-17 09:58:05 +00:00
|
|
|
|
|
2018-01-24 16:35:09 +00:00
|
|
|
|
private void UpdateOKButton()
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2018-01-24 16:35:09 +00:00
|
|
|
|
int userCode;
|
2017-03-17 08:45:39 +00:00
|
|
|
|
|
2018-05-14 15:11:15 +00:00
|
|
|
|
okBtn.Enabled = (txtName.Text != string.Empty)
|
2018-01-24 16:35:09 +00:00
|
|
|
|
&& int.TryParse(txtCode.Text, out userCode)
|
|
|
|
|
|
&& (txtPassword.Text == txtRepeatPassword.Text);
|
2017-03-17 08:45:39 +00:00
|
|
|
|
}
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnCardInserted(object sender, CardInsertedEventArgs args)
|
|
|
|
|
|
{
|
2021-11-10 12:20:39 +00:00
|
|
|
|
string tag = string.Empty;
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
BackColor = Color.Green;
|
|
|
|
|
|
card.Connect(smartCardReader, SHARE.Shared, PROTOCOL.T0orT1);
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2021-11-10 12:20:39 +00:00
|
|
|
|
/// Read the serial number of the card
|
|
|
|
|
|
APDUResponse response = card.Transmit(new APDUCommand(0xFF, 0xCA, 0x00, 0x00, null, 7));
|
|
|
|
|
|
txtTag.Text = response.ToString();
|
2018-05-14 15:11:15 +00:00
|
|
|
|
|
2021-11-10 12:20:39 +00:00
|
|
|
|
card.Disconnect(DISCONNECT.Leave);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
txtTag.Text = string.Empty;
|
|
|
|
|
|
}
|
2018-05-14 15:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnCardRemoved(object sender, CardRemovedEventArgs args)
|
|
|
|
|
|
{
|
|
|
|
|
|
BackColor = SystemColors.Control;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void EditSelectedUser_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(smartCardReader))
|
|
|
|
|
|
{
|
2021-11-10 12:20:39 +00:00
|
|
|
|
try { card.StopCardEvents(); }
|
|
|
|
|
|
catch { }
|
2018-05-14 15:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2014-07-28 07:54:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|