private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     empleats = EmpDB.getLlistaEmpleats();
     dtgEmpleats.ItemsSource   = empleats;
     cmbDept.ItemsSource       = DeptDB.getLlistaDepartaments();
     cmbDept.DisplayMemberPath = "DNom";
 }
        private async void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            NewEmpDialog dialeg = new NewEmpDialog();
            await dialeg.ShowAsync();

            if (dialeg.ClientInserit)
            {
                dtgEmpleats.ItemsSource = EmpDB.getLlistaEmpleats();
            }
        }
        private void Filter_Click(object sender, RoutedEventArgs e)
        {
            string         cognom = txbCognom.Text;
            DateTimeOffset off    = dpkData.Date;
            DateTime       d      = off.DateTime;
            // Recuperem el codi de departament, en el cas que el combo estigui buit, desem un -1.
            int numDept = cmbDept.SelectedItem != null?
                          ((Dept)cmbDept.SelectedItem).DeptNo: EmpDB.SENSE_DEPT;


            dtgEmpleats.ItemsSource = EmpDB.getLlistaEmpleats(cognom, d, numDept);
        }