/// <summary>
        /// Event intepretuje wybrany rekord z SearchEmpList DataGrid i otwiera wybranego pracownika w stronie EmployePage.
        /// </summary>
        private void EmpDataGridSearchRowClick(object sender, MouseButtonEventArgs e)
        {
            var txt = (e.OriginalSource as TextBlock).Text;

            if (txt != null)
            {
                int ID;
                if (!int.TryParse(txt, out ID))
                {
                    var row = sender as DataGridRow;

                    var cell = DataGridTools.GetCell(SearchEmpList, row, 1);
                    cell.IsEnabled = false;

                    ID = int.Parse((cell.Content as TextBlock).Text);
                }

                SearchEmpList.Visibility = Visibility.Collapsed;
                var empPage = new EmployePage(ID);
                var window  = (Window)this.Parent;
                window.Content = empPage;
            }
        }
Example #2
0
        /// <summary>
        /// Event intepretuje wybrany rekord z SearchEmpList DataGrid i zapisuje wybraną klase do zmiennej.
        /// </summary>
        private void EmpDataGridSearchRowClick(object sender, MouseButtonEventArgs e)
        {
            var txt = (e.OriginalSource as TextBlock).Text;

            if (txt != null)
            {
                int ID;
                if (!int.TryParse(txt, out ID))
                {
                    var row = sender as DataGridRow;

                    var cell = DataGridTools.GetCell(SearchEmpList, row, 1);
                    cell.IsEnabled = false;

                    ID = int.Parse((cell.Content as TextBlock).Text);
                }

                SearchEmpList.Visibility = Visibility.Collapsed;
                currentEmployer          = context.Employees.Find(ID);
                employerChecked          = true;
                empTextBlock.Text        = currentEmployer.FirstName + " " + currentEmployer.LastName;
            }
        }
        /// <summary>
        /// Event intepretuje wybrany rekord z SearchClassList DataGrid i zapisuje wybraną klase do zmiennej.
        /// </summary>
        private void ClassDataGridSearchRowClick(object sender, MouseButtonEventArgs e)
        {
            var txt = (e.OriginalSource as TextBlock).Text.ToLower();

            if (txt != null)
            {
                int ID;
                if (!int.TryParse(txt, out ID))
                {
                    var row = sender as DataGridRow;

                    var cell = DataGridTools.GetCell(SearchClassList, row, 1);
                    cell.IsEnabled = false;

                    ID = int.Parse((cell.Content as TextBlock).Text);
                }

                SearchClassList.Visibility = Visibility.Collapsed;
                roomClass         = context.RoomsClass.Find(ID);
                classChecked      = true;
                classTextBox.Text = roomClass.ClassName;
            }
        }