private void ReportProgress(string message, int percentage) { if (OnProgressChange != null) { var report = new ProgressReoprt(); report.Message = message; report.PercentDone = percentage; OnProgressChange.Report(report); } }
private void ReportProgress(string message, int percentage) { if (OnProgressChange != null) { ProgressReoprt report = new ProgressReoprt { Message = message, PercentDone = percentage }; OnProgressChange.Report(report); } }
public void Upload(SqlConnection connection, bool dropExistingTable) { SqlCommand sqlCommand; try { if (connection.State == System.Data.ConnectionState.Closed) { connection.Open(); } if (dropExistingTable) { ReportProgress("Dropping Table", 0); try { DropTable(connection); } catch { } } ReportProgress("Creating Table", 0); CreateTable(connection); var mapFeatures = Mapper.GetMapFeatures().ToArray(); for (var i = 0; i < mapFeatures.Length; i++) { ReportProgress(GetProgressMessage(mapFeatures[i]), GetPercentage(i + 1, mapFeatures.Length)); sqlCommand = mapFeatures[i].GetInsertCommand(); sqlCommand.Connection = connection; sqlCommand.ExecuteNonQuery(); } ReportProgress("Done!", 100); } catch (Exception ex) { if (OnProgressChange != null) { OnProgressChange.Report(new ProgressReoprt() { Exception = ex }); } throw; } }