Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Gebruikers
- {
- // FIELDS
- private string _UserName;
- private string _Naam;
- private string _Groep;
- // PROPERTIES
- public string UserName
- {
- get
- {
- return _UserName;
- }
- set
- {
- _UserName = value;
- }
- }
- public string Naam
- {
- get
- {
- return _Naam;
- }
- set
- {
- _Naam = value;
- }
- }
- public string Groep
- {
- get
- {
- return _Groep;
- }
- set
- {
- _Groep = value;
- }
- }
- // CONSTRUCTOR
- public Gebruikers(string username, string naam, string groep)
- {
- _UserName = username;
- _Naam = naam;
- _Groep = groep;
- }
- public Gebruikers()
- {
- }
- public override string ToString()
- {
- return _UserName + " - " + _Naam + " - " + _Groep;
- }
- }
- private void btnAddUser_Click(object sender, EventArgs e)
- {
- string userName = tbxAddUserName.Text;
- try
- {
- if (UserNameCorrect(userName))
- {
- Gebruikers toevoegen = new Gebruikers(tbxAddUserName.Text, tbxAddNameofUser.Text, tbxAddNameofGroup.Text);
- database.AddUser(toevoegen);
- ReloadStatistics();
- LaadUsers();
- }
- else
- {
- MessageBox.Show("De door u ingevoerde gebruikersnaam is niet juist! Zorg dat deze minimaal vier tekens en geen spaties bevat.", "Gebruikersnaam incorrect",
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- catch (Exception exc)
- {
- switch (exc)
- {
- case SqlException _:
- case InvalidOperationException _:
- break;
- default:
- throw;
- }
- MessageBox.Show("De door u ingevoerde gebruiker bestaat al!", "Gebruiker bestaat al",
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
Add Comment
Please, Sign In to add comment