/// <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."); }
/// <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."); } }
/// <summary> /// Creates the ninja ranking raport. /// </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 CreateNinjaRankingRaport(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel files (*.xlsx)|*.xlsx"; saveFileDialog.FileName = "NinjaRankingReport"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { string filePath = saveFileDialog.FileName; NinjaCatalogueModel mySqlDb = this.mySqlDb; ExcelSuccessRateReportCreator excelCreator = new ExcelSuccessRateReportCreator(); excelCreator.CreateSuccessRateReport(mySqlDb, filePath); MessageBox.Show("NinjaRankingReport generated!"); } }
public JsonToMySqlImporter(NinjaCatalogueModel mySqlContext) { this.mySqlContext = mySqlContext; }
/// <summary> /// Initializes a new instance of the <see cref="NinjaFactoryApp" /> class. /// </summary> public NinjaFactoryApp() { this.InitializeComponent(); this.DB = new NinjasData(); this.mySqlDb = new NinjaCatalogueModel(); }