public void RetourneBalanceAuxilliaire(string CodeSite, DateTime?dateFin)
 {
     try
     {
         Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient service = new Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("InterfaceComptable"));
         service.RetourneBalanceAuxilliaireCompleted += (s, args) =>
         {
             try
             {
                 prgBar.Visibility = System.Windows.Visibility.Collapsed;
                 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)
                     {
                         List <ServiceInterfaceComptable.CsBalance> lstClient = new List <ServiceInterfaceComptable.CsBalance>();
                         //var lesClient = args.Result.Select(y => new { y.CENTRE, y.CLIENT, y.ORDRE }).OrderBy(o => o.CENTRE).Distinct();
                         //foreach (var item in lesClient)
                         //    lstClient.Add(new ServiceInterfaceComptable.CsBalance() { CENTRE = item.CENTRE, CLIENT = item.CLIENT, ORDRE = item.ORDRE });
                         //int Passage = 0;
                         //string[] tableau = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V" };
                         //while (lstClient.Where(o => o.IsSelect != true).Count() != 0)
                         //{
                         string NomFichier = "BalanceAuxilliaire";
                         //    string NomFichier = "BalanceAuxilliaire" + tableau[Passage];
                         //    List<string> clientSelectionne = lstClient.Where(m => m.IsSelect != true).Take(5000).Select(o => o.CLIENT).ToList();
                         //List<ServiceInterfaceComptable.CsBalance> factureAEditer = args.Result.Where(p => clientSelectionne.Contains(p.CLIENT)).ToList();
                         List <ServiceInterfaceComptable.CsBalance> factureAEditer = args.Result.ToList();
                         Dictionary <string, string> param = new Dictionary <string, string>();
                         param.Add("AnneFin", dateFin.Value.Year.ToString());
                         if (this.chk_Excel.IsChecked == true)
                         {
                             Utility.ActionExportation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(factureAEditer, param, NomFichier, SessionObject.CheminImpression, "BalanceAuxilliaire", "InterfaceComptable", true, "xlsx");
                         }
                         else
                         {
                             Utility.ActionDirectOrientation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(factureAEditer, param, SessionObject.CheminImpression, "BalanceAuxilliaire", "InterfaceComptable", false);
                         }
                         //    lstClient.Where(p => clientSelectionne.Contains(p.CLIENT)).ToList().ForEach(p => p.IsSelect = true);
                         //    Passage++;
                         //}
                     }
                     else
                     {
                         Message.ShowInformation("Le système n'a trouvé aucun Compte spécifique dans la base de données ", "Avertissement");
                     }
                 }
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
             }
         };
         service.RetourneBalanceAuxilliaireAsync(CodeSite, dateFin);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public void RetourneBalanceAuxilliaire(string CodeSite, DateTime?dateFin)
 {
     try
     {
         Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient service = new Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("InterfaceComptable"));
         service.RetourneBalanceAuxilliaireCompleted += (s, args) =>
         {
             try
             {
                 prgBar.Visibility = System.Windows.Visibility.Collapsed;
                 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)
                     {
                         List <ServiceInterfaceComptable.CsBalance> lstClient = new List <ServiceInterfaceComptable.CsBalance>();
                         var lesClient = args.Result.Select(y => new { y.FK_IDCLIENT, y.LIBELLECATEGORIE }).OrderBy(o => o.LIBELLECATEGORIE).Distinct();
                         foreach (var item in lesClient)
                         {
                             lstClient.Add(new ServiceInterfaceComptable.CsBalance()
                             {
                                 FK_IDCLIENT = item.FK_IDCLIENT
                             });
                         }
                         int      Passage = 0;
                         string[] tableau = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ" };
                         while (lstClient.Where(o => o.IsSelect != true).Count() != 0)
                         {
                             string     NomFichier        = "BalanceAuxilliaire" + tableau[Passage];
                             List <int> clientSelectionne = lstClient.Where(m => m.IsSelect != true).OrderBy(l => l.CATEGORIE).Take(750).Select(o => o.FK_IDCLIENT).ToList();
                             List <ServiceInterfaceComptable.CsBalance> factureAEditer = args.Result.Where(p => clientSelectionne.Contains(p.FK_IDCLIENT)).ToList();
                             if (this.chk_Excel.IsChecked == true)
                             {
                                 Utility.ActionExportation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(factureAEditer, null, NomFichier, SessionObject.CheminImpression, "BalanceAuxilliaire", "InterfaceComptable", true, "xlsx");
                             }
                             else
                             {
                                 Utility.ActionDirectOrientation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(factureAEditer, null, SessionObject.CheminImpression, "BalanceAuxilliaire", "InterfaceComptable", false);
                             }
                             lstClient.Where(p => clientSelectionne.Contains(p.FK_IDCLIENT)).ToList().ForEach(p => p.IsSelect = true);
                             Thread.Sleep(120);
                             Passage++;
                         }
                     }
                     else
                     {
                         Message.ShowInformation("Le système n'a trouvé aucun Compte spécifique dans la base de données ", "Avertissement");
                     }
                 }
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
             }
         };
         service.RetourneBalanceAuxilliaireAsync(CodeSite, dateFin);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void RetourneBalanceAgee(string CodeSite, DateTime?dateFin)
 {
     try
     {
         Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient service = new Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("InterfaceComptable"));
         service.RetourneBalanceAgeeCompleted += (s, args) =>
         {
             try
             {
                 prgBar.Visibility = System.Windows.Visibility.Collapsed;
                 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)
                     {
                         if (chk_Excel.IsChecked == true)
                         {
                             Utility.ActionExportation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(args.Result, param, string.Empty, SessionObject.CheminImpression, "BalanceAgee", "InterfaceComptable", true, "xlsx");
                         }
                         else
                         {
                             Utility.ActionDirectOrientation <ServicePrintings.CsBalance, ServiceInterfaceComptable.CsBalance>(args.Result, param, SessionObject.CheminImpression, "BalanceAgee", "InterfaceComptable", false);
                         }
                     }
                     else
                     {
                         Message.ShowInformation("Aucune donnée trouvée ", "Balance");
                     }
                 }
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
             }
         };
         service.RetourneBalanceAgeeAsync(CodeSite, dateFin);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void RetourneOperationCompte()
 {
     try
     {
         Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient service = new Galatee.Silverlight.ServiceInterfaceComptable.InterfaceComptableServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("InterfaceComptable"));
         service.RetourneOperationComptableCompleted += (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)
                     {
                         ListeOperationComptable = new List <ServiceInterfaceComptable.CsOperationComptable>();
                         ListeOperationComptable = args.Result;
                     }
                     else
                     {
                         Message.ShowInformation("Le système n'a trouvé aucun Compte spécifique dans la base de données ", "Avertissement");
                     }
                 }
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
             }
         };
         service.RetourneOperationComptableAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }