1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| private void bgwDesign_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
string supplier = this.ucSelectProduct1.Supplier;
string product = this.ucSelectProduct1.Product;
string tint = this.ucSelectProduct1.Tint;
string process = this.ucSelectProduct1.Process;
dirExportName1 = ConfigurationManager.AppSettings["dirExportName1"];
dirExportName2 = ConfigurationManager.AppSettings["dirExportName2"];
dirExportChoice = ConfigurationManager.AppSettings["dirExportChoice"];
object[] parameters = new object[] { null, supplier, product, tint, process };
dal = new DalConnectionTools(this.connectionString1);
dal2 = new DalConnectionTools(this.connectionString2);
if (!Directory.Exists(this.dirExportChoice + this.dirExportName1))
{
Directory.CreateDirectory(this.dirExportChoice + this.dirExportName1);
}
if (!Directory.Exists(this.dirExportChoice + this.dirExportName2))
{
Directory.CreateDirectory(this.dirExportChoice + this.dirExportName2);
}
try
{
BeProductOpt bpo = new BeProductOpt();
InfoEvent info;
//Table ADDITION
Array.Resize(ref parameters, parameters.Length + 2);
parameters.SetValue("%", 5);
parameters.SetValue("%", 6);
info = bpo.GetBesBaseArray(dal, parameters, this.dirExportChoice + this.dirExportName1, "BeasAddition", false);
//worker.ReportProgress((int)((double)100/(double)42), info);
worker.ReportProgress(50, info);
info = bpo.GetBesBaseArray(dal2, parameters, this.dirExportChoice + this.dirExportName2, "BeasAddition", true);
worker.ReportProgress(100, info);
}
catch (SqlException se)
{
MessageBox.Show(se.Message);
}
if (worker.CancellationPending)
{
e.Cancel = true;
}
else
MessageBox.Show("test");
} |
Partager