public void Save(List <CsCoper_Type_Compte> CompteSpecifiqueRecuToUpdate, List <CsCoper_Type_Compte> CompteSpecifiqueRecuToInserte, List <CsCoper_Type_Compte> CompteSpecifiqueRecuToDelete) { try { InterfaceComptableServiceClient service = new InterfaceComptableServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("InterfaceComptable")); int handler = LoadingManager.BeginLoading("Mise à jour des données ..."); service.SaveCoper_Type_CompteAsync(CompteSpecifiqueRecuToUpdate, CompteSpecifiqueRecuToInserte, CompteSpecifiqueRecuToDelete); service.SaveCoper_Type_CompteCompleted += (er, res) => { try { if (res.Error != null || res.Cancelled) { Message.Show("Erreur dans le traitement des méthode de dectection : " + res.Error.InnerException.ToString(), "Erreur"); } else if (res.Result != null) { if (res.Result > 0) { CsCoper_Type_Compte CompteSpecifique = ListeCompteSpecifique.FirstOrDefault(l => l.PK_ID == 0); if (CompteSpecifique != null) { int index = ListeCompteSpecifique.IndexOf(CompteSpecifique); CompteSpecifique.PK_ID = res.Result; ListeCompteSpecifique[index] = CompteSpecifique; } LoadDatagrid(); } else { Message.Show("Sauvegarde non effectué avec succes,il se peut vos modification n'est pas été pris en conte", "Info"); } } else { Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs", "Erreur"); } LoadingManager.EndLoading(handler); } catch (Exception) { throw; } }; } catch (Exception ex) { throw ex; } }
public void LoadAllCompteSpecifique() { try { InterfaceComptableServiceClient service = new InterfaceComptableServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("InterfaceComptable")); service.RetourneCompteSpecifiqueCompleted += (s, args) => { try { if (args.Cancelled || args.Error != null || args.Result == null) { string error = args.Error.InnerException.ToString(); return; } else if (args.Result != null && args.Result.Count != 0) { args.Result.ForEach(t => ListeCompteSpecifique.Add(t)); LoadDatagrid(); } else { Message.ShowInformation("Une erreur s'est produite, veuillez consultez le journal des erreurs", "Avertissement"); } } catch (Exception ex) { throw ex; } }; service.RetourneCompteSpecifiqueAsync(); } catch (Exception ex) { throw ex; } }
private void LoadDatagrid() { //SessionObject.ListeCompteSpecifique = ListeCompteSpecifique.ToList(); System.Windows.Data.PagedCollectionView view = new System.Windows.Data.PagedCollectionView(ListeCompteSpecifique.OrderBy(r => r.LIBELLE)); dgListeCompteSpecifique.ItemsSource = view; datapager.Source = view; }