private void FillDataGrid()
        {
            Favorites = new DataTable("favorites");
            Favorites.Columns.Add("gctype", typeof(String));
            Favorites.Columns.Add("gcdescription", typeof(String));
            Favorites.Columns.Add("gcmscrmid", typeof(String));

            DataRow[] _result = TimeEntryCache.Select("[type]='FAVORITE_" + UserName + "'");
            foreach (DataRow _dr in _result)
            {
                DataRow _nr = Favorites.NewRow();

                _nr["gctype"]        = _dr["subtype"];
                _nr["gcdescription"] = _dr["description"];
                _nr["gcmscrmid"]     = _dr["mscrmid"];

                Favorites.Rows.Add(_nr);
            }

            FavGrid.DataSource      = Favorites;
            FavGrid.IsFilterEnabled = true;
            FavGrid.RefreshData();

            FavGrid.GroupBy(FavGrid.Columns["gctype"], DevExpress.Data.ColumnSortOrder.Ascending);
            FavGrid.ExpandAllGroups();

            if (Favorites.Rows.Count == 0)
            {
                FAVSearchInfo.Content  = rm.GetString("NoEntries");
                btnFAVDelete.IsEnabled = false;
                btnFAVAccept.IsEnabled = false;
            }
            else
            {
                if (Favorites.Rows.Count > 1)
                {
                    FAVSearchInfo.Content = Favorites.Rows.Count.ToString() + rm.GetString("EntriesList");
                }
                else
                {
                    FAVSearchInfo.Content = rm.GetString("AnEntry");
                }
                btnFAVDelete.IsEnabled = true;
                btnFAVAccept.IsEnabled = true;
            }
        }
        private void btnFAVDelete_Click(object sender, RoutedEventArgs e)
        {
            // Aktuellen Eintrag entfernen
            if (FavGrid.GetFocusedRowCellValue("gcmscrmid") != null)
            {
                String  _mscrmid    = FavGrid.GetFocusedRowCellValue("gcmscrmid").ToString().Trim();
                String  _entitytype = FavGrid.GetFocusedRowCellValue("gctype").ToString().Trim();
                DataRow _dr         = null;

                if ((_dr = GetCacheItemByMSCRMID("FAVORITE_" + UserName, _mscrmid)) != null)
                {
                    TimeEntryCache.Rows.Remove(_dr);
                    TimeEntryCache.AcceptChanges();

                    FillDataGrid();
                }
            }
        }
 private void btnFAVAccept_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         String _desc       = FavGrid.GetFocusedRowCellValue("gcdescription").ToString().Trim();
         String _entitytype = FavGrid.GetFocusedRowCellValue("gctype").ToString().Trim();
         if (_desc != "" && _entitytype != "")
         {
             Selected_EntityType = _entitytype;
             Selected_ID         = _desc;
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("btnFAVAccept_Click: " + ex.Message, rm.GetString("ErrorNotification"), MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }