Esempio n. 1
0
 private void ClearBtn_Click(object sender, RoutedEventArgs e)
 {
     //will clear all info if clear button is pressed
     FirstNameTBox.Clear();
     SurnameTBox.Clear();
     SalaryTBox.Clear();
     HoursWorkedTBox.Clear();
     HourlyRateTBox.Clear();
     monthlyPayTxtBlock.Text = String.Empty;
 }
Esempio n. 2
0
        //seleted employee will display their information right
        private void EmployeeLB_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //take list to display from employee , full time and part time to be slected
            Employee         selecetedEmployee = EmployeeLB.SelectedItem as Employee;
            PartTimeEmployee selecetedPartTime = EmployeeLB.SelectedItem as PartTimeEmployee;
            FullTimeEmployee selecetedFullTime = EmployeeLB.SelectedItem as FullTimeEmployee;

            //if a employee is selected
            if (selecetedEmployee != null)
            {
                //takes in first & last names
                FirstNameTBox.Text = selecetedEmployee.FirstName;
                SurnameTBox.Text   = selecetedEmployee.LastName;

                if (selecetedEmployee.Shift == "Full Time")
                {
                    // if full time needs to dispaly salary
                    //clear hours worked and hour rate to not display anything
                    HoursWorkedTBox.Clear();
                    HourlyRateTBox.Clear();

                    //dispaly salary in salaryTBox
                    SalaryTBox.Text = selecetedFullTime.Salary.ToString();
                }
                else
                {
                    // else they will be part time
                    //dont need salary so clear
                    SalaryTBox.Clear();
                    HoursWorkedTBox.Text = selecetedPartTime.HourlyRate.ToString();  //display hours worked
                    HourlyRateTBox.Text  = selecetedPartTime.HoursWorked.ToString(); //display hours rate
                }

                // display Monthly Pay in textblock rounded up
                monthlyPayTxtBlock.Text = Decimal.Round(selecetedEmployee.CalculateMonthlyPay()).ToString();
            }
        }