Ejemplo n.º 1
0
        private void SaveNewEmployee()
        {
            try
            {
                Employee employee = new Employee();

                employee.FirstName   = TxtFirstName.Text;
                employee.LastName    = TxtLastName.Text;
                employee.PhoneNumber = TxtPhoneNumber.Text;

                if (_userManager.AddNewEmployee(employee))
                {
                    MessageBox.Show("Employee Added", "Success", MessageBoxButton.OK);
                }

                if (MessageBox.Show("Would you like add another employee?", "Add Another?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    TxtFirstName.Text   = "";
                    TxtLastName.Text    = "";
                    TxtAddress.Text     = "";
                    TxtState.Text       = "";
                    TxtZipcode.Text     = "";
                    TxtPhoneNumber.Text = "";
                    TxtFirstName.Focus();
                }
                else
                {
                    this.NavigationService.Navigate(new PgAdministration());
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message);
            }
        }