Esempio n. 1
0
        /// <summary>
        /// Loads the ninja catalogue to my SQL directly.
        /// </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The <see cref="EventArgs" /> instance containing the event data. </param>
        private void LoadNinjaCatalogueToMySqlDirectly(object sender, EventArgs e)
        {
            NinjaCatalogueModel mySqlDb  = this.mySqlDb;
            JsonToMySqlImporter importer = new JsonToMySqlImporter(mySqlDb);
            var catalogue   = new NinjaCatalogueCreator().GetNinjaCatalogueFromDb(this.DB);
            int recordCount = importer.Run(catalogue);

            MessageBox.Show("Loaded " + recordCount + " records.");
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the backup.
        /// </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The <see cref="EventArgs" /> instance containing the event data. </param>
        /// <exception cref="System.NotImplementedException"> Not Implemented </exception>
        private void LoadCatalogueInMySql(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "JSON files (*.json)|*.json";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string filePath             = openFileDialog.FileName;
                NinjaCatalogueModel mySqlDb = this.mySqlDb;

                JsonToMySqlImporter importer = new JsonToMySqlImporter(mySqlDb);
                var recordCount = importer.Run(filePath, new NinjaCatalogueJsonParser());
                MessageBox.Show("Loaded " + recordCount + " records.");
            }
        }