示例#1
0
 private void bw_LithoImportRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     ImportStatusWindow ii = new ImportStatusWindow();
     ii.SetData(latestImportUpdateStatus);
     ii.ShowDialog();
 }
示例#2
0
        /// <summary>
        /// The import of assays is complete
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bw_CoalQualityImportRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (latestImportUpdateStatus != null)
            {
                ImportStatusWindow ii = new ImportStatusWindow();
                ii.SetData(latestImportUpdateStatus);
                ii.ShowDialog();
            }

        }
示例#3
0
        private void CollarImportExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            if (ComboBoxProjectList.SelectedValue == null)
            {
                ComboBoxProjectList.BorderBrush = Brushes.Red;
                MessageBox.Show("You must select a project before importing");
                return;
            }
            Guid NKDProjectID = (Guid)ComboBoxProjectList.SelectedValue;
            bool overwrite = (bool)checkBoxOverwrite.IsChecked;


            ImportDataMap importMap = MapConfigTable.GetImportDataMap(SelectedFile, MapConfigTable.collarPrimaryTableName, (SelectedFile.ToLower().IndexOf(".csv") > -1) ? ',' : '\t', ImportDataPreview.MaxColumns);
            // add into map details of which columns are foreign keys
            if (collarDBFields != null)
            {
                importMap.UpdateWithFKInof(collarDBFields);
            }

            // get the selected project ID

            var rawFileReader = new RawFileReader((SelectedFile.ToLower().IndexOf(".csv") > -1) ? ',' : '\t');
            ModelImportStatus status = commandDirector.DoCollarImport(SelectedFile, SelectedFormatFile, importMap, rawFileReader, NKDProjectID, overwrite);
            latestImportUpdateStatus = status;
            //if(status.finalErrorCode != ModelImportStatus.OK){
            //    string ss = status.GenerateStringMessage(true);
            //    lastestImportUpdateStatus.SaveReportData();
            //    if (status.finalErrorCode == ModelImportStatus.DATA_CONSISTENCY_ERROR)
            //    {
            //        string headline = "Import complete.  " + status.linesReadFromSource + " data lines read, " + status.recordsAdded + " new records added \n" + status.recordsUpdated + " existing records updated.";
            //        MessageBox.Show("Warnings issued during import.\n\n" + headline + ".\n\n" + ss);
            //    }
            //    else
            //    {
            //        MessageBox.Show("Import failed.  " + ss);
            //    }

            //}else{

            //    MessageBox.Show("Import complete.  "+status.linesReadFromSource+" data lines read, "+status.recordsAdded+" new records added \n"+status.recordsUpdated+" existing records updated.");

            //}

            if (latestImportUpdateStatus != null)
            {
                ImportStatusWindow ii = new ImportStatusWindow();
                ii.SetData(latestImportUpdateStatus);
                ii.ShowDialog();
            }

            //workerBMDataImport = new BackgroundWorker();
            //workerBMDataImport.WorkerReportsProgress = true;
            //workerBMDataImport.WorkerSupportsCancellation = false;
            //workerBMDataImport.DoWork += bw_DoCollarImportWork;
            //// Method to call when Progress has changed
            //workerBMDataImport.ProgressChanged += bw_BMImportProgressChanged;
            //// Method to run after BackgroundWorker has completed?
            //workerBMDataImport.RunWorkerCompleted += bw_BMImportRunWorkerCompleted;
            //workerBMDataImport.RunWorkerAsync(importMap);
            e.Handled = true;

        }