void galatee_OkClickedClient(object sender, EventArgs e) { try { UcDateExigible ctrs = sender as UcDateExigible; if (!ctrs.OkClick) { this.OKButton.IsEnabled = true; return; } foreach (CsLotri item in _ListeLotriObs) { if (item.IsSelect) { if (IsSimulation) { item.ETATFAC4 = "S"; } item.DATEEXIG = ctrs.MyDateExige; item.EXIG = (Convert.ToDateTime(item.DATEEXIG) - System.DateTime.Today.Date).Days; item.JET = string.IsNullOrEmpty(item.JET) ? this.txt_jetEnCours.Text : (int.Parse(item.JET) + 1).ToString("00"); item.USERMODIFICATION = UserConnecte.matricule; } } if (ctrs.IsFaturationTotal != null) { bool EtatFact = (ctrs.IsFaturationTotal == true) ? true : false; CalculerFacture(ListSelectionnee, IsSimulation, EtatFact); } } catch (Exception ex) { throw ex; } }
void galatee_OkClickedClient(object sender, EventArgs e) { try { UcDateExigible ctrs = sender as UcDateExigible; if (!ctrs.OkClick) { this.OKButton.IsEnabled = true; return; } foreach (CsLotri item in ListSelectionnee) { if (IsSimulation) { item.ETATFAC4 = "S"; } item.DATEEXIG = ctrs.MyDateExige == new DateTime() ? Convert.ToDateTime(System.DateTime.Today.AddDays(15).ToShortDateString()) :Convert.ToDateTime(ctrs.MyDateExige.Value.ToShortDateString()); item.EXIG = (Convert.ToDateTime(item.DATEEXIG) - System.DateTime.Today.Date).Days; item.JET = string.IsNullOrEmpty(item.JET) ? this.txt_jetEnCours.Text : (int.Parse(item.JET) + 1).ToString("00"); item.USERMODIFICATION = UserConnecte.matricule; item.MATRICULE = UserConnecte.matricule; } if (ctrs.IsFaturationTotal != null) { bool EtatFact = (ctrs.IsFaturationTotal == true) ? true : false; CalculerFacture(ListSelectionnee, IsSimulation, EtatFact); } } catch (Exception ex) { Message.ShowError("Erreur au calcul du lot", "Erreur"); } }
private void DefacturationLot(List <CsLotri> ListLotSelect, bool isDestructionLot) { prgBar.Visibility = System.Windows.Visibility.Visible; try { CsStatFacturation _laStat = new CsStatFacturation(); FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.DefacturerLotCompleted += (s, args) => { if (args != null && args.Cancelled) { return; } _laStat = args.Result; if (_laStat != null) { if (!isDestructionLot) { Message.Show("Nombre de client :" + _laStat.NombreCalcule + "\r\n Montant défacturé : " + decimal.Parse(_laStat.Montant.ToString()).ToString("N2"), "Statistique"); this.OKButton.IsEnabled = true; } else { Action = SessionObject.Enumere.Normal; //UcTypeFacturation _ctrlDateExige = new UcTypeFacturation(); //_ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); //_ctrlDateExige.Show(); UcDateExigible _ctrlDateExige = new UcDateExigible(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } } prgBar.Visibility = System.Windows.Visibility.Collapsed; }; service.DefacturerLotAsync(ListLotSelect, Action); service.CloseAsync(); } catch (Exception ex) { prgBar.Visibility = System.Windows.Visibility.Collapsed; throw ex; } }
private void VerifierSaisieTotal(List <CsLotri> ListLotSelect) { try { FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation")); service.verifieSaisieTotalAsync(ListLotSelect); service.verifieSaisieTotalCompleted += (s, args) => { if (args != null && args.Cancelled) { return; } bool IsSaisiPartiel = args.Result; if (IsSaisiPartiel) { var w = new MessageBoxControl.MessageBoxChildWindow(Langue.LibelleModule, "Des évènements non saisis existent dans ce lot. \n\r Voulez-vous continuer ?", MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Information); w.OnMessageBoxClosed += (_, result) => { if (w.Result == MessageBoxResult.OK) { UcDateExigible _ctrlDateExige = new UcDateExigible(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } else { this.OKButton.IsEnabled = true; } }; w.Show(); } else { UcDateExigible _ctrlDateExige = new UcDateExigible(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } }; } catch (Exception ex) { prgBar.Visibility = System.Windows.Visibility.Collapsed; throw ex; } }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { this.OKButton.IsEnabled = false; ListSelectionnee = new List <CsLotri>(); ListSelectionnee = RetourneLotriSelectionner(_ListeLotriObs, ListeLotri); if (ListSelectionnee != null && ListSelectionnee.Count != 0) { if (!IsDefacturation && !IsDestructionSimulation) { if (ListSelectionnee.FirstOrDefault(y => (y.FACTURE != null && y.FACTURE.Contains("*"))) != null) { var w = new MessageBoxControl.MessageBoxChildWindow(Langue.LibelleModule, Langue.msgDestructionSimulation, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Information); w.OnMessageBoxClosed += (_, result) => { if (w.Result == MessageBoxResult.OK) { Action = SessionObject.Enumere.DestructionSimulation; DefacturationLot(ListSelectionnee, true); } else { this.OKButton.IsEnabled = true; } }; w.Show(); } else { UcDateExigible _ctrlDateExige = new UcDateExigible(); _ctrlDateExige.Closed += new EventHandler(galatee_OkClickedClient); _ctrlDateExige.Show(); } } else { string leMsg = string.Empty; if (IsDefacturation) { leMsg = Langue.msgDefacturation; } else { leMsg = Langue.msgSuppressionSimulation; } var w = new MessageBoxControl.MessageBoxChildWindow(Langue.LibelleModule, leMsg, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Information); w.OnMessageBoxClosed += (_, result) => { if (w.Result == MessageBoxResult.OK) { DefacturationLot(ListSelectionnee, false); } }; w.Show(); } } else { this.OKButton.IsEnabled = true; } } catch (Exception ex) { Message.ShowError(ex.Message, Langue.LibelleModule); } }