Example #1
0
        private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            UserWraper newUser = new UserWraper();

            String password        = textBoxPass.Password;
            String passwordConfirm = textBoxPassConfirm.Password;

            if (!Validator.ValidPassword(password, passwordConfirm))
            {
                return;
            }

            newUser.Login     = textBoxLogin.Text;
            newUser.Password  = password;
            newUser.Firstname = textBoxFirstname.Text;
            newUser.Surname   = textBoxSurname.Text;
            newUser.Type      = (UserType)ComboBoxType.SelectedItem;

            UsersServiceClient client    = new UsersServiceClient();
            String             sessionId = (String)App.Current.Properties[App.sessionPropertyName];
            int savedQuantity            = client.Save(sessionId, newUser);

            if (savedQuantity > 0)
            {
                StaffDataGrid.ItemsSource = client.FindAll(sessionId);
            }
        }
Example #2
0
        private void StaffGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserWraper selectedUser = (UserWraper)StaffDataGrid.SelectedItem;

            if (selectedUser != null)
            {
                textBoxLogin.Text           = selectedUser.Login;
                textBoxFirstname.Text       = selectedUser.Firstname;
                textBoxSurname.Text         = selectedUser.Surname;
                ComboBoxType.SelectedItem   = selectedUser.Type;
                textBoxPass.Password        = selectedUser.Password;
                textBoxPassConfirm.Password = selectedUser.Password;
            }
        }
Example #3
0
        private void buttonUpdate_Click(object sender, RoutedEventArgs e)
        {
            UserWraper selectedUser = (UserWraper)StaffDataGrid.SelectedItem;

            String password        = textBoxPass.Password;
            String passwordConfirm = textBoxPassConfirm.Password;

            if (!Validator.ValidPassword(password, passwordConfirm))
            {
                return;
            }

            selectedUser.Login     = textBoxLogin.Text;
            selectedUser.Password  = password;
            selectedUser.Firstname = textBoxFirstname.Text;
            selectedUser.Surname   = textBoxSurname.Text;
            selectedUser.Type      = (UserType)ComboBoxType.SelectedItem;

            UsersServiceClient client    = new UsersServiceClient();
            String             sessionId = (String)App.Current.Properties[App.sessionPropertyName];

            client.Save(sessionId, selectedUser);
        }