Beispiel #1
0
        public void EditerCompteMisAjour(List <CsLotCompteClient> LesLot)
        {
            List <ServiceAccueil.CsLclient> ListeCompte = new List <ServiceAccueil.CsLclient>();
            AcceuilServiceClient            service     = new AcceuilServiceClient(Utility.Protocole(), Utility.EndPoint("Accueil"));

            service.RetourneCompteAjusteCompleted += (es, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                ListeCompte.AddRange(args.Result);
                Dictionary <string, string> param = new Dictionary <string, string>();
                //param.Add(Utility.setParam("pTypeRecu"), OperationCaisse);
                Utility.Action <ServicePrintings.CsLclient, ServiceAccueil.CsLclient>(ListeCompte, param, SessionObject.CheminImpression, "AjustementCompteClient", "Accueil");
                this.DialogResult = true;
            };
            service.RetourneCompteAjusteAsync(LesLot);
        }
        private void   OKButton_Click(object sender, RoutedEventArgs e)
        {
            string IdCoupure = string.Empty;

            try
            {
                CsAvisCoupureEdition avisCoupure = new CsAvisCoupureEdition();
                bntPrinting.IsEnabled = false;
                aCampagne      Campagne = new aCampagne();
                aDisconnection dis      = new aDisconnection();

                avisCoupure.ClientResilie = this.Chk_ExclusResil.IsChecked;
                avisCoupure.Matricule     = UserConnecte.matricule;
                avisCoupure.AgentPia      = UserConnecte.matricule;
                string DueDate = (string.IsNullOrEmpty(this.dtpDate.Text)) ? null : dtpDate.Text;
                if (this.Cbo_Regcli.Tag != null)
                {
                    avisCoupure.ListeRegroupement = (List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag;
                }

                avisCoupure.Exigible = this.dtpDate.SelectedDate;

                if (this.Rdb_facturePeriode.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantPeriode.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible de la période", "Avis de coupure");
                        LayoutRoot.Cursor = Cursors.Arrow;

                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_Periode.Text))
                    {
                        Message.ShowWarning("Remplisez la période èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.Periode     = this.Txt_Periode.Text;
                    avisCoupure.SoldeClient = string.IsNullOrEmpty(this.Txt_MontantPeriode.Text) ? 0 : int.Parse(this.Txt_MontantPeriode.Text);
                }
                else if (this.Rdb_MontantGlobal.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantGlobal.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.SoldeClient = System.Convert.ToDecimal(string.IsNullOrEmpty(this.Txt_MontantGlobal.Text) ? "0" : this.Txt_MontantGlobal.Text);
                }
                else if (this.Rdb_NombreFactureMontant.IsChecked == true)
                {
                    if (string.IsNullOrEmpty(this.Txt_MontantFacture.Text))
                    {
                        Message.ShowWarning("Remplisez le montant èxigible", "Avis de coupure");
                        return;
                    }
                    if (string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text))
                    {
                        Message.ShowWarning("Remplisez le nombre de facture èxigible", "Avis de coupure");
                        return;
                    }
                    avisCoupure.MontantPeriode = string.IsNullOrEmpty(this.Txt_MontantFacture.Text) ? 0 : System.Convert.ToDecimal(this.Txt_MontantFacture.Text);
                    avisCoupure.TotalClient    = string.IsNullOrEmpty(this.Txt_NombreFactureMontant.Text) ? 0 : int.Parse(this.Txt_NombreFactureMontant.Text);
                }
                if (string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && !string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la première référence !", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }
                if (!string.IsNullOrEmpty(avisCoupure.MatriculeDebut) && string.IsNullOrEmpty(avisCoupure.MatriculeFin))
                {
                    Message.ShowInformation("Entrez la deuxième référence!", Galatee.Silverlight.Resources.Langue.errorTitle);
                    return;
                }

                bool IsListe = false;
                ligne.Clear();
                if (this.rdbtnList.IsChecked == true)
                {
                    IsListe = true;
                }
                else
                {
                    IsListe = false;
                }
                prgBar.Visibility = System.Windows.Visibility.Visible;
                LayoutRoot.Cursor = Cursors.Wait;
                RecouvrementServiceClient proxy = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                proxy.TraitementAvisCoupureGCAsync(avisCoupure, dis, IsListe);
                proxy.TraitementAvisCoupureGCCompleted += (ssn, results) =>
                {
                    try
                    {
                        if (results.Cancelled || results.Error != null)
                        {
                            string error = results.Error.Message;
                            Message.ShowError("Erreur d'invocation du service. Réessayer svp !", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        if (results.Result == null || results.Result.Count == 0)
                        {
                            Message.ShowError("Aucune donnée de campagne retournée!", Galatee.Silverlight.Resources.Langue.errorTitle);
                            bntPrinting.IsEnabled = true;
                            LayoutRoot.Cursor     = Cursors.Arrow;
                            prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                            return;
                        }

                        ligne.Clear();
                        ligne.AddRange(results.Result);
                        ServiceRecouvrement.CsRegCli lereg = ((List <ServiceRecouvrement.CsRegCli>) this.Cbo_Regcli.Tag).First();
                        Dictionary <string, string>  param = new Dictionary <string, string>();
                        string key = Utility.getKey();
                        if (IsListe == false)
                        {
                            Utility.Action <ServicePrintings.aDisconnection, ServiceRecouvrement.aDisconnection>(ligne, key, null, SessionObject.CheminImpression, "AvisDeCoupureDetailSGC", "Recouvrement");
                        }
                        else
                        {
                            Utility.Action <ServicePrintings.aDisconnection, ServiceRecouvrement.aDisconnection>(ligne, key, null, SessionObject.CheminImpression, "AvisDeCoupureListeSGC", "Recouvrement");
                        }

                        LayoutRoot.Cursor     = Cursors.Arrow;
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        bntPrinting.IsEnabled = true;
                    }
                    catch (Exception ex)
                    {
                        prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                        LayoutRoot.Cursor     = Cursors.Arrow;
                        bntPrinting.IsEnabled = true;
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
            }
            catch (Exception ex)
            {
                bntPrinting.IsEnabled = true;
                prgBar.Visibility     = System.Windows.Visibility.Collapsed;
                LayoutRoot.Cursor     = Cursors.Arrow;
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
        public List <CsFacture> GetPrintObjects(string module)
        {
            try
            {
                if (!string.IsNullOrEmpty(Txt_DateDebut.Text) && !string.IsNullOrEmpty(Txt_DateFin.Text))
                {
                    //CultureInfo culture = CultureInfo.CurrentCulture("fr-FR");
                    DateTime _DateDebut = DateTime.Parse(Txt_DateDebut.Text.ToString());
                    DateTime _DateFin   = DateTime.Parse(Txt_DateFin.Text.ToString());


                    Dictionary <string, string> parameters = new Dictionary <string, string>();
                    parameters.Add("pDateDebut", Txt_DateDebut.Text);
                    parameters.Add("pDateFin", Txt_DateFin.Text);
                    this.Parameters = parameters;
                    int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");

                    ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(module));
                    // string mois = (Cmb_month.SelectedIndex < 0) ? null : (Cmb_month.SelectedIndex + 1).ToString("00");
                    // le type "01" correspond a AffichageListeAbonnement
                    List <ServiceReport.CsFacture> reportPrint = new List <CsFacture>();

                    service.ListeAbonnementsParPeriodeAsync(_DateDebut, _DateFin, 01, null, parameters);
                    service.ListeAbonnementsParPeriodeCompleted += (er, res) =>
                    {
                        try
                        {
                            if (res.Error != null || res.Cancelled)
                            {
                                LoadingManager.EndLoading(loaderHandler);
                                throw new Exception("Cannot display report");
                            }
                            if (res.Result != null)
                            {
                                //Code en cas de succès
                                reportPrint = res.Result;
                                Dictionary <string, string> param = new Dictionary <string, string>();
                                string key = Utility.getKey();
                                param.Add("pDateDebut", _DateDebut.ToString());
                                param.Add("pDateFin", _DateFin.ToString());
                                //Effectue l'aperçcu avant imprèssion
                                Utility.Action <ServicePrintings.CsFacture, Galatee.Silverlight.ServiceReport.CsFacture>(reportPrint, param, SessionObject.DefaultPrinter, "VisuReportNewElectricityServiceConnection", module);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                            LoadingManager.EndLoading(loaderHandler);
                        }
                    };

                    //this.DefinedRDLC = reportName;

                    return(reportPrint);
                }
                throw new Exception("Vous devez choisir des dates");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }