コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Elinos/Wyvern
        private void ToMySQLButton_Click(object sender, RoutedEventArgs e)
        {
            bool result = false;
            var mySqlManager = new MySQLManager();
            mySqlManager.ClearMySqlDb();
            result = mySqlManager.LoadAllReportsDataFromSQLServer();
            var sqLiteManager = new SQLiteManager();
            sqLiteManager.DeleteAllEntities("Discounts");
            var reportsEngine = new ReportsEngine();
            var discounts = reportsEngine.GetDiscountsInfo();

            foreach (var discount in discounts)
            {
                result = sqLiteManager.CreateDiscountForCompany(discount.CompanyId, discount.TypeID);
            }

            if (result)
            {
                Result.Text = "Import to MySQL has been successfully completed!";
                Result.Foreground = Brushes.Green;
            }
            else
            {
                Result.Text = "Import to MySQL failed!";
                Result.Foreground = Brushes.Red;
            }
        }