Beispiel #1
0
        private void timerRapideCode(object source, ElapsedEventArgs e)
        {
            log.Info("IimerRapide 2s Tick !");
            if (!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString()))
            {
                string[] wszcl00UrlList = sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString().Split(';');
                //string wszcl00Url = sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString();
                foreach (string wszcl00Url in wszcl00UrlList)
                {
                    string nomMachine = "";
                    try
                    {
                        nomMachine = Environment.MachineName;
                    }
                    catch (Exception exp)
                    {
                        log.Error("nomMachine " + exp.Message);
                    }

                    timerRapide.Stop();
                    try
                    {
                        WSZCL00.WSZCL00 wszcl00 = new WSZCL00.WSZCL00();
                        wszcl00.Url = wszcl00Url;
                        if ((!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.wsUsername)) && (!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.wsPassword)))
                        {
                            WSZCL00.Authentication header = new WSZCL00.Authentication();

                            header.Username = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                            //sfwServiceTache.Properties.Settings.Default.wsUsername; //"toto";
                            if (header.Username == "")
                            {
                                header.Username = SafeWare.Chiffrement.DechiffreOld(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                                header.Password = SafeWare.Chiffrement.DechiffreOld(sfwServiceTache.Properties.Settings.Default.wsPassword, SafeWare.Chiffrement.password); // "toto";
                            }
                            else
                            {
                                header.Username = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                                header.Password = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsPassword, SafeWare.Chiffrement.password); // "toto";
                            }

                            log.Info("**** AFTER SET HEADER [" + header.Username + ":" + header.Password + "}");

                            wszcl00.AuthenticationValue = header;
                        }



                        wszcl00.copieFichier(nomMachine);
                        log.Debug("Telem Access copieFichier !");
                    }
                    catch (Exception exp)
                    {
                        log.Error(exp.Message);
                    }
                    timerRapide.Start();
                }
            }
        }
Beispiel #2
0
        private void timerMinuteCode(object source, ElapsedEventArgs e)
        {
            log.Info("Iimer1 Tick !");
            if (!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString()))
            {
                string[] wszcl00UrlList = sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString().Split(';');
                //string wszcl00Url = sfwServiceTache.Properties.Settings.Default.sfwServiceTache_WSZCL00_WSZCL00.ToString();
                foreach (string wszcl00Url in wszcl00UrlList)
                {
                    string nomMachine = "";
                    try
                    {
                        nomMachine = Environment.MachineName;
                    }
                    catch (Exception exp)
                    {
                        log.Error("nomMachine " + exp.Message);
                    }

                    timerMinute.Stop();
                    try
                    {
                        WSZCL00.WSZCL00 wszcl00 = new WSZCL00.WSZCL00();
                        wszcl00.Url = wszcl00Url;
                        if ((!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.wsUsername)) && (!String.IsNullOrEmpty(sfwServiceTache.Properties.Settings.Default.wsPassword)))
                        {
                            WSZCL00.Authentication header = new WSZCL00.Authentication();

                            header.Username = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                            //sfwServiceTache.Properties.Settings.Default.wsUsername; //"toto";
                            if (header.Username == "")
                            {
                                header.Username = SafeWare.Chiffrement.DechiffreOld(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                                header.Password = SafeWare.Chiffrement.DechiffreOld(sfwServiceTache.Properties.Settings.Default.wsPassword, SafeWare.Chiffrement.password); // "toto";
                            }
                            else
                            {
                                header.Username = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsUsername, SafeWare.Chiffrement.password); //
                                header.Password = SafeWare.Chiffrement.Dechiffre(sfwServiceTache.Properties.Settings.Default.wsPassword, SafeWare.Chiffrement.password); // "toto";
                            }

                            wszcl00.AuthenticationValue = header;
                        }

                        wszcl00.copieFichier(nomMachine);
                        log.Debug("Telem Access copieFichier !");

                        // Liste des sites ayant besoin d'un action pour ce poste
                        // boucle sur les listes
                        foreach (string paramSite in wszcl00.getSitesNonTraite(nomMachine))
                        {
                            log.Info("**** getSitesTraiteNow [" + paramSite + "}");
                            wszcl00.getSitesTraiteNow(paramSite);
                        }

                        wszcl00.verifierSortiesCTRL(nomMachine);
                        log.Debug("Telem Access sorties ctrl !");
                        wszcl00.synchro(nomMachine);
                        log.Debug("Telem Access synchro !");
                        wszcl00.entrerLmp(nomMachine);
                        log.Debug("Telem Access LPM !");
                    }
                    catch (Exception exp)
                    {
                        log.Error(exp.Message);
                    }
                    timerMinute.Start();
                    log.Debug("Iimer1 Tick ! End");
                }
            }
        }