-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddUserForm.cs
28 lines (26 loc) · 1.06 KB
/
AddUserForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Windows.Forms;
using pctesting.DBService;
namespace pctesting
{
public partial class AddUserForm : Form
{
public AddUserForm()
{
InitializeComponent();
}
private void saveButton_Click(object sender, EventArgs e)
{
DBService.DataServiceClient client = new DataServiceClient();
if (userNameTextBox.Text.Length > 0 && userPasswordTextBox.Text.Length > 0 && client.addUser(userNameTextBox.Text, userPasswordTextBox.Text))
{
MessageBox.Show("Пользователь успешно добавлен", "Пользователь добавлен");
this.Hide();
}
else
{
MessageBox.Show("Возникла ошибка добавления пользователя!\nВозможно, пользователь с таким именем уже существует.", "Ошибка добавления", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}