void GetData()
        {
            //Récupération des configurations en fonction du centre de l'utilisateur connecté
            bool isAdmin = (UserConnecte.matricule == "admin");

            ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
            int back = LoadingManager.BeginLoading("Chargement des données ...");

            client.SelectAllConfigurationWorkflowCentreCompleted += (sender, args) =>
            {
                if (args.Cancelled || args.Error != null)
                {
                    string error = args.Error.Message;
                    Message.Show(error, Languages.ListeCodePoste);
                    return;
                }
                if (args.Result == null)
                {
                    Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                    return;
                }
                cmbConfiguration.Items.Clear();
                _lsConfig = new List <CsVwConfigurationWorkflowCentre>();
                _lsConfig.Add(new CsVwConfigurationWorkflowCentre()
                {
                    NOM = "Aucun", OPERATIONID = Guid.Empty
                });
                if (args.Result != null)
                {
                    foreach (var item in args.Result.Distinct(new Classes.GenericComparer <CsVwConfigurationWorkflowCentre>(
                                                                  x => x.OPERATIONID)))
                    {
                        _lsConfig.Add(item);
                    }
                }
                cmbConfiguration.DisplayMemberPath = "NOM";
                cmbConfiguration.SelectedValuePath = "OPERATIONID";
                cmbConfiguration.ItemsSource       = _lsConfig;

                LoadingManager.EndLoading(back);
            };
            client.SelectAllConfigurationWorkflowCentreAsync();
        }
        public List <ServiceReport.CsConnexion> GetPrintObjects(string module)
        {
            try
            {
                ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(module));
                // string mois = (Cmb_month.SelectedIndex < 0) ? null : (Cmb_month.SelectedIndex + 1).ToString("00");
                List <ServiceReport.CsConnexion> reportPrint = new List <CsConnexion>();


                int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                service.ObtenirNewWaterConnexionAsync(Txt_year.Text);
                service.ObtenirNewWaterConnexionCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            throw new Exception("Cannot display report");
                        }
                        if (res.Result != null)
                        {
                            reportPrint = res.Result;
                            Utility.ActionPreview <ServicePrintings.CsConnexion, Galatee.Silverlight.ServiceReport.CsConnexion>(reportPrint, null, "VisuReportYear", module);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };

                return(reportPrint);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void LoadTypeTarif()
        {
            List <Galatee.Silverlight.ServiceRecouvrement.CsTypeTarif> ListeTarif = new List <Galatee.Silverlight.ServiceRecouvrement.CsTypeTarif>();

            //RpntServiceClient Service = new RpntServiceClient();
            Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
            int handler = LoadingManager.BeginLoading("Recuperation des Types Tarif ...");

            service.GetTypeTarifAsync();
            service.GetTypeTarifCompleted += (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)
                        {
                            ListeTarif = res.Result;
                            cbxtarif.DisplayMemberPath = "LIBELLE";
                            cbxtarif.ItemsSource       = ListeTarif;
                        }
                        else
                        {
                            Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                         "Erreur");
                        }

                        LoadingManager.EndLoading(handler);
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            };

            cbxtarif.DisplayMemberPath = "LIBELLE";
            cbxtarif.ItemsSource       = ListeTarif;
        }
        protected void CmbCollector_SelectedIndexChanged(object sender, EventArgs e)
        {
            int loaderHandler                      = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
            ReportServiceClient service            = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint("Report"));
            CsReglement         reglementSelection = listeDeReglement.ElementAt(CmbCollector.SelectedIndex);
            List <CsReglement>  liste              = new List <CsReglement>();

            service.SelectionDateParAgentAsync(reglementSelection.MATRICULE.ToString());
            service.SelectionDateParAgentCompleted += (er, res) =>
            {
                try
                {
                    if (res.Error != null || res.Cancelled)
                    {
                        LoadingManager.EndLoading(loaderHandler);
                        throw new Exception("Cannot display report");
                    }
                    if (res.Result != null)
                    {
                        liste = res.Result;

                        //List<CsReglement> liste = service.SelectionAgentParNom(Matricule);
                        if (liste != null || liste.Count > 0)
                        {
                            listeDeReglement = liste;
                            foreach (CsReglement reg in liste)
                            {
                                this.CmbDatePayment.Items.Add(reg.DATEENCAISSEMENT.ToString());
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    LoadingManager.EndLoading(loaderHandler);
                }
            };
        }
        public void LoadCampagne()
        {
            //if (SessionObject.campagne.Count() > 0)
            //{
            //    Load_Campagne();
            //}
            //else
            //{
            Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
            int handler = LoadingManager.BeginLoading("Recuperation des factures ...");

            service.GetCampagneBTAControleAsync();
            service.GetCampagneBTAControleCompleted += (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)
                    {
                        Conteneur_listeCampagne = res.Result;
                        Load_Campagne();
                    }
                    else
                    {
                        Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                     "Erreur");
                    }

                    LoadingManager.EndLoading(handler);
                }
                catch (Exception)
                {
                    throw;
                }
            };
            //}
        }
