예제 #1
0
        private void backButton_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();

            LoginedWindows loginedWindows = new LoginedWindows(this.userService, this.mainWindow);

            loginedWindows.Show();
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                try
                {
                    if (loginTextBox.Text.Length == 0)
                    {
                        throw new ArgumentException("Логин не может быть пустым.");
                    }
                    else if (!this.userService.IsUserExists(loginTextBox.Text))
                    {
                        throw new ArgumentException("Пользователь с таким логином не существует.");
                    }
                }
                catch (IndexOutOfRangeException)
                {
                }

                UserValidation.LoginValidation(loginTextBox.Text, passwordTextBox.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            try
            {
                string statusString = this.userService.AuthorizationUser(loginTextBox.Text, passwordTextBox.Text);

                if (statusString == "Blocked")
                {
                    MessageBox.Show("Пользователь заблокирован.");
                    return;
                }
                else if (statusString == "Deleted")
                {
                    MessageBox.Show("Пользователь заблокирован.");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Неверный пароль.");
                return;
            }

            loginTextBox.Text    = string.Empty;
            passwordTextBox.Text = string.Empty;

            this.Hide();

            LoginedWindows loginedWindows = new LoginedWindows(this.userService, this);

            loginedWindows.Show();
        }
예제 #3
0
        private void registerButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                try
                {
                    if (loginTextBox.Text.Length == 0)
                    {
                        throw new ArgumentException("Логин не может быть пустым.");
                    }
                    else if (this.userService.IsUserExists(loginTextBox.Text))
                    {
                        throw new ArgumentException("Пользователь с таким логином уже существует.");
                    }
                }
                catch (IndexOutOfRangeException)
                {
                }

                UserValidation.RegistrationValidation(name1TextBox.Text, name2TextBox.Text, name3TextBox.Text, passportSeriaTextBox.Text, passportNumberTextBox.Text, issuedByTextBox.Text,
                                                      date5TextBox.Text, identNumberTextBox.Text, sexComboBox.SelectedIndex + 1, houseTextBox.Text, housingTextBox.Text, flatTextBox.Text, zipCodeTextBox.Text, phoneNumberTextBox.Text,
                                                      emailTextBox.Text, regionTextBox.Text, districtTextBox.Text, townTypeComboBox.SelectedIndex + 1, townTextBox.Text, streetTypeComboBox.SelectedIndex + 1,
                                                      streetTextBox.Text, loginTextBox.Text, passwordTextBox.Text);

                if (housingTextBox.Text.Length == 0)
                {
                    housingTextBox.Text = "0";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            try
            {
                this.userService.RegistrationUser(name1TextBox.Text, name2TextBox.Text, name3TextBox.Text, passportSeriaTextBox.Text, Convert.ToInt32(passportNumberTextBox.Text), issuedByTextBox.Text,
                                                  date5TextBox.Text, identNumberTextBox.Text, sexComboBox.SelectedIndex + 1, houseTextBox.Text, Convert.ToInt32(housingTextBox.Text), flatTextBox.Text, Convert.ToInt32(zipCodeTextBox.Text), Convert.ToInt64(phoneNumberTextBox.Text),
                                                  emailTextBox.Text, regionTextBox.Text, districtTextBox.Text, townTypeComboBox.SelectedIndex + 1, townTextBox.Text, streetTypeComboBox.SelectedIndex + 1,
                                                  streetTextBox.Text, loginTextBox.Text, passwordTextBox.Text);
            }
            catch (Exception)
            {
                return;
            }

            this.Hide();

            LoginedWindows loginedWindows = new LoginedWindows(this.userService, this.mainWindow);

            loginedWindows.Show();
        }
예제 #4
0
        private void updateClick_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                UserValidation.RegistrationValidation(name1TextBox.Text, name2TextBox.Text, name3TextBox.Text, passportSeriaTextBox.Text, passportNumberTextBox.Text, issuedByTextBox.Text,
                                                      date5TextBox.Text, identNumberTextBox.Text, sexComboBox.SelectedIndex + 1, houseTextBox.Text, housingTextBox.Text, flatTextBox.Text, zipCodeTextBox.Text, phoneNumberTextBox.Text,
                                                      emailTextBox.Text, regionTextBox.Text, districtTextBox.Text, townTypeComboBox.SelectedIndex + 1, townTextBox.Text, streetTypeComboBox.SelectedIndex + 1,
                                                      streetTextBox.Text, "1", "1");

                if (housingTextBox.Text.Length == 0)
                {
                    housingTextBox.Text = "0";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            try
            {
                this.userService.UpdateUser(name1TextBox.Text, name2TextBox.Text, name3TextBox.Text, passportSeriaTextBox.Text, Convert.ToInt32(passportNumberTextBox.Text), issuedByTextBox.Text,
                                            date5TextBox.Text, identNumberTextBox.Text, sexComboBox.SelectedIndex + 1, houseTextBox.Text, Convert.ToInt32(housingTextBox.Text), flatTextBox.Text, Convert.ToInt32(zipCodeTextBox.Text), Convert.ToInt64(phoneNumberTextBox.Text),
                                            emailTextBox.Text, regionTextBox.Text, districtTextBox.Text, townTypeComboBox.SelectedIndex + 1, townTextBox.Text, streetTypeComboBox.SelectedIndex + 1,
                                            streetTextBox.Text, this.userService.AuthorizedUser);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            this.Hide();

            LoginedWindows loginedWindows = new LoginedWindows(this.userService, this.mainWindow);

            loginedWindows.Show();
        }