Example #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.");
        }
Example #2
0
        /// <summary>
        /// Creates the ninja catalogue.
        /// </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 CreateNinjaCatalogue(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter   = "JSON files (*.json)|*.json";
            saveFileDialog.FileName = "NinjaCatalogue";

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                string            filePath = saveFileDialog.FileName;
                INinjaFactoryData db       = this.DB;

                NinjaCatalogueCreator creator = new NinjaCatalogueCreator();
                creator.CreateJson(db, filePath);
                MessageBox.Show("Ninjas catalog created successfully!");
            }
        }