Exemplo n.º 6
0
        public List <ServiceReport.CsConnexion> GetPrintObjects(string module)
        {
            try
            {
                int loaderHandler           = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module));
                string mois = (Cmb_month.SelectedIndex < 0) ? null : (Cmb_month.SelectedIndex + 1).ToString("00");
                List <ServiceReport.CsConnexion> reportPrint = new List <CsConnexion>();

                service.ObtenirConnexionsElectricityAsync(Txt_year.Text, mois, null);
                service.ObtenirConnexionsElectricityCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            throw new Exception("Cannot display report");
                        }
                        if (res.Result != null)
                        {
                            reportPrint = res.Result;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };

                return(reportPrint);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        private void FillMonth()
        {
            try
            {
                int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");

                Cmb_month.Items.Clear();
                ReportServiceClient service = new ReportServiceClient();
                service.GetMoisAsync();
                service.GetMoisCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            throw new Exception("Cannot display report");
                        }

                        if (res.Result != null)
                        {
                            var listeMois = res.Result;
                            Cmb_month.ItemsSource       = listeMois;
                            Cmb_month.DisplayMemberPath = "LIBELLE";
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void GetData()
        {
            int back = 0;

            try
            {
                back = LoadingManager.BeginLoading("Chargement des données en cours...");
                ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                client.SelectAllGroupeValidationCompleted += (ssender, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        string error = args.Error.Message;
                        Message.Show(error, Languages.ListeCodePoste);
                        return;
                    }
                    if (args.Result == null)
                    {
                        Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                        return;
                    }
                    DonnesDatagrid.Clear();
                    lsDatas = new Dictionary <CsGroupeValidation, List <CsRHabilitationGrouveValidation> >();
                    if (args.Result != null)
                    {
                        foreach (var item in args.Result)
                        {
                            DonnesDatagrid.Add(item.Key);
                            lsDatas.Add(item.Key, item.Value);
                        }
                    }
                    dtgrdParametre.ItemsSource = DonnesDatagrid;
                    LoadingManager.EndLoading(back);
                };
                client.SelectAllGroupeValidationAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 private void GetData()
 {
     if (null != LePere)
     {
         int back = 0;
         try
         {
             back = LoadingManager.BeginLoading("Chargement des données en cours...");
             ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
             client.SelectAllOperationCompleted += (ssender, args) =>
             {
                 if (args.Cancelled || args.Error != null)
                 {
                     string error = args.Error.Message;
                     Message.Show(error, Languages.ListeCodePoste);
                     return;
                 }
                 if (args.Result == null)
                 {
                     Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                     return;
                 }
                 DonnesDatagrid.Clear();
                 if (args.Result != null)
                 {
                     foreach (var item in args.Result.Where(op => op.FK_ID_PARENTOPERATION == LePere.PK_ID))
                     {
                         DonnesDatagrid.Add(item);
                     }
                 }
                 dtgrdParametre.ItemsSource = DonnesDatagrid; LoadingManager.EndLoading(back);
             };
             client.SelectAllOperationAsync();
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
        public void LoadAgentZont()
        {
            List <Galatee.Silverlight.ServiceRecouvrement.CsReleveur> ListeReleveur = new List <Galatee.Silverlight.ServiceRecouvrement.CsReleveur>();

            //RpntServiceClient Service = new RpntServiceClient();
            Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
            int handler = LoadingManager.BeginLoading("Recuperation des Agents Zone ...");

            service.GetAgentZontAsync();
            service.GetAgentZontCompleted += (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)
                    {
                        ListeReleveur = res.Result;
                        cbxagetzone.DisplayMemberPath = "NOMRELEVEUR";
                        cbxagetzone.ItemsSource       = ListeReleveur;
                    }
                    else
                    {
                        Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                     "Erreur");
                    }

                    LoadingManager.EndLoading(handler);
                }
                catch (Exception)
                {
                    throw;
                }
            };
            cbxagetzone.DisplayMemberPath = "MATRICULE";
            cbxagetzone.ItemsSource       = ListeReleveur;
        }
        public void LoadGroupeFacture()
        {
            List <Galatee.Silverlight.ServiceRecouvrement.CsGroupeDeFacturation> ListeGroupefacturation = new List <Galatee.Silverlight.ServiceRecouvrement.CsGroupeDeFacturation>();

            //RpntServiceClient Service = new RpntServiceClient();
            Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
            int handler = LoadingManager.BeginLoading("Recuperation des Groupes Facture ...");

            service.GetGroupeFactureAsync();
            service.GetGroupeFactureCompleted += (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)
                    {
                        ListeGroupefacturation = res.Result;
                        //cbxgropfacture.DisplayMemberPath = "Libelle";
                        //cbxgropfacture.ItemsSource = ListeGroupefacturation;
                    }
                    else
                    {
                        Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                     "Erreur");
                    }

                    LoadingManager.EndLoading(handler);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            };
            //cbxgropfacture.DisplayMemberPath = "Libelle";
            //cbxgropfacture.ItemsSource = ListeGroupefacturation;
        }
        private void SaveCampagne()
        {
            //Association de campagne à liste de branchement selection
            Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
            int handler = LoadingManager.BeginLoading("traitement des données ...");
            List <Galatee.Silverlight.ServiceRecouvrement.CsCampagnesBTAAccessiblesParLUO> listecampageneTosave = (List <Galatee.Silverlight.ServiceRecouvrement.CsCampagnesBTAAccessiblesParLUO>)dgCampagne.ItemsSource;

            service.SaveCampagneElementAsync(listecampageneTosave);
            service.SaveCampagneElementCompleted += (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 != false)
                    {
                        Message.Show("Modification enrégistrer avec succès",
                                     "Erreur");

                        Conteneur_listeCampagne.Clear();
                        Conteneur_listeCampagne = listecampageneTosave;
                        //CallServiceToLoadCamp();
                    }
                    else
                    {
                        Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                     "Erreur");
                    }

                    LoadingManager.EndLoading(handler);
                }
                catch (Exception)
                {
                    throw;
                }
            };
        }
 public void LoadAllRechercheTarif()
 {
     try
     {
         TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
         int handler = LoadingManager.BeginLoading("Chargement des donnée ...");
         service.LoadAllRechercheTarifAsync();
         service.LoadAllRechercheTarifCompleted += (er, res) =>
         {
             try
             {
                 if (res.Error != null || res.Cancelled)
                 {
                     Message.Show("Erreur dans le traitement : " + res.Error.InnerException.ToString(), "Erreur");
                 }
                 else
                 if (res.Result != null)
                 {
                     SessionObject.ListeRechercheTarif = res.Result;
                     ListeRechercheTarif = SessionObject.ListeRechercheTarif;
                 }
                 else
                 {
                     Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                  "Erreur");
                 }
                 LoadingManager.EndLoading(handler);
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 14
0
        private void RetourneInfoBranchement(int fk_idcentre, string centre, string client, string produit)
        {
            int res = LoadingManager.BeginLoading(Langue.En_Cours);

            BranchementClientRecherche = new CsBrt();
            AcceuilServiceClient service = new AcceuilServiceClient(Utility.Protocole(), Utility.EndPoint("Accueil"));

            service.RetourneBranchementCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                if (args.Result != null)
                {
                    BranchementClientRecherche = args.Result.FirstOrDefault(p => p.PRODUIT == LaDemande.LaDemande.PRODUIT);
                    if (BranchementClientRecherche != null && !string.IsNullOrEmpty(BranchementClientRecherche.CENTRE))
                    {
                        LaDemande.Branchement = BranchementClientRecherche;
                        AfficherBranchemetDemande(BranchementClientRecherche);
                    }
                    else
                    {
                        Message.ShowInformation("Aucune information trouvée", "Recherche de branchement");
                    }
                    LoadingManager.EndLoading(res);
                }
                else
                {
                    Message.ShowInformation("Aucune information trouvée", "Recherche de branchement");
                }

                LoadingManager.EndLoading(res);
            };
            service.RetourneBranchementAsync(fk_idcentre, centre, client, produit);
            service.CloseAsync();
        }
        public void LoadClientEligible()
        {
            string CodeTypeClient   = "";
            string CodeTypeTarif    = "";
            string CodeTypeCompteur = "";
            string CodeAgentZone    = "";
            string CodeGroupe       = "";
            string MoisDepart       = "";
            string CodeCentre       = "";
            string CodeMethode      = "";
            int    FkiCentre        = 0;

            try
            {
                if (cbxmethrech.SelectedItem != null)
                {
                    CodeMethode = ((Galatee.Silverlight.ServiceRecouvrement.CsRefMethodesDeDetectionClientsBTA)cbxmethrech.SelectedItem).Methode_ID.ToString();
                }
                else
                {
                    Message.Show("Veuillez choisir une méthode de détection", "Info");
                    return;
                }
                if (Cbo_Centre.SelectedItem != null)
                {
                    CodeCentre = ((Galatee.Silverlight.ServiceAccueil.CsCentre)Cbo_Centre.SelectedItem).CODE;
                    FkiCentre  = ((Galatee.Silverlight.ServiceAccueil.CsCentre)Cbo_Centre.SelectedItem).PK_ID;
                }
                else
                {
                    Message.Show("Veuillez choisir un centre", "Info");
                    return;
                }
                if (cbxtypeclient.SelectedItem != null)
                {
                    CodeTypeClient = ((Galatee.Silverlight.ServiceAccueil.CsCategorieClient)cbxtypeclient.SelectedItem).CODE.ToString();
                }
                if (cbxtarif.SelectedItem != null)
                {
                    CodeTypeTarif = ((Galatee.Silverlight.ServiceRecouvrement.CsTypeTarif)cbxtarif.SelectedItem).PK_ID.ToString();
                }



                if (cbxagetzone.SelectedItem != null)
                {
                    CodeAgentZone = ((Galatee.Silverlight.ServiceRecouvrement.CsReleveur)cbxagetzone.SelectedItem).MATRICULE;
                }
                if (cbxcompteur.SelectedItem != null)
                {
                    CodeTypeCompteur = ((Galatee.Silverlight.ServiceRecouvrement.CsTcompteur)cbxcompteur.SelectedItem).PK_ID.ToString();
                }



                #region Sylla 08/07/2016


                if (cbxmethrech.SelectedItem != null)
                {
                    var methrech = (Galatee.Silverlight.ServiceRecouvrement.CsRefMethodesDeDetectionClientsBTA)cbxmethrech.SelectedItem;
                    //Si la méthode choisi est la methode de comparaison sur deux période
                    if (methrech.Libele_Methode.Trim() == "Comparaison sur deux périodes".Trim())
                    {
                        if (string.IsNullOrWhiteSpace(txt_comparaison_periode1.Text) || string.IsNullOrWhiteSpace(txt_comparaison_periode1.Text))
                        {
                            Message.ShowWarning("Veillez saisir les deux périodes à comparer", "Avertissement");
                            return;
                        }
                    }
                    else

                    //Si la méthode choisi est la methode de comparaison sur plage de période
                    if (methrech.Libele_Methode.Trim() == "Comparaison sur plage périodes".Trim())
                    {
                        if (string.IsNullOrWhiteSpace(txt_comparaison_periode1.Text) || string.IsNullOrWhiteSpace(txt_comparaison_periode1.Text))
                        {
                            Message.ShowWarning(" Veillez saisir la période de debut et de fin ", "Avertissement");
                            return;
                        }
                    }
                    else

                    //Si la méthode choisi est la methode de Recurence des cas
                    if (methrech.Libele_Methode.Trim() == "Recurence des cas".Trim())
                    {
                        if (string.IsNullOrWhiteSpace(txt_Code_Cas.Text) || 0 > NumUpD_Nombre_Recurence.Value || string.IsNullOrWhiteSpace(txt_Periode.Text))
                        {
                            Message.ShowWarning(" Veillez choisir la période de départ, un cas et le nombre de recurence ", "Avertissement");
                            return;
                        }
                        MoisDepart = this.txt_Periode.Text;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(txt_Periode.Text))
                        {
                            MoisDepart = this.txt_Periode.Text;
                        }
                        else
                        {
                            Message.Show("Veuillez choisir la periode départ", "Info");
                            return;
                        }
                    }
                }


                #endregion



                //RpntServiceClient Service = new RpntServiceClient();
                Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                int handler = LoadingManager.BeginLoading("Recuperation des données ...");
                service.GetClientEligibleAsync(CodeMethode, FkiCentre, CodeTypeClient, CodeTypeTarif, CodeTypeCompteur, CodeAgentZone, CodeGroupe, MoisDepart, txt_comparaison_periode1.Text, txt_comparaison_periode2.Text, txt_Code_Cas.Text, NumUpD_Nombre_Recurence.Value, NumUpD_Pourcentatge.Value);
                service.GetClientEligibleCompleted += (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)
                        {
                            foreach (var item in res.Result)
                            {
                                ListeClientEligible.Add(item);
                            }
                            dgClientEligible.ItemsSource = null;
                            dgClientEligible.ItemsSource = ListeClientEligible;
                        }
                        else
                        {
                            Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                         "Erreur");
                        }

                        LoadingManager.EndLoading(handler);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, "Erreur");
            }
        }
