private void ExportMsSqlToMySql_Click(object sender, EventArgs e) { var msSqlRepo = new MSSQLRepository(); var mySqlRepo = new MySQLRepository(); try { var productsData = msSqlRepo.GetFullProductsData(); mySqlRepo.AddSqlProductsToMySql(productsData); MessageBox.Show("MySQL data seeded from MSSQL Server!"); } catch (Exception dbe) { MessageBox.Show("MySQL db seed failed: " + dbe); } }
private void GenerateSalesPdf_Click(object sender, EventArgs e) { var msSqlRepo = new MSSQLRepository(); try { PdfUtility.CreatePdfFile(msSqlRepo.GetSalesByDate( DateTime.Parse(this.startDatePicker.Text), DateTime.Parse(this.endDatePicker.Text))); MessageBox.Show("Successfully exported data!"); } catch (Exception ex) { MessageBox.Show("Error exporting data: " + ex.Message); } }
private void ImportSalesFromXls_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog(); var msSqlRepo = new MSSQLRepository(); if (openFileDialog.ShowDialog() == DialogResult.OK) { var filePath = openFileDialog.FileName; using (var zip = ZipFile.Open(filePath, ZipArchiveMode.Read)) { try { var sales = ExcelUtility.ReadSalesReportData(zip); msSqlRepo.FillSalesDataToSql(sales); MessageBox.Show("Successfully added sales reports."); } catch (Exception ex) { MessageBox.Show("Precedure failed: " + ex.Message); } } } }
private void ReplicateOracle_Click(object sender, EventArgs e) { var msSqlRepo = new MSSQLRepository(); var oracleRepo = new OracleRepository(); try { var productData = oracleRepo.GetOracleProductsData(); msSqlRepo.FillOracleDataToMsSql(productData); MessageBox.Show("Oracle data replicated complete!"); } catch (Exception ex) { MessageBox.Show("Oracle data replicated failed: " + ex.Message); } }
private void ImportXmlToSql_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog(); var msSqlRepo = new MSSQLRepository(); if (openFileDialog.ShowDialog() == DialogResult.OK) { try { var filePath = openFileDialog.FileName; var vendorExpensesData = XmlUtility.ReadXmlReport(filePath); msSqlRepo.FillExpensesDataToSql(vendorExpensesData); MessageBox.Show("Xml report imported successfully!"); } catch (Exception ex) { MessageBox.Show("Failed while importing xml report: " + ex.Message); } } }