private static void ImportDepuisFicher(aImportFichier objetselectionne)
        {
            List <string> listImport              = null;
            List <aImportFichierColonne> list     = new List <aImportFichierColonne>();
            AdministrationServiceClient  service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.ExexcImporterFichierCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                listImport = res.Result;
                if (listImport != null && listImport.Count > 0)
                {
                    UcResultatSynchroAgent ctrl = new UcResultatSynchroAgent(listImport);
                    ctrl.Show();
                }
                else
                {
                    Message.ShowInformation("Synchronisation echouée", "Paramétrage");

                    //if (listImport == null)
                    //{

                    //    Message.ShowInformation("Fichier non trouvé. Vérifier le paramétrage", "Paramétrage");
                    //}
                    //if (listImport != null && listImport.Count == 0)
                    //    Message.ShowInformation("Synchronisation réussie. Aucune nouvelle ligne", "Paramétrage");
                }
            };
            service1.ExexcImporterFichierAsync(objetselectionne);
            service1.CloseAsync();
        }
 private void Supprimer_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgImport.SelectedItem != null)
         {
             var  objetselectionne = (aImportFichier)dgImport.SelectedItem;
             bool result           = false;
             AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
             service1.SuppressImportFichierCompleted += (sr, res) =>
             {
                 if (res != null && res.Cancelled)
                 {
                     return;
                 }
                 result = res.Result;
                 if (result == true)
                 {
                     ChargeGrid();
                     MessageBox.Show("Supprimé");
                 }
                 else
                 {
                     MessageBox.Show("Echec");
                 }
             };
             service1.SuppressImportFichierAsync(objetselectionne);
             service1.CloseAsync();
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, "Echec");
     }
 }
 private void dgColonne_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (((aImportFichierColonne)dgColonne.SelectedItem) != null)
     {
         AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
         service1.GetImportColonneCompleted += (sr, res) =>
         {
             if (res != null && res.Cancelled)
             {
                 return;
             }
             unecolonne = res.Result;
             if (unecolonne != null)
             {
                 IdCodeColonne        = unecolonne.ID_COLONNE;
                 txtCol.Text          = (unecolonne.NOM != null) ? unecolonne.NOM : string.Empty;
                 txtDesc.Text         = (unecolonne.DESCRIPTION != null) ? unecolonne.DESCRIPTION : string.Empty;
                 txtLong.Text         = (unecolonne.LONGUEUR != null) ? unecolonne.LONGUEUR.ToString() : string.Empty;
                 cbType.SelectedValue = (unecolonne.TYPE != null) ? unecolonne.TYPE : string.Empty;
                 CodeImport           = int.Parse(unecolonne.ID_PARAMETRAGE.ToString());
             }
         };
         service1.GetImportColonneAsync(((aImportFichierColonne)dgColonne.SelectedItem).ID_COLONNE);
         service1.CloseAsync();
     }
 }
