public void Reset()
 {
     SelectedForecastType = null;
     SelectedProject      = null;
     SelectedCompany      = null;
     SelectedUsers.Clear();
 }
 private void RefreshPolygonUsers()
 {
     if (SelectedPolygon != null)
     {
         if (SelectedPolygon.PolygonTagTypeEquals(PolygonTagType.Hexagon))
         {
             var friends = _layerService.UsersInsidePolygonTagBrief(SelectedPolygon.ExtractPolygonTag().Tag);
             SelectedUsers = new ObservableCollection <UserInfoBriefViewCellModel>(friends);
         }
         else if (SelectedPolygon.PolygonTagTypeEquals(PolygonTagType.Zone))
         {
             //TODO: read friends inside of Zone from webapi
             var friends = _layerService.UsersInsideZone(SelectedPolygon.ExtractPolygonTag().Tag);
             SelectedUsers = new ObservableCollection <UserInfoBriefViewCellModel>(friends);
         }
         else
         {
             SelectedUsers.Clear();
         }
         PolygonUsersVisible = SelectedUsers.Count > 0;
     }
     else
     {
         SelectedUsers.Clear();
         PolygonUsersVisible = false;
     }
 }
Пример #3
0
 private void ResetFilter(object obj)
 {
     _timeEntryFilter  = new TimeEntryFilter();
     BillableOnly      = false;
     Invoiced          = true;
     NotInvoiced       = true;
     HideEmptyProjects = false;
     HideEmptyTasks    = false;
     SelectedUsers.Clear();
     OnPropertyChanged("SelectedUsers");
     OnPropertyChanged("HasConsultants");
     InternalCommands.UserFilterChanged.Execute(null);
 }
        private void InitializeCommands()
        {
            SaveNewUserPresetListCommand = new DelegateCommand <object>(_ =>
            {
                if (SelectedUsers.Count == 0)
                {
                    return;
                }

                var newPreset = new UserListPreset
                {
                    Name       = "<New bookmark>",
                    Users      = new List <ForecastUserDto>(SelectedUsers),
                    IsEditMode = true
                };

                UserListPresets.Insert(0, newPreset);

                SelectedUserListPreset = newPreset;
                UpdateStorage();
            }, x => UserListPresets.All(y => !y.IsEditMode));

            LoadUserPresetListCommand = new DelegateCommand <object>(x =>
            {
                if (SelectedUserListPreset == null)
                {
                    return;
                }

                SelectedUsers.Clear();
                foreach (var forecastUserDto in SelectedUserListPreset.Users)
                {
                    SelectedUsers.Add(forecastUserDto);
                }
            }, x => UserListPresets.All(y => !y.IsEditMode));

            DeletePresetListCommand = new DelegateCommand <object>(x =>
            {
                var toRemove = x as UserListPreset;
                if (x == null)
                {
                    return;
                }
                UserListPresets.Remove(toRemove);
                UpdateStorage();
            }, x => UserListPresets.All(y => !y.IsEditMode));

            DisableEditUsersPresetCommand = new DelegateCommand <object>(x =>
            {
                var usersPreset = x as UserListPreset;
                if (usersPreset == null)
                {
                    return;
                }

                // Name cant be empty
                if (string.IsNullOrEmpty(usersPreset.Name))
                {
                    return;
                }

                usersPreset.IsEditMode = false;

                // Just edited one. Update local storage
                if (!usersPreset.IsEditMode)
                {
                    UpdateStorage();
                }
            }, x =>
            {
                var usersPreset = x as UserListPreset;
                return(usersPreset != null && usersPreset.IsEditMode);
            });

            EnableEditUsersPresetCommand = new DelegateCommand <object>(x =>
            {
                var usersPreset = SelectedUserListPreset;
                if (usersPreset == null)
                {
                    return;
                }

                usersPreset.IsEditMode = true;
            }, x =>
            {
                var usersPreset = SelectedUserListPreset;
                return(usersPreset != null && !usersPreset.IsEditMode);
            });
        }