Exemplo n.º 1
0
        //string orderby = "";

        public void UpdateListView()
        {
            DbOperations db = new DbOperations();

            if (radioButtonID.IsChecked == true)
            {
                //orderby = "staff_id";
                try
                {
                    listViewStaffs.ItemsSource = null;
                    listViewStaffs.ItemsSource = db.GetAllStaff();
                }
                catch (PostgresException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (radioButtonFname.IsChecked == true)
            {
                //orderby = "firstname";
                try
                {
                    listViewStaffs.ItemsSource = null;
                    listViewStaffs.ItemsSource = db.GetAllStaffOrderByFirstname();
                }
                catch (PostgresException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (radioButtonLname.IsChecked == true)
            {
                //orderby = "lastname";
                try
                {
                    listViewStaffs.ItemsSource = null;
                    listViewStaffs.ItemsSource = db.GetAllStaffOrderByLastname();
                }
                catch (PostgresException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            else if (radioButtonProfession.IsChecked == true)
            {
                try
                {
                    listViewStaffs.ItemsSource = null;
                    listViewStaffs.ItemsSource = db.GetAllStaffOrderByProfession();
                }
                catch (PostgresException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            else if (radioButtonSection.IsChecked == true)
            {
                try
                {
                    listViewStaffs.ItemsSource = null;
                    listViewStaffs.ItemsSource = db.GetAllStaffOrderBySection();
                }
                catch (PostgresException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }