void GetData() { // desactivation du treeview des modules OKButton.IsEnabled = false; try { AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration")); client.SELECT_All_FonctionCompleted += (ss, res) => { try { if (res.Cancelled || res.Error != null) { string error = res.Error.Message; Message.ShowError(error, Langue.errorTitle); return; } if (res.Result == null || res.Result.Count == 0) { Message.ShowInformation(Langue.msgNodata, Langue.informationTitle); return; } SessionObject.ListeFonction = res.Result; //DonnnesProfils.AddRange(res.Result); cbo_profile.ItemsSource = res.Result.OrderBy(t => t.ROLENAME); cbo_profile.SelectedValuePath = "CODE"; cbo_profile.DisplayMemberPath = "ROLENAME"; RetourneProgramme(); } catch (Exception ex) { Message.ShowError(ex.Message, Langue.informationTitle); } }; client.SELECT_All_FonctionAsync(); } catch (Exception ex) { throw ex; } }
void GetData() { // desactivation du treeview des modules try { if (SessionObject.ListeFonction != null && SessionObject.ListeFonction.Count != 0) { DonnnesProfils.Add(new CsFonction() { CODE = null, ROLENAME = "Tous les métiers" }); DonnnesProfils.AddRange(SessionObject.ListeFonction); cbo_profile.ItemsSource = DonnnesProfils; cbo_profile.SelectedValuePath = "CODE"; cbo_profile.DisplayMemberPath = "ROLENAME"; } else { AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration")); client.SELECT_All_FonctionCompleted += (ss, res) => { try { if (res.Cancelled || res.Error != null) { string error = res.Error.Message; Message.ShowError(error, "Erreur de donnée"); return; } if (res.Result == null || res.Result.Count == 0) { Message.ShowInformation("Aucune données trouvé", "Information"); return; } SessionObject.ListeFonction = res.Result; DonnnesProfils.Add(new CsFonction() { CODE = null, ROLENAME = "Tous les métiers" }); DonnnesProfils.AddRange(res.Result); cbo_profile.ItemsSource = DonnnesProfils; cbo_profile.SelectedValuePath = "CODE"; cbo_profile.DisplayMemberPath = "ROLENAME"; } catch (Exception ex) { Message.ShowError(ex.Message, "Information"); } }; client.SELECT_All_FonctionAsync(); } } catch (Exception ex) { throw ex; } }