Exemplo n.º 16
0
        private void ChargerEvenement(List <CsLotri> _lstLotri, string ordtour)
        {
            int result = LoadingManager.BeginLoading("Chargement en cours...");

            try
            {
                List <CsEvenement>       LstEvenement = new List <CsEvenement>();
                FacturationServiceClient service      = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));
                service.ChargerListeDesEvenementsCompleted += (s, args) =>
                {
                    try
                    {
                        if (args != null && args.Cancelled)
                        {
                            this.OKButton.IsEnabled = true;

                            Message.ShowError(args.Error, Galatee.Silverlight.Resources.Index.Langue.libelleModule);
                            LoadingManager.EndLoading(result);
                            return;
                        }

                        if (args.Result == null || args.Result.Count == 0)
                        {
                            this.OKButton.IsEnabled = true;

                            Message.ShowError(Galatee.Silverlight.Resources.Index.Langue.Msg_IndexNonTrouvé, Galatee.Silverlight.Resources.Index.Langue.libelleModule);
                            LoadingManager.EndLoading(result);
                            return;
                        }

                        LstEvenement.AddRange(args.Result);
                        if (LstEvenement.Count != 0)
                        {
                            foreach (CsEvenement item in LstEvenement)
                            {
                                if (item.CAS == "##")
                                {
                                    item.CAS = string.Empty;
                                }
                                item.IsSaisi   = string.IsNullOrEmpty(item.CAS) ? false : true;
                                item.REFERENCE = item.CENTRE + " " + item.CLIENT + " " + item.ORDRE;
                            }
                            LoadingManager.EndLoading(result);
                            UcSaisieParPage Ctrl = new UcSaisieParPage(_lstLotri, LstEvenement.OrderBy(t => t.CENTRE).ThenBy(u => u.TOURNEE).ThenBy(u => u.ORDTOUR).ThenBy(o => o.CLIENT).ThenBy(p => p.ORDRE).ThenBy(i => i.ORDREAFFICHAGE).ToList());
                            Ctrl.Show();
                            this.OKButton.IsEnabled = true;
                        }
                        else
                        {
                            this.OKButton.IsEnabled = true;
                            LoadingManager.EndLoading(result);
                            Message.ShowError(Galatee.Silverlight.Resources.Index.Langue.Msg_IndexNonTrouvé, "Information");
                        }
                    }
                    catch (Exception ex)
                    {
                        this.OKButton.IsEnabled = true;
                        LoadingManager.EndLoading(result);
                        Message.ShowError(ex, "Erreur");
                    }
                };
                service.ChargerListeDesEvenementsAsync(_lstLotri, ordtour);
            }
            catch (Exception ex)
            {
                LoadingManager.EndLoading(result);
                throw ex;
            }
        }
        public List <CsSales> GetPrintObjects(string module)
        {
            try
            {
                if (Txt_Year.Text.Length != 4)
                {
                    return(null);
                }
                else
                {
                    string coper        = "001"; // FactureGeneralCoper
                    string libelleCoper = "";


                    if (facturerationMois.IsChecked == true)
                    {
                        coper        = "001"; // FactureGeneralCoper
                        libelleCoper = "Monthly billing";
                    }
                    else if (factureration_Manuelle_Resiliation.IsChecked == true)
                    {
                        coper        = "002"; // FactureManuelleCoper
                        libelleCoper = "Manual and termination billing";
                    }
                    else if (Tous.IsChecked == true)
                    {
                        coper        = null;
                        libelleCoper = "All the billing";
                    }

                    //if (parameters.Count > 0)
                    //    parameters.Clear();
                    //parameters.Add("pCoper", libelleCoper);

                    int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");


                    ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module));

                    List <CsSales> reportPrint = new List <CsSales>();

                    service.QUANTITY_SOLD_BY_CATEGAsync(Txt_Year.Text, coper, null, null);
                    service.QUANTITY_SOLD_BY_CATEGCompleted += (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>();
                                Dictionary <string, string> param = null;
                                string key = Utility.getKey();
                                this.Parameters = new Dictionary <string, string>();
                                this.Parameters.Add("pCoper", libelleCoper);
                                //this.DefinedRDLC = reportName;
                                //Effectue l'aperçcu avant imprèssion
                                //Utility.ActionPreview<ServicePrintings.CsSales, Galatee.Silverlight.ServiceReport.CsSales>(reportPrint, param, "", module);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                            LoadingManager.EndLoading(loaderHandler);
                        }
                    };



                    //this.DefinedRDLC = "test";



                    return(reportPrint);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 18
