|
@@ -12,6 +12,7 @@ using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Navigation;
|
|
|
using System.Windows.Shapes;
|
|
|
+using LibraryRDK;
|
|
|
|
|
|
namespace PDK_Concert.Pages
|
|
|
{
|
|
@@ -31,24 +32,37 @@ namespace PDK_Concert.Pages
|
|
|
|
|
|
private void save_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- Logined logined = new Logined()
|
|
|
+ if(InputValidation.CheckAuthorization(tbLogin.Text, psPassword.Password))
|
|
|
{
|
|
|
- Login = tbLogin.Text,
|
|
|
- Password = psPassword.Password.GetHashCode()
|
|
|
- };
|
|
|
- Classes.DataBaseClass.connect.Logined.Add(logined);
|
|
|
- Users users = new Users()
|
|
|
- {
|
|
|
- IDUser = logined.ID,
|
|
|
- Name = tbName.Text,
|
|
|
- Surname = tbSurname.Text,
|
|
|
- Patronymic = tbPatronymic.Text,
|
|
|
- Number = tbNunber.Text,
|
|
|
- IDPower=cbPower.SelectedIndex+1,
|
|
|
- IDPost=cbPost.SelectedIndex+1,
|
|
|
- };
|
|
|
- Classes.DataBaseClass.connect.Users.Add(users);
|
|
|
- Classes.DataBaseClass.connect.SaveChanges();
|
|
|
+ if (InputValidation.CheckUsers(tbName.Text, tbSurname.Text, tbPatronymic.Text, tbNunber.Text, cbPower.SelectedIndex, cbPost.SelectedIndex))
|
|
|
+ {
|
|
|
+ if (InputValidation.PatternNumbers(tbNunber.Text))
|
|
|
+ {
|
|
|
+ Logined logined = new Logined()
|
|
|
+ {
|
|
|
+ Login = tbLogin.Text,
|
|
|
+ Password = psPassword.Password.GetHashCode()
|
|
|
+ };
|
|
|
+ Classes.DataBaseClass.connect.Logined.Add(logined);
|
|
|
+ Users users = new Users()
|
|
|
+ {
|
|
|
+ IDUser = logined.ID,
|
|
|
+ Name = tbName.Text,
|
|
|
+ Surname = tbSurname.Text,
|
|
|
+ Patronymic = tbPatronymic.Text,
|
|
|
+ Number = tbNunber.Text,
|
|
|
+ IDPower = cbPower.SelectedIndex + 1,
|
|
|
+ IDPost = cbPost.SelectedIndex + 1,
|
|
|
+ };
|
|
|
+ Classes.DataBaseClass.connect.Users.Add(users);
|
|
|
+ Classes.DataBaseClass.connect.SaveChanges();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show("Вы ввели номер телефона не в том виде!\nВведите в формате 89999999999", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void back_Click(object sender, RoutedEventArgs e)
|