private void ExecuteUnLoaded() { Close = false; SelectedAgent = null; _SelectedStatut = null; _SelectedService = null; _SelectedEmploi = null; }
public async void Initialize() { ParamGlobaux = _dataService.ParamGlobaux; EnableImprimer = false; oConnection = ClassLibraryProget.DataBase.OpenSqlServer(_dataService.ParamGlobaux.ConnectionString); DureeMaxCDDCourt = Convert.ToInt32(Parametres.RechercherParametres(oConnection, ParamGlobaux.IDEtablissement, "", "Durée maxi CDD court")); oConnection.Close(); IsEnable = true; //Initialisation des listes/////////// SelectedAgent = new AgentModel(); PeriodeCommun = new ObservableCollection <PeriodeModulation>(); var taskAgents = _dataService.GetAgentsContratsAsync(); var taskStatuts = _dataService.GetStatutsAsync(true); var taskServices = _dataService.GetServicesAsync(true); var taskEmplois = _dataService.GetEmploisAsync(true); await Task.WhenAll(taskAgents, taskStatuts, taskServices, taskEmplois); _TousAgents = taskAgents.Result.ToList(); Agents = new ObservableCollection <AgentModel>(_TousAgents.Distinct().OrderBy(a => a.Prenom).OrderBy(a => a.Nom)); Statuts = taskStatuts.Result; Services = taskServices.Result; Emplois = taskEmplois.Result; //On initialise les selections sur la ligne vide _SelectedStatut = Statuts[0]; _SelectedService = Services[0]; _SelectedEmploi = Emplois[0]; SelectAllAgents = false; UpdateListePeriodes(); }
public HistoriqueViewModel() { SelectedStatut = new StatutModel(); LoadMoreCommande = new Command( execute: async() => { _isLoadinMore = true; #region Get data from API /*if (FilterStationDemandes.StartDate != null || FilterStationDemandes.EndDate != null || !string.IsNullOrEmpty(FilterStationDemandes.StatutId)) * { * await GetFilteredDemandes(FilterStationDemandes, _filterCurentPage); * } * else * { * await GetDemandes(_curentPage + 1); * }*/ #endregion #region Get data from Local JSON await GetDemandesJsonData(); #endregion }, canExecute: () => { return(!_isLoadinMore); } ); RefreshCommand = new Command( execute: async() => { _isRefreshing = true; // Get data from API //await GetDemandes(_curentPage); // Get data from Local JSON await GetDemandesJsonData(); }, canExecute: () => { return(!_isRefreshing); } ); FilterCommande = new Command( execute: async() => { return; if ( FilterStationDemandes.StartDate == DateTime.Now.Date && FilterStationDemandes.EndDate == DateTime.Now.Date && string.IsNullOrEmpty(SelectedStatut?.id)) { return; } //if (IsInitValue) return; _isFilterinMore = true; _filterCurentPage = 1; _filterLastPage = 0; if (!string.IsNullOrEmpty(SelectedStatut?.id)) { FilterStationDemandes.StatutId = SelectedStatut.id; } await GetFilteredDemandes(FilterStationDemandes, _filterCurentPage); }, canExecute: () => { return(!_isFilterinMore); } ); CancelFilterCommande = new Command( execute: () => { //IsInitValue = true; SelectedStatut = new StatutModel(); FilterStationDemandes = new FilterStationDemandesModel(); } ); }