Exemple #1
0
        /*  User Clicks on Staff List
         * */
        private void Staff_List_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Staff_List.SelectedIndex != -1)
            {
                //get employee id from selection and send to list controller to get full details
                Employee item = (Employee)Staff_List.SelectedItem;
                Staff_Details.DataContext = Lists.GetStaffDetails(item.staffid);

                //populate list of units staff member is involved with
                Staff_Details.unitsInvolved = Lists.FilterUnitListByStaffId(Lists.MasterUnitList, item.staffid);

                //populate list of consultation times
                Staff_Details.consultationTimes = database.LoadConsultation(item.staffid);

                //hand the accoiated timetable user control to use with a unit click on the Staff_Details user controll
                Staff_Details.alternative_user_control = Staff_TimeTable;

                //hand it the list controller so it can populate that Unit TimeTable with information.
                Staff_Details.Lists = Lists;

                //Reste the visibiliy of controlls
                Staff_Details.Visibility   = Visibility.Visible;
                Staff_TimeTable.Visibility = Visibility.Collapsed;
            }
            else
            {
                //no selected staff in list so hide staff details
                Staff_Details.Visibility = Visibility.Collapsed;
            }
        }
Exemple #2
0
        private void TimeTable_Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //only execute if the staff members name was clicked is way too hard to impliment...
            // see http://blog.scottlogic.com/2008/12/02/wpf-datagrid-detecting-clicked-cell-and-row.html as to why.
            //so anywhere in the row will triger the event....

            if (TimeTable_Grid.SelectedIndex != -1 && Back_Button.Visibility == Visibility.Collapsed)
            {
                //get selected item
                Classdetails item = (Classdetails)TimeTable_Grid.SelectedItem;
                //populate staff details controll in the units tab
                alternative_user_control.DataContext = Lists.GetStaffDetails(item.staffid);
                //populate list of units staff member is involved with
                alternative_user_control.unitsInvolved = Lists.FilterUnitListByStaffId(Lists.MasterUnitList, item.staffid);
                //populate list of consultation times
                alternative_user_control.consultationTimes = database.LoadConsultation(item.staffid);
                //change the display...
                alternative_user_control.Visibility = Visibility.Visible;
                this.Visibility = Visibility.Collapsed;
                //reset selection so that after clicking back they can click the same unit again for the same result.
                TimeTable_Grid.SelectedIndex = -1;
            }
        }