0
        public List <Galatee.Silverlight.ServiceReport.CsReglement> GetPrintObjects(string module)
        {
            try
            {
                DateTime?CollectionDate = DateTime.Now.Date;
                annee = CollectionDate.Value.Year;
                MoisChoisi.Add(CollectionDate.Value.Month);
                string key = Utility.getKey();
                //Matricule de l'agent courant
                listeDesCaissieresCochees.Add(UserConnecte.matricule);
                //if (Txt_DateDebut.IsEnabled==false)
                //{
                //    annee = (this.Txt_year.Text == string.Empty) ? 0 : int.Parse(this.Txt_year.Text);
                //}
                //else
                //{
                //    annee = (Txt_DateDebut.SelectedDate != null) ? Txt_DateDebut.SelectedDate.Value.Year : 0;
                //}

                string reportName = "PassPaymentDetail";
                this.DefinedRDLC = reportName;


                int loaderHandler = LoadingManager.BeginLoading("Please Wait for current payment ... ");
                List <ServiceReport.CsReglement> reportPrint = new List <ServiceReport.CsReglement>();
                List <Galatee.Silverlight.ServiceReport.CsReglement> ligne = new List <Galatee.Silverlight.ServiceReport.CsReglement>();

                //Doit tenir compte des mois coché
                //GetAllSelectedCheckObjItem();


                List <Galatee.Silverlight.ServiceCaisse.CsReglement> ListeDesFacture = new List <Galatee.Silverlight.ServiceCaisse.CsReglement>();


                ReportServiceClient service = new ReportServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(module));
                service.RPT_ETAT_ENCAISSEMENT_BY_COLLECTOR_CURRENTEAsync(listeDesCaissieresCochees, CollectionDate, annee, MoisChoisi, Edition, key, null);
                service.RPT_ETAT_ENCAISSEMENT_BY_COLLECTOR_CURRENTECompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            Message.ShowInformation("Erreur survenue lors de l'appel service", "ERROR");
                            return;
                        }
                        if (res.Result == null)
                        {
                            LoadingManager.EndLoading(loaderHandler);
                            Message.ShowInformation("Impossible d'afficher le rapport", "ERROR");
                            return;
                        }
                        //if (res.Result != null)
                        //{
                        //    //Code en cas de succès
                        //    reportPrint = res.Result;
                        //    //Dictionary<string, string> param = new Dictionary<string, string>();
                        //    Dictionary<string, string> param = null;


                        //Effectue l'aperçcu avant imprèssion
                        Utility.ActionPreview <ServicePrintings.CsReglement>(null, this.DefinedRDLC, module, key);
                        //Utility.ActionPreview<ServicePrintings.CsReglement, Galatee.Silverlight.ServiceReport.CsReglement>(reportPrint, param, Etatafficher, module);
                        //}
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };

                return(reportPrint);
                //return null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void LoadAllRedevance()
        {
            try
            {
                //if (SessionObject.ListeRedevence.Count > 0)
                //{
                //    foreach (var item in SessionObject.ListeRedevence)
                //    {
                //        ListeRedevence.Add(item);
                //    }

                //    cbo_produit.DisplayMemberPath = "LIBELLE";
                //    cbo_produit.SelectedValuePath = "PK_ID";
                //    cbo_produit.ItemsSource = ListeRedevence.Select(r => new { PK_ID = r.FK_IDPRODUIT, LIBELLE = r.LIBELLEPRODUIT }).Distinct().ToList();


                //    cbo_redevence.DisplayMemberPath = "LIBELLE";
                //    cbo_redevence.SelectedValuePath = "PK_ID";
                //    cbo_redevence.ItemsSource = ListeRedevence.Select(r => new { PK_ID = r.PK_ID, LIBELLE = r.LIBELLE }).Distinct().ToList();

                //    ListeRedevenceTemp = ListeRedevence.ToList();
                //    LoadDatagrid();
                //}
                //else
                //{
                TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
                int handler = LoadingManager.BeginLoading("Chargement des donnée ...");
                service.LoadAllRedevanceAsync();
                service.LoadAllRedevanceCompleted += (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)
                        {
                            SessionObject.ListeRedevence = res.Result;
                            foreach (var item in SessionObject.ListeRedevence)
                            {
                                ListeRedevence.Add(item);
                            }

                            cbo_produit.DisplayMemberPath = "LIBELLE";
                            cbo_produit.SelectedValuePath = "PK_ID";
                            cbo_produit.ItemsSource       = ListeRedevence.Select(r => new { PK_ID = r.FK_IDPRODUIT, LIBELLE = r.LIBELLEPRODUIT }).Distinct().ToList();


                            cbo_redevence.DisplayMemberPath = "LIBELLE";
                            cbo_redevence.SelectedValuePath = "PK_ID";
                            cbo_redevence.ItemsSource       = ListeRedevence.Select(r => new { LIBELLE = r.LIBELLE }).Distinct().ToList();

                            ListeRedevenceTemp = ListeRedevence.ToList();

                            LoadDatagrid();
                        }
                        else
                        {
                            Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                         "Erreur");
                        }
                        LoadingManager.EndLoading(handler);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };

                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 20
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (null != cmbFormulaire.SelectedValue)
            {
                try
                {
                    ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                    int  idFrm            = int.Parse(cmbFormulaire.SelectedValue.ToString());
                    bool?checkboxSelected = chkboxConsultationSeulement.IsChecked;
                    int  back             = LoadingManager.BeginLoading("Enregistrement ...");
                    if (_execMode == SessionObject.ExecMode.Creation)
                    {
                        ObjetSelectionne = new CsEtape()
                        {
                            PK_ID            = 0,
                            CODE             = txtCode.Text,
                            DESCRIPTIONETAPE = txtDescription.Text,
                            NOM             = txtNom.Text,
                            FK_IDOPERATION  = OperationGUID,
                            FK_IDFORMULAIRE = idFrm,
                            MODIFICATION    = !checkboxSelected,
                            CONTROLEETAPE   = (0 != idFrm) ? _lsFormulaires.Where(f => f.PK_ID == idFrm)
                                              .First().FULLNAMECONTROLE : string.Empty,
                            IS_TRAITEMENT_LOT = chkTraitementParLot.IsChecked.Value
                        };
                        List <CsEtape> toInsert = new List <CsEtape>()
                        {
                            ObjetSelectionne
                        };
                        client.InsertEtapeCompleted += (ssender, insertR) =>
                        {
                            if (insertR.Cancelled ||
                                insertR.Error != null)
                            {
                                Message.ShowError(insertR.Error.Message, Languages.FenetreOperation);
                                return;
                            }
                            if (!insertR.Result)
                            {
                                Message.ShowError(Languages.ErreurInsertionDonnees, Languages.FenetreOperation);
                                return;
                            }
                            Etape        = ObjetSelectionne;
                            DialogResult = true;
                            UpdateParentList(toInsert);

                            LoadingManager.EndLoading(back);
                        };
                        client.InsertEtapeAsync(toInsert);
                    }
                    else if (_execMode == SessionObject.ExecMode.Modification)
                    {
                        ObjetSelectionne.CODE             = txtCode.Text;
                        ObjetSelectionne.DESCRIPTIONETAPE = txtDescription.Text;
                        ObjetSelectionne.NOM             = txtNom.Text;
                        ObjetSelectionne.FK_IDOPERATION  = OperationGUID;
                        ObjetSelectionne.FK_IDFORMULAIRE = idFrm;
                        ObjetSelectionne.CONTROLEETAPE   = (idFrm != 0) ? _lsFormulaires.Where(f => f.PK_ID == idFrm).First()
                                                           .FULLNAMECONTROLE : string.Empty;
                        ObjetSelectionne.IS_TRAITEMENT_LOT = chkTraitementParLot.IsChecked.Value;
                        List <CsEtape> toUpdate = new List <CsEtape>()
                        {
                            ObjetSelectionne
                        };
                        client.UpdateEtapeCompleted += (ssender, insertR) =>
                        {
                            if (insertR.Cancelled ||
                                insertR.Error != null)
                            {
                                Message.ShowError(insertR.Error.Message, Languages.FenetreOperation);
                                return;
                            }
                            if (!insertR.Result)
                            {
                                Message.ShowError(Languages.ErreurInsertionDonnees, Languages.FenetreOperation);
                                return;
                            }
                            Etape        = ObjetSelectionne;
                            DialogResult = true;
                            UpdateParentList(toUpdate);

                            LoadingManager.EndLoading(back);
                        };
                        client.UpdateEtapeAsync(toUpdate);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Message.ShowError(new Exception("Veuillez selectionner un formulaire"), "Configuration Etape");
            }
        }
        public List <Galatee.Silverlight.ServiceReport.CsReglement> GetPrintObjects(string module)
        {
            try
            {
                string CollectionDate = (string.IsNullOrEmpty(Txt_DateDebut.Text)) ? null : Txt_DateDebut.Text;
                if (Txt_DateDebut.IsEnabled == false)
                {
                    annee = (this.Txt_year.Text == string.Empty) ? null : this.Txt_year.Text;
                }
                else
                {
                    annee = (Txt_DateDebut.SelectedDate != null) ? Txt_DateDebut.SelectedDate.Value.Year.ToString() : "";
                }

                string reportName = "PassPaymentDetail";
                this.DefinedRDLC = reportName;


                int loaderHandler = LoadingManager.BeginLoading("Please Wait for pass payment ... ");
                List <ServiceReport.CsReglement> reportPrint = new List <ServiceReport.CsReglement>();
                List <Galatee.Silverlight.ServiceReport.CsReglement> ligne = new List <Galatee.Silverlight.ServiceReport.CsReglement>();

                //Doit tenir compte des mois coché
                GetAllSelectedCheckObjItem();


                List <Galatee.Silverlight.ServiceCaisse.CsReglement> ListeDesFacture = new List <Galatee.Silverlight.ServiceCaisse.CsReglement>();


                ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), Utility.EndPoint(module));
                //service.RPT_ETAT_ENCAISSEMENT_BY_COLLECTORAsync(listeDesCaissieresCochees, CollectionDate, annee, MoisChoisi, Edition, null, null);
                //service.RPT_ETAT_ENCAISSEMENT_BY_COLLECTORCompleted += (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>();
                //            Dictionary<string, string> param = null;
                //            string key = Utility.getKey();

                //            //Effectue l'aperçcu avant imprèssion
                //            Utility.ActionPreview<ServicePrintings.CsReglement, Galatee.Silverlight.ServiceReport.CsReglement>(reportPrint, param, "CurrentPaymentsDetails", module);
                //        }
                //    }
                //    catch (Exception ex)
                //    {
                //        MessageBox.Show(ex.Message);
                //    }
                //    finally
                //    {
                //        LoadingManager.EndLoading(loaderHandler);
                //    }
                //};

                return(reportPrint);
                //return null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        void GetData()
        {
            try
            {
                int back = LoadingManager.BeginLoading("Chargement des utilisateurs ...");
                AdministrationServiceClient client = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                client.RetourneListeAllUserCompleted += (ss, res) =>
                {
                    if (res.Cancelled || res.Error != null)
                    {
                        string error = res.Error.Message;
                        Message.ShowError(error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        LoadingManager.EndLoading(back);
                        return;
                    }

                    if (res.Result == null || res.Result.Count == 0)
                    {
                        Message.ShowInformation(Galatee.Silverlight.Resources.Langue.msgNodata, Galatee.Silverlight.Resources.Langue.informationTitle);
                        LoadingManager.EndLoading(back);
                        return;
                    }

                    foreach (CsUtilisateur item in res.Result)
                    {
                        item.CENTREAFFICHER = item.CENTRE + "  " + item.LIBELLECENTRE;
                        if (item.PERIMETREACTION == 1)
                        {
                            item.LIBELLEPERIMETREACTION = "Centre";
                        }
                        else if (item.PERIMETREACTION == 2)
                        {
                            item.LIBELLEPERIMETREACTION = "Site";
                        }
                        else if (item.PERIMETREACTION == 3)
                        {
                            item.LIBELLEPERIMETREACTION = "Globale";
                        }
                    }

                    List <Galatee.Silverlight.ServiceAccueil.CsCentre> lstCentreProfil = Shared.ClasseMEthodeGenerique.RetourCentreByPerimetre(SessionObject.LstCentre, UserConnecte.listeProfilUser);
                    List <int> lstCentreHabil = new List <int>();
                    foreach (var item in lstCentreProfil)
                    {
                        lstCentreHabil.Add(item.PK_ID);
                    }
                    _lstUserProfil = res.Result.Where(t => lstCentreHabil.Contains(t.FK_IDCENTRE)).ToList();

                    donnesDatagrid          = _lstUserProfil;
                    lvwResultat.ItemsSource = _lstUserProfil;

                    if (_lstUserProfil != null)
                    {
                        lvwResultat.SelectedItem = _lstUserProfil[0];
                    }

                    LoadingManager.EndLoading(back);
                };
                client.RetourneListeAllUserAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 23
0
        private void GetData()
        {
            int back = 0;

            try
            {
                back = LoadingManager.BeginLoading("Chargement des données en cours...");
                ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                client.SelectAllOperationCompleted += (ssender, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        string error = args.Error.Message;
                        Message.Show(error, Languages.ListeCodePoste);
                        return;
                    }
                    if (args.Result == null)
                    {
                        Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                        return;
                    }
                    DonnesDatagrid.Clear();
                    if (args.Result != null)
                    {
                        List <m_CsOperation> _lesOperations  = new List <m_CsOperation>();
                        List <CsOperation>   normalOperation = args.Result;
                        foreach (var item in args.Result.Where(i => !i.FK_ID_PARENTOPERATION.HasValue || i.FK_ID_PARENTOPERATION.Value == Guid.Empty))
                        {
                            var Enfants = args.Result.Where(o => o.FK_ID_PARENTOPERATION == item.PK_ID);
                            List <m_CsOperation> mEnfants = new List <m_CsOperation>();
                            Enfants.ToList().ForEach((CsOperation op) =>
                            {
                                mEnfants.Add(new m_CsOperation()
                                {
                                    PK_ID                 = op.PK_ID,
                                    DESCRIPTION           = op.DESCRIPTION,
                                    CODE                  = op.CODE,
                                    FK_ID_PARENTOPERATION = op.FK_ID_PARENTOPERATION,
                                    FK_ID_PRODUIT         = op.FK_ID_PRODUIT,
                                    FK_IDFORMULAIRE       = op.FK_IDFORMULAIRE,
                                    PRODUITNAME           = op.PRODUITNAME,
                                    FORMULAIRE            = op.FORMULAIRE,
                                    CODE_TDEM             = op.CODE_TDEM,
                                    NOM = op.NOM
                                });
                            });
                            _lesOperations.Add(new m_CsOperation()
                            {
                                PK_ID                 = item.PK_ID,
                                DESCRIPTION           = item.DESCRIPTION,
                                CODE                  = item.CODE,
                                FK_ID_PARENTOPERATION = item.FK_ID_PARENTOPERATION,
                                FK_ID_PRODUIT         = item.FK_ID_PRODUIT,
                                FK_IDFORMULAIRE       = item.FK_IDFORMULAIRE,
                                PRODUITNAME           = item.PRODUITNAME,
                                NOM            = item.NOM,
                                FORMULAIRE     = item.FORMULAIRE,
                                CODE_TDEM      = item.CODE_TDEM,
                                SOUS_OPERATION = mEnfants
                            });
                        }
                        //On les ajoutes aux datagrid
                        foreach (var item in _lesOperations)
                        {
                            donnesDatagrid.Add(item);
                        }
                    }
                    dtgrdParametre.ItemsSource = DonnesDatagrid; LoadingManager.EndLoading(back);
                };
                client.SelectAllOperationAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 24
0
        private void ShowDetailEtape()
        {
            if (null != _StepAndCondition.Key)
            {
                cmbEtape.SelectedValue            = _StepAndCondition.Key.FK_IDETAPE;
                cmbGroupeValidation.SelectedValue = _StepAndCondition.Key.FK_IDGROUPEVALIDATIOIN;
                if (null != _EtapePrecedente)
                {
                    txtEtapePrecedente.Text = _EtapePrecedente.NOM;
                }

                if (UseCondition && (null == _leCircuitDetourne || _leCircuitDetourne.Count == 0))
                {
                    //On suppose que c'est le 1er niveau

                    txtCondition.Text = (null != _StepAndCondition.Value) ? _StepAndCondition.Value.COLONNENAME + " " + _StepAndCondition.Value.VALUE
                        : string.Empty;

                    txtDelai.Text = (_StepAndCondition.Key.DUREE.HasValue) ? _StepAndCondition.Key.DUREE.Value.ToString() : "";

                    //Si il existe un circuit détourné, alors on va cherchés les infos
                    ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                    int back = LoadingManager.BeginLoading("Chargement des données ...");
                    client.SelectAllAffectationEtapeCircuitDetourneCompleted += (affsender, args) =>
                    {
                        if (args.Cancelled || args.Error != null)
                        {
                            string error = args.Error.Message;
                            Message.Show(error, Languages.ListeWorkflow);
                            LoadingManager.EndLoading(back);
                            return;
                        }
                        if (args.Result == null)
                        {
                            Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                            LoadingManager.EndLoading(back);
                            return;
                        }
                        SecondedonnesDatagrid              = new ObservableCollection <CsRAffectationEtapeWorkflow>();
                        lesAnciennesAffectations           = new List <CsRAffectationEtapeWorkflow>();
                        _RelationAffectationEtapeCondition = new Dictionary <Guid, CsConditionBranchement>();
                        StepAllReadyChoosed = new List <CsEtape>();

                        if (args.Result != null)
                        {
                            foreach (var item in args.Result)
                            {
                                SecondedonnesDatagrid.Add(item.Key);
                                lesAnciennesAffectations.Add(item.Key);
                                _RelationAffectationEtapeCondition.Add(item.Key.PK_ID, item.Value);
                                StepAllReadyChoosed.Add(_ttsLesEtapes.Where(et => et.PK_ID == item.Key.FK_IDETAPE).FirstOrDefault());
                            }
                        }
                        dtgrdParametre.ItemsSource = SecondedonnesDatagrid.OrderBy(c => c.ORDRE);
                        LoadingManager.EndLoading(back);
                    };
                    client.SelectAllAffectationEtapeCircuitDetourneAsync(_StepAndCondition.Key.PK_ID);
                }
                else if (UseCondition && (null != _leCircuitDetourne && _leCircuitDetourne.Count > 0))
                {
                    txtCondition.Text = (null != _StepAndCondition.Value) ? _StepAndCondition.Value.COLONNENAME + " " + _StepAndCondition.Value.VALUE
                        : string.Empty;
                    //On affiche le circuit détourné
                    SecondedonnesDatagrid              = new ObservableCollection <CsRAffectationEtapeWorkflow>();
                    lesAnciennesAffectations           = new List <CsRAffectationEtapeWorkflow>();
                    _RelationAffectationEtapeCondition = new Dictionary <Guid, CsConditionBranchement>();
                    StepAllReadyChoosed = new List <CsEtape>();
                    foreach (var r_aff in _leCircuitDetourne)
                    {
                        SecondedonnesDatagrid.Add(r_aff);
                        lesAnciennesAffectations.Add(r_aff);
                        _RelationAffectationEtapeCondition.Add(r_aff.PK_ID, null);
                        StepAllReadyChoosed.Add(_ttsLesEtapes.Where(et => et.PK_ID == r_aff.FK_IDETAPE).FirstOrDefault());
                    }
                    dtgrdParametre.ItemsSource = SecondedonnesDatagrid.OrderBy(c => c.ORDRE);
                }
                //if (_execMode == SessionObject.ExecMode.Consultation) AllInOne.ActivateControlsFromXaml(LayoutRoot, false);
            }
        }
        //public void LoadReleveur()
        //{
        //    //RpntServiceClient Service = new RpntServiceClient();
        //    RpntServiceClient service = new RpntServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Rpnt"));
        //    int handler = LoadingManager.BeginLoading("Recuperation des factures ...");
        //    service.GetAgentZontAsync();
        //    service.GetAgentZontCompleted += (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)
        //                {
        //                    cbx_releveur.DisplayMemberPath = "MATRICULE";
        //                    cbx_releveur.ItemsSource = res.Result;
        //                }
        //                else
        //                    Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
        //                        "Erreur");

        //            LoadingManager.EndLoading(handler);
        //        }
        //        catch (Exception ex)
        //        {

        //            throw ex;
        //        }
        //    };
        //}
        public void LoadTypeClient()
        {
            List <Galatee.Silverlight.ServiceAccueil.CsCategorieClient> ListeCategClient = new List <Galatee.Silverlight.ServiceAccueil.CsCategorieClient>();

            if (SessionObject.LstCategorie.Count > 0)
            {
                ListeCategClient = SessionObject.LstCategorie;
                cbxtypeclient.DisplayMemberPath = "LIBELLE";
                cbxtypeclient.ItemsSource       = ListeCategClient;
            }
            else
            {
                //RpntServiceClient Service = new RpntServiceClient();
                Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient service = new Galatee.Silverlight.ServiceRecouvrement.RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                int handler = LoadingManager.BeginLoading("Recuperation des type de client ...");
                service.GetTypeClientAsync();
                service.GetTypeClientCompleted += (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)
                        {
                            foreach (var item in res.Result)
                            {
                                SessionObject.LstCategorie.Add(new Galatee.Silverlight.ServiceAccueil.CsCategorieClient
                                {
                                    DATECREATION     = item.DATECREATION,
                                    DATEMODIFICATION = item.DATEMODIFICATION,
                                    LIBELLE          = item.LIBELLE,
                                    CODE             = item.CODE,
                                    PK_ID            = item.PK_ID,
                                    USERCREATION     = item.USERCREATION,
                                    USERMODIFICATION = item.USERMODIFICATION
                                });
                            }
                            ListeCategClient = SessionObject.LstCategorie;
                            cbxtypeclient.DisplayMemberPath = "LIBELLE";
                            cbxtypeclient.ItemsSource       = ListeCategClient;
                        }
                        else
                        {
                            Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                         "Erreur");
                        }

                        LoadingManager.EndLoading(handler);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };
            }
            cbxtypeclient.DisplayMemberPath = "LIBELLE";
            cbxtypeclient.ItemsSource       = ListeCategClient;
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Dtg_agent.SelectedItem != null)
                {
                    this.BtnOK.IsEnabled = false;
                    //var agent = Dtg_agent.SelectedItem as CsRHabilitationGrouveValidation;
                    List <CsAffectationDemandeUser> lstAffectation = new List <CsAffectationDemandeUser>();
                    var agent = Dtg_agent.SelectedItem as Galatee.Silverlight.ServiceAccueil.CsUtilisateur;
                    //Affectation de la demande


                    if (IsOT && lAffectationDem != null)
                    {
                        CsAffectationDemandeUser lAffectation = new CsAffectationDemandeUser();
                        lAffectation.CODEDEMANDE           = CodeDemande;
                        lAffectation.FK_IDETAPE            = _idEtapeSuivante;
                        lAffectation.MATRICULEUSER         = agent.MATRICULE;
                        lAffectation.FK_IDUSERAFFECTER     = agent.PK_ID;
                        lAffectation.OPERATIONID           = _OperationID;
                        lAffectation.CENTREID              = _centreID;
                        lAffectation.WORKFLOWID            = _workflowId;
                        lAffectation.FK_IDETAPEFROM        = _idEtape;
                        lAffectation.MATRICULEUSERCREATION = UserConnecte.matricule;
                        lAffectation.PK_ID        = Guid.NewGuid();
                        lAffectation.FK_IDDEMANDE = IdDemande;

                        AgentSelectionne           = new ServiceAccueil.CsUtilisateur();
                        AgentSelectionne.MATRICULE = agent.MATRICULE;
                        AgentSelectionne.PK_ID     = agent.PK_ID;
                        AgentSelectionne.LIBELLE   = agent.LIBELLE;
                        lAffectationDem            = lAffectation;
                        this.DialogResult          = false;
                    }
                    else
                    {
                        foreach (int item in LesCodeDemande)
                        {
                            CsAffectationDemandeUser lAffectation = new CsAffectationDemandeUser();
                            lAffectation.CODEDEMANDE           = CodeDemande;
                            lAffectation.FK_IDETAPE            = _idEtapeSuivante;
                            lAffectation.MATRICULEUSER         = agent.MATRICULE;
                            lAffectation.FK_IDUSERAFFECTER     = agent.PK_ID;
                            lAffectation.OPERATIONID           = _OperationID;
                            lAffectation.CENTREID              = _centreID;
                            lAffectation.WORKFLOWID            = _workflowId;
                            lAffectation.FK_IDETAPEFROM        = _idEtape;
                            lAffectation.MATRICULEUSERCREATION = UserConnecte.matricule;
                            lAffectation.PK_ID        = Guid.NewGuid();
                            lAffectation.FK_IDDEMANDE = item;
                            lstAffectation.Add(lAffectation);
                        }

                        int back = LoadingManager.BeginLoading("Affectation en cours ...");
                        Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient client = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
                        client.AffecterDemandeCompleted += (af_sender, args) =>
                        {
                            LoadingManager.EndLoading(back);
                            if (args.Cancelled || args.Error != null)
                            {
                                string error = args.Error.Message;
                                Message.ShowError(error, Languages.txtDevis);
                                return;
                            }
                            if (args.Result == null)
                            {
                                Message.ShowError("Une erreur est survenue", Languages.txtDevis);
                                return;
                            }
                            if (args.Result != null)
                            {
                                if (string.IsNullOrEmpty(args.Result))
                                {
                                    LoadingManager.EndLoading(back);
                                    Message.ShowInformation("Affectation", "Affectation de demande");
                                    this.DialogResult = false;
                                }
                                else
                                {
                                    LoadingManager.EndLoading(back);
                                    Message.ShowError("Affectation", "Erreur survenue à l'affectation");
                                }
                                this.DialogResult = true;
                            }
                        };
                        client.AffecterDemandeAsync(lstAffectation);
                    }
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.txtDevis);
            }
        }
        public List <CsFacture> GetPrintObjects(string module)
        {
            try
            {
                if (!string.IsNullOrEmpty(Txt_DateDebut.Text) && !string.IsNullOrEmpty(Txt_DateFin.Text))
                {
                    //CultureInfo culture = CultureInfo.("fr-FR");
                    //DateTime _DateDebut = DateTime.Parse(Txt_DateDebut.Text.ToString(culture));
                    //DateTime _DateFin = DateTime.Parse(Txt_DateFin.Text.ToString(culture));
                    DateTime _DateDebut = DateTime.Parse(Txt_DateDebut.Text.ToString());
                    DateTime _DateFin   = DateTime.Parse(Txt_DateFin.Text.ToString());
                    string   reportName = string.Empty;

                    if (Recapitulatif.IsChecked == true)
                    {
                        reportName = "NouvelAbonnementParPeriode";
                    }
                    else
                    if (Detail.IsChecked == true)
                    {
                        reportName = "NouvelAbonnementParPeriodeDetail";
                    }

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

                    ReportServiceClient service = new ReportServiceClient(Utility.Protocole(), 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>();
                                Dictionary <string, string> param = new Dictionary <string, string>();
                                string key = Utility.getKey();
                                this.DefinedRDLC = reportName;
                                param.Add("pDateDebut", _DateDebut.ToString());
                                param.Add("pDateFin", _DateFin.ToString());
                                //Effectue l'aperçcu avant imprèssion
                                Utility.ActionDirectOrientation <ServicePrintings.CsFacture, Galatee.Silverlight.ServiceReport.CsFacture>(reportPrint, param, SessionObject.DefaultPrinter, "VisuReportNewElectricityServiceConnection", module, false);

                                //Utility.ActionPreview<ServicePrintings.CsFacture, Galatee.Silverlight.ServiceReport.CsFacture>(reportPrint, param, reportName, module);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                            LoadingManager.EndLoading(loaderHandler);
                        }
                    };



                    return(reportPrint);
                }
                throw new Exception("Vous devez choisir des dates");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void SetData()
        {
            if (null != _lsEtapes)
            {
                cmbEtapeConditionVrai.DisplayMemberPath = "NOM";
                cmbEtapeConditionVrai.SelectedValuePath = "PK_ID";
                cmbEtapeConditionVrai.ItemsSource       = _lsEtapes;

                cmbGroupeValidation.DisplayMemberPath = "GROUPENAME";
                cmbGroupeValidation.SelectedValuePath = "PK_ID";
                cmbGroupeValidation.ItemsSource       = GroupeValidation;
            }

            if (_conditionAction)
            {
                //Définition d'une condition d'action

                Title = "Définition d'une condition d'action";
                cmbGroupeValidation.Visibility   = System.Windows.Visibility.Collapsed;
                cmbEtapeConditionVrai.Visibility = System.Windows.Visibility.Collapsed;
                lblEtape.Visibility  = System.Windows.Visibility.Collapsed;
                lblGroupe.Visibility = System.Windows.Visibility.Collapsed;
            }

            cmbGroupeValidation.Visibility = System.Windows.Visibility.Collapsed;
            cmbOperateur.Items.Clear();
            foreach (var str in Operateurs)
            {
                cmbOperateur.Items.Add(str);
            }

            //Affichage des colonnes
            int back = LoadingManager.BeginLoading("Chargement des données ...");
            ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));

            client.GetColumnsOfWorkingTableCompleted += (clmnsender, args) =>
            {
                if (args.Cancelled || args.Error != null)
                {
                    string error = args.Error.Message;
                    Message.Show(error, "Définition Condition");
                    return;
                }
                if (args.Result == null)
                {
                    Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage);
                    return;
                }

                cmbColonne.Items.Clear();
                if (args.Result != null)
                {
                    _LesColonnes = args.Result.ToArray();
                }

                _LesColonnes.ToList().ForEach((string str) =>
                {
                    cmbColonne.Items.Add(str);
                });

                LoadingManager.EndLoading(back);
            };
            client.GetColumnsOfWorkingTableAsync((null != TableTravailConcernée) ? TableTravailConcernée.TABLE_NAME : string.Empty);
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.OKButton.IsEnabled = false;
                if (!IsGettingIdCoupure)
                {
                    int res = LoadingManager.BeginLoading(Galatee.Silverlight.Resources.Accueil.Langue.En_Cours);
                    List <ServiceRecouvrement.CsDetailCampagne> dataTable = new List <ServiceRecouvrement.CsDetailCampagne>();
                    RecouvrementServiceClient client = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                    client.RechercherSuiviCampagneCompleted += (ss, ee) =>
                    {
                        if (ee.Cancelled || ee.Error != null)
                        {
                            string error = ee.Error.Message;
                            Message.ShowError("error on remote procdure", "RechercherCampagneParDate");
                            LoadingManager.EndLoading(res);
                            return;
                        }

                        if (ee.Result == null || ee.Result.Count == 0)
                        {
                            Message.ShowInformation("Aucune donnée trouvée", Galatee.Silverlight.Resources.Langue.errorTitle);
                            LoadingManager.EndLoading(res);
                            return;
                        }
                        dataTable = ee.Result;
                        foreach (ServiceRecouvrement.CsDetailCampagne it in dataTable)
                        {
                            it.CLIENT = it.CENTRE + " " + it.CLIENT + " " + it.ORDRE;
                        }
                        LoadingManager.EndLoading(res);
                        this.OKButton.IsEnabled = true;
                        FrmAfficheCampagne ctrl = new FrmAfficheCampagne(dataTable);
                        ctrl.Show();


                        //foreach (ServiceRecouvrement.aCampagne it in dataTable)
                        //{
                        //    if (it.DateRDV != null)
                        //        it.Observation = string.Empty;
                        //}
                        //Dictionary<string, string> param = new Dictionary<string, string>();
                        //string key = Utility.getKey();
                        //Utility.ActionDirectOrientation<ServicePrintings.aCampagne, ServiceRecouvrement.aCampagne>(dataTable, null, SessionObject.CheminImpression , "Campagnes", "Recouvrement", true);
                    };
                    client.RechercherSuiviCampagneAsync(LesCampagneSelect);
                }
                else
                {
                    ClosedEnventHandler();
                    this.DialogResult       = false;
                    this.OKButton.IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                this.OKButton.IsEnabled = true;
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
        private void SaveCampagne()
        {
            if (string.IsNullOrWhiteSpace(txtcampagne.Text) || Cbo_Centre.SelectedItem == null || dtpdatedebut.SelectedDate == null || dtpdatefinprevu.SelectedDate == null)
            {
                Message.Show("Tous les champs son obligatoire",
                             "Notification");
            }
            else
            {
                RecouvrementServiceClient service = new RecouvrementServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Recouvrement"));
                handler = LoadingManager.BeginLoading("Savegarde des données ...");

                CsCampagnesBTAAccessiblesParLUO CampBAT = new CsCampagnesBTAAccessiblesParLUO
                {
                    //Campagne_ID=Guid.Parse("6F9619FF-8B86-D011-B42D-00C04FC964FA"),
                    Campagne_ID                        = Guid.NewGuid(),
                    CodeCentre                         = ((Galatee.Silverlight.ServiceAccueil.CsCentre)Cbo_Centre.SelectedItem).CODE.ToString(),
                    DateCreation                       = dtpdatedreation.SelectedDate.Value,
                    DateDebutControles                 = dtpdatedebut.SelectedDate.Value,
                    DateFinPrevue                      = dtpdatefinprevu.SelectedDate.Value,
                    DateModification                   = DateTime.UtcNow.Date,
                    Libelle_Campagne                   = txtcampagne.Text,
                    MatriculeAgentCreation             = UserConnecte.matricule,
                    MatriculeAgentDerniereModification = UserConnecte.matricule,
                    NbreElements                       = 0,
                    Statut_ID   = 1,
                    fk_idCentre = ((Galatee.Silverlight.ServiceAccueil.CsCentre)Cbo_Centre.SelectedItem).PK_ID
                };

                service.InsertCampagneBTAAsync(CampBAT);
                service.InsertCampagneBTACompleted += (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 != false)
                            {
                                Message.Show("L'enregistrement c'est bien passé",
                                             "Notification");
                                //CsTBCAMPAGNECONTROLEBTA camp = new CsTBCAMPAGNECONTROLEBTA
                                //{
                                //    CAMPAGNE_ID = CampBAT.Campagne_ID,
                                //    CODECENTRE = int.Parse(CampBAT.CodeCentre),
                                //    CODEEXPLOITATION = CampBAT.CodeCentre,
                                //    DATECREATION = CampBAT.DateCreation,
                                //    DATEDEBUTCONTROLES = CampBAT.DateDebutControles,
                                //    DATEFINPREVUE = CampBAT.DateFinPrevue,
                                //    DATEMODIFICATION = CampBAT.DateModification,
                                //    LIBELLE_CAMPAGNE = CampBAT.Libelle_Campagne,
                                //    LIBELLECENTRE = ((CsCentre)cbxexploitation.SelectedItem).LIBELLE,
                                //    LIBELLEEXPLOITATION = ((CsCentre)cbxexploitation.SelectedItem).LIBELLE,
                                //    LISTEBRANCHEMENT = new List<CsBrt>(),
                                //    LISTELOT = new List<CsTBLOTDECONTROLEBTA>(),
                                //    MATRICULEAGENTCREATION = CampBAT.MatriculeAgentCreation,
                                //    MATRICULEAGENTDERNIEREMODIFICATION = CampBAT.MatriculeAgentDerniereModification,
                                //    METHODE = new CsREFMETHODEDEDETECTIONCLIENTSBTA(),
                                //    NBREELEMENTS = 0,
                                //    NBRLOTS = 0,
                                //    PERIODE = string.Empty,
                                //    POULATIONNONAFFECTES = 0,
                                //    STATUT = string.Empty,
                                //    STATUT_ID = int.MinValue

                                //};
                                //SessionObject.campagne.Add(camp);
                            }
                            else
                            {
                                Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                             "Erreur");
                            }
                        }
                        LoadingManager.EndLoading(handler);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };
            }
        }