public NewEmployeePopup(StaffScreen staffScreen, Staff existingStaffToEdit = null) { InitializeComponent(); initiazeDBConnection(); titles = getTitles(); titleChoicesCB.ItemsSource = titles; ss = staffScreen; staffToEdit = existingStaffToEdit; if (staffToEdit != null) { firstNameBox.Text = staffToEdit.FirstName; lastNameBox.Text = staffToEdit.LastName; phoneBox.Text = staffToEdit.Phone; System.Diagnostics.Debug.WriteLine("Title: " + staffToEdit.Title.Title1); Title matchingTitle = titles.Where((thisTitle) => thisTitle.Title1 == staffToEdit.Title.Title1).First(); int titleIndex = titleChoicesCB.Items.IndexOf(matchingTitle); System.Diagnostics.Debug.WriteLine("title indedx: " + titleIndex); titleChoicesCB.SelectedIndex = titleIndex; rateField.Text = staffToEdit.Rate.ToString(); } }
public NewAvailSchedPopup(Staff chosenStaff, DateTime thisDate, StaffScreen ss) { InitializeComponent(); initializeDBConnection(); thisStaff = chosenStaff; parentStaffScreen = ss; //prepare the new availability item, in case the user chooses to make a new one newAvailability.StaffId = thisStaff.Id; //disable scheduleing until an availability is chosen. NewSchedETCB.IsEnabled = false; NewSchedSTCB.IsEnabled = false; //set the date picker, setting the date picker will also load the availabilties. ChosenDateDP.SelectedDate = thisDate; ChosenDateDP.DisplayDate = thisDate; }