Пример #4
0
        private void RechercherDonnee()
        {
            prgBar.Visibility = System.Windows.Visibility.Visible;


            int idSite = 0;

            if (this.cbo_Site.SelectedItem != null)
            {
                idSite = ((ServiceAccueil.CsSite) this.cbo_Site.SelectedItem).PK_ID;
            }

            int idCentre = 0;

            if (this.cbo_Centre.SelectedItem != null)
            {
                idCentre = ((ServiceAccueil.CsCentre) this.cbo_Centre.SelectedItem).PK_ID;
            }

            if (leEtatExecuter == SessionObject.InterfacePaiement)
            {
                AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                service1.GenererFichierImpayesCompleted += (sr, res) =>
                {
                    if (res != null && res.Cancelled)
                    {
                        prgBar.Visibility = System.Windows.Visibility.Collapsed;
                        Message.ShowInformation("Problème d'accès aux données", "Interface");
                        return;
                    }

                    //if (res.Result == null || res.Result.Count == 0)
                    if (!res.Result)
                    {
                        prgBar.Visibility = System.Windows.Visibility.Collapsed;
                        Message.ShowInformation("Soit aucune donnée trouvée, soit le fichier existe déjà, \n ou alors un problème est survenu lors de la génération du fichier.", "Interface");
                        return;
                    }

                    //if (CreerFichier(res.Result))
                    if (res.Result)
                    {
                        Message.ShowInformation("Fichier des impayés généré avec succès", "Interface");
                        this.cbo_Site.SelectedItem = null;
                        prgBar.Visibility          = System.Windows.Visibility.Collapsed;
                    }
                };
                service1.GenererFichierImpayesAsync(idSite, idCentre, SessionObject.LePosteCourant.NOMPOSTE);
                service1.CloseAsync();
            }
            else if (leEtatExecuter == SessionObject.InterfaceTSP)
            {
            }
        }
        private void GetColonneImport(int codeImport)
        {
            AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.GetAllImportFichierColonneCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                listColonne = res.Result;
                if (listColonne != null && listColonne.Count > 0)
                {
                    dgColonne.ItemsSource = listColonne;
                }
            };
            service1.GetAllImportFichierColonneAsync(codeImport);
            service1.CloseAsync();
        }
        private void GetColonneImport(int codeImport)
        {
            List <aImportFichierColonne> listColonne = new List <aImportFichierColonne>();
            AdministrationServiceClient  service1    = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.GetAllImportFichierColonneCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                listColonne = res.Result;
                if (listColonne != null && listColonne.Count > 0)
                {
                    txtNbCol.Text = listColonne.Count.ToString();
                }
            };
            service1.GetAllImportFichierColonneAsync(codeImport);
            service1.CloseAsync();
        }
        private void ChargeGrid()
        {
            List <aImportFichier> LstImport = new List <aImportFichier>();

            AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.GetAllImportCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                LstImport = res.Result;
                if (LstImport != null && LstImport.Count > 0)
                {
                    dgImport.ItemsSource = LstImport;
                }
            };
            service1.GetAllImportAsync();
            service1.CloseAsync();
        }
        private void DeleteColonneImport(int idcolone)
        {
            bool DeleteImport = false;
            AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.DeleteColonneCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                DeleteImport = res.Result;
                if (DeleteImport == true)
                {
                    Message.ShowInformation("Supprimé!", "Paramétrage");
                    GetColonneImport(CodeImport);
                }
            };
            service1.DeleteColonneAsync(idcolone);
            service1.CloseAsync();
        }
        private void ChargeInformation(int codeimport)
        {
            AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.GetImportFichierCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                SelectImport = res.Result;
                if (SelectImport != null)
                {
                    code_import            = codeimport;
                    txtTitre.Text          = SelectImport.LIBELLE;
                    txtDesc.Text           = SelectImport.DESCRIPTION;
                    txtProc.Text           = SelectImport.COMMANDE;
                    txtNbCol.Text          = SelectImport.NBPARAMETRE.ToString();
                    ChkProcedure.IsChecked = SelectImport.ISPROCEDURE;
                }
                if (!string.IsNullOrWhiteSpace(SelectImport.REPERTOIRE) && !string.IsNullOrWhiteSpace(SelectImport.FICHIER))
                {
                    txtRepert.Text         = SelectImport.REPERTOIRE;
                    txtFichier.Text        = SelectImport.FICHIER;
                    chkb_Fichier.IsChecked = true;
                }
                else if (!string.IsNullOrEmpty(SelectImport.PROVIDER) && !string.IsNullOrEmpty(SelectImport.SERVER) && !string.IsNullOrEmpty(SelectImport.BASEDEDONNE) && !string.IsNullOrEmpty(SelectImport.UTILISATEUR) && !string.IsNullOrEmpty(SelectImport.MOTDEPASSE))
                {
                    chkb_BaseDeDonnee.IsChecked = true;
                }
                else
                {
                    chkb_Fichier.IsChecked      = true;
                    chkb_BaseDeDonnee.IsChecked = false;
                }
                btn_Config_Bd.IsEnabled = true;
            };
            service1.GetImportFichierAsync(codeimport);
            service1.CloseAsync();
        }
        private void ImportDepuisBaseDeDonnee(aImportFichier objetselectionne)
        {
            //List<string> listImport = null;
            List <aImportFichierColonne> list     = new List <aImportFichierColonne>();
            AdministrationServiceClient  service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.ImportDepuisBaseDeDonneeCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                //listImport = res.Result;
                //if (listImport != null && listImport.Count > 0)
                //{

                //    Message.ShowInformation("Synchronisation réussie", "Paramétrage");
                //}
                //else
                //{
                //if (listImport == null)
                //{

                //Message.ShowInformation("Fichier non trouvé. Vérifier le paramétrage", "Paramétrage");
                //}
                if (res.Result == false)
                {
                    Message.ShowInformation("Synchronisation echoué. Aucune nouvelle ligne", "Paramétrage");
                }
                else
                {
                    Message.ShowInformation("Synchronisation réussie", "Paramétrage");
                }
            };
            service1.ImportDepuisBaseDeDonneeAsync(objetselectionne);
            service1.CloseAsync();
        }
        private void MiseAjourColonneImport(aImportFichierColonne importColonne)
        {
            bool UpdateImport = false;
            AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));

            service1.MisaAjourImportColonneCompleted += (sr, res) =>
            {
                if (res != null && res.Cancelled)
                {
                    return;
                }
                UpdateImport = res.Result;
                if (UpdateImport == true)
                {
                    GetColonneImport(CodeImport);
                }
                else
                {
                    Message.ShowError("Echoué", "Paramétrage");
                }
            };
            service1.MisaAjourImportColonneAsync(importColonne);
            service1.CloseAsync();
        }
        private void btnStructure_Click_1(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtNbCol.Text))
            {
                if (txtTitre.Text != null && !string.IsNullOrEmpty(txtProc.Text))
                {
                    aImportFichier importation = new aImportFichier();

                    if (!string.IsNullOrEmpty(txtRepert.Text) && !string.IsNullOrEmpty(txtFichier.Text))
                    {
                        //{
                        importation.CODE        = code_import;
                        importation.LIBELLE     = txtTitre.Text;
                        importation.DESCRIPTION = txtDesc.Text;
                        importation.COMMANDE    = txtProc.Text;
                        importation.REPERTOIRE  = txtRepert.Text;
                        importation.FICHIER     = txtFichier.Text;
                        importation.NBPARAMETRE = (string.IsNullOrEmpty(txtNbCol.Text)) ? 0 : int.Parse(txtNbCol.Text);
                        importation.ISPROCEDURE = (ChkProcedure.IsChecked == true) ? true : false;

                        //};
                    }
                    else if (!string.IsNullOrEmpty(SelectImport.PROVIDER) && !string.IsNullOrEmpty(SelectImport.SERVER) && !string.IsNullOrEmpty(SelectImport.BASEDEDONNE) && !string.IsNullOrEmpty(SelectImport.UTILISATEUR) && !string.IsNullOrEmpty(SelectImport.MOTDEPASSE))
                    {
                        importation.CODE                  = code_import;
                        importation.LIBELLE               = txtTitre.Text;
                        importation.DESCRIPTION           = txtDesc.Text;
                        importation.COMMANDE              = txtProc.Text;
                        importation.PROVIDER              = SelectImport.PROVIDER;
                        importation.SERVER                = SelectImport.SERVER;
                        importation.BASEDEDONNE           = SelectImport.BASEDEDONNE;
                        importation.UTILISATEUR           = SelectImport.UTILISATEUR;
                        importation.MOTDEPASSE            = SelectImport.MOTDEPASSE;
                        importation.REQUTETTEBASEDISTANTE = SelectImport.REQUTETTEBASEDISTANTE;
                        importation.NBPARAMETRE           = (string.IsNullOrEmpty(txtNbCol.Text)) ? 0 : int.Parse(txtNbCol.Text);
                        importation.ISPROCEDURE           = (ChkProcedure.IsChecked == true) ? true : false;
                    }
                    else
                    {
                        Message.ShowInformation("Veuillez saisir les parametres ", "Paramétrage");
                    }


                    int UpdateImport = 0;
                    AdministrationServiceClient service1 = new AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration"));
                    service1.MisaAjourImportFichierCompleted += (sr, res) =>
                    {
                        if (res != null && res.Cancelled)
                        {
                            return;
                        }
                        UpdateImport = res.Result;
                        if (UpdateImport != 0)
                        {
                            code_import = UpdateImport;
                            FrmImportFichierColonne ctr = new FrmImportFichierColonne(code_import);
                            ctr.Closed += form_Closed;
                            ctr.Show();
                        }
                    };
                    service1.MisaAjourImportFichierAsync(importation);
                    service1.CloseAsync();
                }
                else
                {
                    Message.ShowInformation("Veuillez saisir les parametres ", "Paramétrage");
                }
            }
            else
            {
                FrmImportFichierColonne ctr = new FrmImportFichierColonne(code_import);
                ctr.Closed += form_Closed;

                ctr.Show();
            }
        }