Beispiel #1
0
        private void DoDaFix()
        {
            // Enter your SQL code here
            // To run a T-SQL statement with no results, int RecordsAffected = _jurisUtility.ExecuteNonQueryCommand(0, SQL);
            // To get an ADODB.Recordset, ADODB.Recordset myRS = _jurisUtility.RecordsetFromSQL(SQL);


            //get all entryids into a list, count them and then send them one at a time to the time/expense processor
            current = 0;
            Errors  = null;
            Errors1 = null;

            if (radioButtonT.Checked)
            {
                getTotalRecords(1);
                TimeProcessor tpThread = new TimeProcessor(_jurisUtility);
                backgroundWorkerTime.RunWorkerAsync(tpThread);
            }
            else if (radioButtonE.Checked)
            {
                getTotalRecords(2);
                ExpenseProcessor epThread = new ExpenseProcessor(_jurisUtility);
                backgroundWorkerExp.RunWorkerAsync(epThread);
            }
            else if (radioButtonTE.Checked)
            {
                getTotalRecords(3);
                BothProcessor bpThread = new BothProcessor(_jurisUtility);
                backgroundWorkerAll.RunWorkerAsync(bpThread);
            }
            else
            {
                MessageBox.Show("Please select an Entry Type before continuing", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void backgroundWorkerTime_DoWork(object sender, DoWorkEventArgs e)
        {
            current = 0;
            tproc   = e.Argument as TimeProcessor;
            BackgroundWorker worker = sender as BackgroundWorker;

            try
            {
                for (int a = 6; a < 10; a++)
                {
                    tproc.processTimeEntries(a.ToString());
                    backgroundWorkerTime.ReportProgress(current);
                    var tlist = tproc.allTimes.ToList();
                    foreach (TimeEntry tt in tlist)
                    {
                        current++;
                        tproc.compareTimeEntries(tt);
                        backgroundWorkerTime.ReportProgress(current);
                    }
                }
            }
            catch (Exception ex1)
            {
                e.Result = ex1;
            }

            if (tproc.correctedTimes.Count == 0)
            {
                MessageBox.Show("There were no issues found in your time entries," + "\r\n" + "so no changes are needed. The tool will now close");
                Environment.ExitCode = 1;
                Application.Exit();
            }
            else
            {
                DataTable dt = ConvertTo(tproc.correctedTimes);
                Errors = new DataSet();
                Errors.Tables.Add(dt);
                DialogResult tpr = seePreReport();
                if (tpr == DialogResult.Yes)
                {
                    ReportDisplay rpds = new ReportDisplay(Errors, null, 0);
                    rpds.ShowDialog();
                    for (int d = 0; d < 10; d++)
                    {
                        var typeList = tproc.correctedTimes.Where(c => c.newEntryStatus == d).ToList();
                        tproc.updateTimeEntries(typeList, d);
                        backgroundWorkerTime.ReportProgress(current);
                        current++;
                    }
                }
                else if (tpr == DialogResult.No)
                {
                    for (int d = 0; d < 10; d++)
                    {
                        var typeList = tproc.correctedTimes.Where(c => c.newEntryStatus == d).ToList();
                        tproc.updateTimeEntries(typeList, d);
                        backgroundWorkerTime.ReportProgress(current);
                        current++;
                    }
                }
                else if (tpr == DialogResult.Cancel)
                {
                    Environment.ExitCode = 1;
                    Application.Exit();
                }
            }
        }