コード例 #1
0
        private void Save(object sender, RoutedEventArgs e)
        {
            employeeInfo_SaveButton.Focus();  //This is to lose focus on the last text field as data binding will not grab the last piece of data because textchanged is not fired off until focus is lost

            if (string.IsNullOrEmpty(employeeCb.Text) || string.IsNullOrEmpty(specialtyCb.Text))
            {
                MessageBox.Show("No value is selected for the employee type or specialty type");
            }
            else if (string.IsNullOrEmpty(lastNameTb.Text) || string.IsNullOrEmpty(firstNameTb.Text))
            {
                MessageBox.Show("No value is entered for the first name or the last name");
            }
            else
            {
                if (_isNewEmployee)
                    employee.Insert();
                else
                    employee.Update();

                Content = new UserControl_EmployeesView();
            }
        }
コード例 #2
0
 private void Cancel(object sender, RoutedEventArgs e)
 {
     Content = new UserControl_EmployeesView();  //This needs to be cleaned up so that rather than creating a new instance of a control
     //it should find an old instance that called it.
 }