public void LoadCas() { List <Galatee.Silverlight.ServiceFacturation.CsCasind> ListDesCasDuLot = new List <Galatee.Silverlight.ServiceFacturation.CsCasind>(); Galatee.Silverlight.ServiceFacturation.FacturationServiceClient service = new Galatee.Silverlight.ServiceFacturation.FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.RetourneListeDesCasCompleted += (s, args) => { try { if (args.Error != null && args.Cancelled) { Message.ShowError("Erreur survenue lors de l'appel serveur", "Erreur"); return; } if (args.Result != null && args.Result.Count == 0) { Message.ShowInformation("Aucune données trouvées!", "Info"); return; } //ListDesCasDuLot = args.Result; cbxcas.DisplayMemberPath = "LIBELLE"; cbxcas.SelectedValuePath = "PK_ID"; cbxcas.ItemsSource = args.Result; } catch (Exception ex) { Message.ShowError(ex, "Erreur"); } }; service.RetourneListeDesCasAsync(null, null); }
private void RetourneAnnomalie(List <CsFactureBrut> leResultatFacturationbrut) { Galatee.Silverlight.ServiceFacturation.FacturationServiceClient service = new Galatee.Silverlight.ServiceFacturation.FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.RetourneLesteAnomalieCompleted += (s, args) => { if (args != null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); return; } if (args == null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); return; } if (args.Result.Count != 0) { string print = "Imprimé le " + DateTime.Now + " sur le poste " + SessionObject.LePosteCourant.NOMPOSTE + " par " + UserConnecte.nomUtilisateur + "(" + UserConnecte.matricule + ") du centre " + UserConnecte.LibelleCentre; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("Print", print); //Utility.ActionDirectOrientation<ServicePrintings.CsAnnomalie, ServiceFacturation.CsAnnomalie>(args.Result, new Dictionary<string, string>(), SessionObject.CheminImpression, "AnomalieFacturation", "Facturation", true); Utility.ActionDirectOrientation <ServicePrintings.CsAnnomalie, ServiceFacturation.CsAnnomalie>(args.Result, param, SessionObject.CheminImpression, "AnomalieFacturation", "Facturation", true); } }; service.RetourneLesteAnomalieAsync(leResultatFacturationbrut.First().LOTRI, leResultatFacturationbrut.First().FK_IDCENTRE); service.CloseAsync(); }
private void RetourneAnnomalie(List <CsFactureBrut> leResultatFacturationbrut) { Galatee.Silverlight.ServiceFacturation.FacturationServiceClient service = new Galatee.Silverlight.ServiceFacturation.FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.RetourneLesteAnomalieCompleted += (s, args) => { if (args != null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); return; } if (args == null && args.Cancelled) { Message.Show(Langue.msgErrorFact, Langue.LibelleModule); return; } if (args.Result.Count != 0) { Dictionary <string, string> param = new Dictionary <string, string>(); Utility.ActionDirectOrientation <ServicePrintings.CsAnnomalie, ServiceFacturation.CsAnnomalie>(args.Result, new Dictionary <string, string>(), SessionObject.CheminImpression, "AnomalieFacturation", "Facturation", true); } }; service.RetourneLesteAnomalieAsync(leResultatFacturationbrut.First().LOTRI, leResultatFacturationbrut.First().FK_IDCENTRE); service.CloseAsync(); }
private void EditerRegroupement() { try { string rdlcName = string.Empty; // Fichier rdlc int regroupDebut = 0; if (this.Txt_RegDebut.Tag != null) { regroupDebut = ((ServiceAccueil.CsRegCli) this.Txt_RegDebut.Tag).PK_ID; } int regroupFin = 0; if (this.Txt_RegFin.Tag != null) { regroupFin = ((ServiceAccueil.CsRegCli) this.Txt_RegFin.Tag).PK_ID; } if (int.Parse(((ServiceAccueil.CsRegCli) this.Txt_RegFin.Tag).CODE) < int.Parse(((ServiceAccueil.CsRegCli) this.Txt_RegDebut.Tag).CODE)) { Message.ShowInformation("Regroupement debut inferieur au regroupement fin", "Edition"); return; } if (regroupDebut != 0 && regroupFin != 0) { List <string> lesPeriode = new List <string>(); foreach (var per in LstPeriode) { lesPeriode.Add(Shared.ClasseMEthodeGenerique.FormatPeriodeAAAAMM(per)); } Dictionary <string, string> param = new Dictionary <string, string>(); string key = Utility.getKey(); string print = "Imprimé le " + DateTime.Now + " sur le poste " + SessionObject.LePosteCourant.NOMPOSTE + " par " + UserConnecte.nomUtilisateur + "(" + UserConnecte.matricule + ") du centre " + UserConnecte.LibelleCentre; param.Add("Print", print); List <string> Produit = ((List <ServiceAccueil.CsProduit>)Cbo_Produit.ItemsSource).Select(t => t.CODE).ToList(); if (Rdb_facture.IsChecked == true) { param.Add("TypeEdition", "Originale"); rdlcName = "FactureSimple"; } if (Rdb_bordereau_detail.IsChecked == true) { rdlcName = "FactureDetail"; } if (Rdb_bordereau_simple.IsChecked == true) { rdlcName = "BordereauSimple"; } if (Rdb_edtion_anomalie.IsChecked == true) { rdlcName = "FactureAnomalie"; } if (Rdb_FactureRegroupe.IsChecked == true) { rdlcName = "FactureRegroupe"; } int?leCentre = null; if (this.Txt_CodeCentre.Tag != null) { leCentre = (int)this.Txt_CodeCentre.Tag; } prgBar.Visibility = System.Windows.Visibility.Visible; this.OKButton.IsEnabled = false; Shared.ClasseMEthodeGenerique.SetMachineAndPortFromEndPoint(Utility.EndPoint("Facturation")); Galatee.Silverlight.ServiceFacturation.FacturationServiceClient services = new Galatee.Silverlight.ServiceFacturation.FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); services.RetourneFacturesRegroupementAsync(this.Txt_RegDebut.Text, this.Txt_RegFin.Text, lesPeriode, Produit, leCentre, rdlcName); services.RetourneFacturesRegroupementCompleted += (er, res) => { try { prgBar.Visibility = System.Windows.Visibility.Collapsed; this.OKButton.IsEnabled = true; if (res.Error != null || res.Cancelled) { Message.Show("Erreur dans le traitement des factures : " + res.Error.InnerException.ToString(), "Erreur"); } else if (res.Result.Count != 0) { //foreach (string leRegroupement in lesregroupement) //{ if (rdlcName == "FactureRegroupe") { //foreach (string leRegroupement in lesregroupement) //{ // List<ServiceFacturation.CsFactureClient> lstRegroupement = res.Result.Where(i => i.Regcli == leRegroupement).ToList(); // if (lstRegroupement.Count == 0) continue; //Utility.ActionDirectOrientation<ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(res.Result, param, SessionObject.CheminImpression, rdlcName, "Facturation", true); Utility.ActionExportation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(res.Result, param, string.Empty, SessionObject.CheminImpression, rdlcName, "Facturation", true, "pdf"); //} } else { //foreach (string leProduit in Produit) //{ List <ServiceFacturation.CsFactureClient> lesFactureProduitRegpement = res.Result; if (Produit.First() == SessionObject.Enumere.ElectriciteMT) { if (rdlcName == "FactureSimple") { rdlcName = "FactureSimpleMT"; } if (rdlcName == "FactureDetail") { rdlcName = "FactureDetailMTSGC"; } if (rdlcName == "BordereauSimple") { rdlcName = "BordereauSimpleSGC"; } } else { if (rdlcName == "FactureSimple") { if (Produit.First() == SessionObject.Enumere.Eau) { rdlcName = "FactureSimpleO"; } } if (rdlcName == "FactureDetail") { rdlcName = "FactureDetailSCG"; } if (rdlcName == "BordereauSimple") { rdlcName = "BordereauSimpleSGC"; } } if (Chk_ExportExcel.IsChecked != true) { if (rdlcName == "FactureSimple" || rdlcName == "FactureSimpleMT" || rdlcName == "FactureSimpleO") { List <ServiceFacturation.CsFactureClient> lstClient = new List <ServiceFacturation.CsFactureClient>(); var lesClient = res.Result.Select(y => new { y.Centre, y.Client, y.Ordre }).Distinct(); foreach (var item in lesClient) { lstClient.Add(new ServiceFacturation.CsFactureClient() { 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.ISFACTURE != true).Count() != 0) { string NomFichier = rdlcName + tableau[Passage]; List <string> clientSelectionne = lstClient.Where(m => m.ISFACTURE != true).Take(100).Select(o => o.Client).ToList(); List <ServiceFacturation.CsFactureClient> factureAEditer = res.Result.Where(p => clientSelectionne.Contains(p.Client)).ToList(); Utility.ActionExportation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(factureAEditer, param, NomFichier, SessionObject.CheminImpression, rdlcName, "Facturation", true, "pdf"); lstClient.Where(p => clientSelectionne.Contains(p.Client)).ToList().ForEach(p => p.ISFACTURE = true); Passage++; } } else { if (rdlcName == "BordereauSimple" || rdlcName == "BordereauSimpleSGC" || rdlcName == "BordereauSimple" || rdlcName == "BordereauSimpleSGC") { List <ServiceFacturation.CsFactureClient> lstClient = new List <ServiceFacturation.CsFactureClient>(); var lesClient = res.Result.Select(y => new { y.Centre, y.Client, y.Ordre }).Distinct(); foreach (var item in lesClient) { lstClient.Add(new ServiceFacturation.CsFactureClient() { 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.ISFACTURE != true).Count() != 0) { string NomFichier = rdlcName + tableau[Passage]; List <string> clientSelectionne = lstClient.Where(m => m.ISFACTURE != true).Take(100).Select(o => o.Client).ToList(); List <ServiceFacturation.CsFactureClient> factureAEditer = res.Result.Where(p => clientSelectionne.Contains(p.Client)).ToList(); Utility.ActionExportation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(factureAEditer, param, NomFichier, SessionObject.CheminImpression, rdlcName, "Facturation", true, "pdf"); lstClient.Where(p => clientSelectionne.Contains(p.Client)).ToList().ForEach(p => p.ISFACTURE = true); Passage++; } } else { Utility.ActionDirectOrientation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(lesFactureProduitRegpement, param, SessionObject.CheminImpression, rdlcName, "Facturation", true); } } } else if (rdlcName == "FactureSimple" || rdlcName == "FactureSimpleMT" || rdlcName == "FactureSimpleO") { List <ServiceFacturation.CsFactureClient> lstClient = new List <ServiceFacturation.CsFactureClient>(); var lesClient = res.Result.Select(y => new { y.Centre, y.Client, y.Ordre }).Distinct(); foreach (var item in lesClient) { lstClient.Add(new ServiceFacturation.CsFactureClient() { Centre = item.Centre, Client = item.Client, Ordre = item.Ordre }); } int Passage = 1; while (lstClient.Where(o => o.ISFACTURE != true).Count() != 0) { string NomFichier = rdlcName + Passage.ToString(); List <string> clientSelectionne = lstClient.Where(m => m.ISFACTURE != true).Take(100).Select(o => o.Client).ToList(); List <ServiceFacturation.CsFactureClient> factureAEditer = res.Result.Where(p => clientSelectionne.Contains(p.Client)).ToList(); Utility.ActionExportation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(factureAEditer, param, NomFichier, SessionObject.CheminImpression, rdlcName, "Facturation", true, "xlsx"); lstClient.Where(p => clientSelectionne.Contains(p.Client)).ToList().ForEach(p => p.ISFACTURE = true); Passage++; } } else { Utility.ActionExportation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(lesFactureProduitRegpement, param, string.Empty, SessionObject.CheminImpression, rdlcName, "Facturation", true, "xlsx"); } } } else { Message.Show("Aucune factures trouvées, veuillez consultez le journal des erreurs", "Erreur"); } //Message.Show("Une erreur s'est produite lors de la génération des factures, veuillez consultez le journal des erreurs", // "Erreur"); } catch (Exception ex) { Message.Show("Erreur inconnue :" + ex.Message, "Erreur inconnue"); } }; } } catch (Exception ex) { throw ex; } }