private void SaveSql() { if (!String.IsNullOrEmpty(this.sqlGenerated)) { string commandName = this.mchkUseReplaceInto.Checked ? "replace" : "insert"; this.saveFileDialog1.FileName = String.Format( "{0}-{1}-{2}.sql", this.DbConnection.Database, this.TableName, commandName ); if (this.saveFileDialog1.ShowDialog() == DialogResult.OK) { try { using (StreamWriter sw = new StreamWriter(this.saveFileDialog1.FileName)) { sw.Write(this.sqlGenerated); MetroMsgBoxUtil.Success(this, "已保存", "成功"); } } catch (Exception ex) { MetroMsgBoxUtil.Fail(this, ex.Message, "失败"); } } } }
private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { this.metroProgressSpinner1.Visible = false; this.dgvValidation.DataSource = dtFailCells; if (dtFailCells.Rows.Count > 0) { MetroMsgBoxUtil.Warning(this, String.Format("有 {0} 个单元格的内容未通过校验。", dtFailCells.Rows.Count), "Warning"); } else { MetroMsgBoxUtil.Success(this, "数据校验通过", "Success"); } }
private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { this.metroProgressSpinner1.Visible = false; switch (operationFlag) { case "excute": int affected = ExcuteSql(); MetroMsgBoxUtil.Success(this, "导入完成(" + affected + "行受影响)", "成功"); break; case "save": SaveSql(); break; default: break; } }