private void Btn_Employee_Click(object sender, System.Windows.RoutedEventArgs e) { viewEm = new ViewEmployee(); viewEm.Department = Department; viewEm.RoleType = RoleType; if (RoleType == "SalesMan" || RoleType == "Mechanic" || RoleType == "Surbordinate") { viewEm.can_Delete.Visibility = Visibility.Collapsed; _mainFrame.Navigate(viewEm); } else { _mainFrame.Navigate(viewEm); } }
private void Can_AddEmployee_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ViewEmploy = new ViewEmployee(); AddEmploy = new AddEmployee(); ViewEmploy.Employee_page = null; DependencyObject currParent = VisualTreeHelper.GetParent(this); while (currParent != null && ViewEmploy.Employee_page == null) { ViewEmploy.Employee_page = currParent as Frame; currParent = VisualTreeHelper.GetParent(currParent); } if (ViewEmploy.Employee_page != null) { AddEmploy.Department = Department; ViewEmploy.Employee_page.Navigate(AddEmploy); } }
private void can_Submit_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { connect = new CTUConnection(); viewEm = new ViewEmployee(); if (string.IsNullOrEmpty(txt_FirstName.Text)) { MessageBox.Show("Please enter the firstname of the employee"); } else if (string.IsNullOrEmpty(txt_Surname.Text)) { MessageBox.Show("Please enter the surname of the employee"); } else if (string.IsNullOrEmpty(txt_IDnumber.Text) || txt_IDnumber.MaxLength != 13) { MessageBox.Show("Please enter the ID number of the employee"); } else if (string.IsNullOrEmpty(txt_UserName.Text)) { MessageBox.Show("Please enter the username of the employee"); } else if (string.IsNullOrEmpty(txt_Password.Text)) { MessageBox.Show("Please enter the password of the employee"); } else { connect.GetEmployee(txt_UserName.Text, txt_Password.Text, txt_FirstName.Text, txt_Surname.Text, txt_IDnumber.Text, Department, int.Parse(cmbx_Role.SelectedValue.ToString())); connect.SelectEmployee(); viewEm.DGV_Employee.ItemsSource = connect.table.DefaultView; } }