Exemple #1
0
        private void OptAnvll()
        {
            try
            {
                using (var db = this.CreateCerebelloEntities())
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine("Saving to: {0}", new FileInfo("medicines.json").FullName);

                    // Downloading data from Anvisa official site.
                    var anvisaHelper = new AnvisaLeafletHelper();
                    var meds = anvisaHelper.DownloadAndCreateMedicinesJson();

                    Console.WriteLine("Total medicines: {0}", meds.Count);
                    Console.WriteLine("Saved to: {0}", new FileInfo("medicines.json").FullName);

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Done!");
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
            catch (Exception ex)
            {
                ConsoleHelper.ConsoleWriteException(ex);

                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("Partially done!");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Exemple #2
0
        private void InitSysTables(CerebelloEntities db)
        {
            Console.WriteLine("Initialize_SYS_MedicalEntity");
            Firestarter.Initialize_SYS_MedicalEntity(db);

            Console.WriteLine("Initialize_SYS_MedicalSpecialty");
            Firestarter.Initialize_SYS_MedicalSpecialty(db);

            Console.WriteLine("Initialize_SYS_Contracts");
            Firestarter.Initialize_SYS_Contracts(db);

            Console.WriteLine("Initialize_SYS_Cid10");
            Firestarter.Initialize_SYS_Cid10(
                db,
                progress: ConsoleHelper.ConsoleWriteProgressIntInt);

            Console.WriteLine("Initialize_SYS_MedicalProcedures");

            var cbhpmFilePath = Path.Combine(this.rootCerebelloPath, @"DB\cbhpm_2010.txt");
            if (!File.Exists(cbhpmFilePath))
            {
                cbhpmFilePath = "cbhpm_2010.txt";
                if (!File.Exists(cbhpmFilePath))
                    throw new Exception("Could not find file cbhpm_2010.txt");
            }

            Firestarter.Initialize_SYS_MedicalProcedures(
                db,
                cbhpmFilePath,
                progress: ConsoleHelper.ConsoleWriteProgressIntInt);

            Console.WriteLine("SaveLeafletsInMedicinesJsonToDb");
            var anvisaHelper = new AnvisaLeafletHelper();
            anvisaHelper.SaveLeafletsInMedicinesJsonToDb(
                db,
                progress: ConsoleHelper.ConsoleWriteProgressIntInt);

            // Creating a minimal DB backup called __zero__.
            if (this.isFuncBackupEnabled) Firestarter.CreateBackup(db, "__zero__");
        }