Esempio n. 1
0
        private static void Initialize()
        {
            //MessageBox.Show("Inicializando");
            try
            {
                var dir = ConfigurationManager.AppSettings["Directory.Setup"];

                var path   = ConfigurationManager.AppSettings["File.Remote.Server"];
                var stream = new StreamReader(Path.Combine(dir, path));

                //var remoteServer = "https://sisfarma.es/api-cuadromandos";//stream.ReadLine();
                //var remoteToken = "f3d0b8171f8b6c1ed0566ca1570c86cc";//stream.ReadLine();
                var remoteServer = stream.ReadLine();
                var remoteToken  = stream.ReadLine();
                SisfarmaFactory.Setup(remoteServer, remoteToken);

                var local = GetConnexionLocal(remoteServer, remoteToken);

                FarmaciaContext.Setup(local.localServer, local.localUser, local.localPass, local.marketCodeList);
            }
            catch (IOException ex)
            {
                MessageBox.Show("Error: " + ex.Message);
                throw new IOException("Ha habido un error en la lectura de algún fichero de configuración. Compruebe que existen dichos ficheros de configuración.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
Esempio n. 2
0
        private static void Initialize()
        {
            try
            {
                var dir = ConfigurationManager.AppSettings["Directory.Setup"];

                var path         = ConfigurationManager.AppSettings["File.Remote.Server"];
                var stream       = new StreamReader(Path.Combine(dir, path));
                var remoteServer = stream.ReadLine();

                remoteServer = remoteServer.Replace("https://sisfarma.es", "https://api.sisfarma.es");
                remoteServer = remoteServer.Replace("https://sisfarma.pro", "https://api.sisfarma.pro");
                remoteServer = remoteServer.Replace("https://sistemasfarmaceuticos.es", "https://api.sistemasfarmaceuticos.es");

                var remoteToken = stream.ReadLine();
                SisfarmaFactory.Setup(remoteServer, remoteToken);

                var local = GetConnexionLocal(remoteServer, remoteToken);

                FarmaciaContext.Setup(local.pathFicheros, local.password, local.marketCodeList);
            }
            catch (IOException)
            {
                throw new IOException("Ha habido un error en la lectura de algún fichero de configuración. Compruebe que existen dichos ficheros de configuración.");
            }
        }