예제 #1
0
        /// <summary>
        /// Exemple ligne de commande
        /// TimosAuthDataBase.exe 127.0.0.1 TIMOS_USERS_PREPROD "Data Source=DESKTOP-VMDEVYK\SQLEXPRESS;Initial Catalog=TIMOS_USERS_DB;Integrated Security=True;Pooling=False"
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            CResultAErreur result = CResultAErreur.True;

            string strURL               = "tcp://127.0.0.1:8160";
            string strNomTable          = "TIMOS_USERS_PREPROD";
            string strChaineDeConnexion = @"Data Source=DESKTOP-VMDEVYK\SQLEXPRESS;Initial Catalog=TIMOS_USERS_DB;Integrated Security=True;Pooling=False";

            if (args.Length > 0)
            {
                strURL = "tcp://" + args[0] + ":8160";
                if (args.Length > 1)
                {
                    strNomTable = args[1];
                }
                if (args.Length > 2)
                {
                    strChaineDeConnexion = args[2];
                }
            }
            try
            {
                result = CInitialiseurClientTimos.InitClientTimos(strURL, 0, "", null);
            }
            catch { }

            if (result)
            {
                CSessionClient session = CSessionClient.CreateInstance();
                result = session.OpenSession(new CAuthentificationSessionProcess(), "Timos Auth Database", ETypeApplicationCliente.Process);
                if (!result)
                {
                    result.EmpileErreur("Erreur lors de l'authentification");
                }
                if (result)
                {
                    Console.WriteLine("Argument 1 = " + strURL);
                    Console.WriteLine("Argument 2 = " + strNomTable);

                    result = GetTimosUsers(session.IdSession, strNomTable);
                    if (result && result.Data != null)
                    {
                        DataSet dataSource = result.Data as DataSet;
                        result = UpdateDatabase(strChaineDeConnexion, strNomTable, dataSource);
                    }
                    session.CloseSession();
                }
            }
            if (!result)
            {
                Console.WriteLine(result.MessageErreur);
            }
            //Console.ReadKey();
        }
예제 #2
0
        public static void AssureInit()
        {
            CResultAErreur result = CResultAErreur.True;

            if (m_sessionClient == null)
            {
                result = CInitialiseurClientTimos.InitClientTimos(new CSpvTestRegistre());
                if (!result)
                {
                    throw new Exception(result.Erreur.ToString());
                }
                m_sessionClient = CSessionClient.CreateInstance();
                result          = m_sessionClient.OpenSession(new CAuthentificationSessionServiceClient());
                if (!result)
                {
                    throw new Exception(result.Erreur.ToString());
                }
            }
        }