private void Button_UpdateQueues_Click(object sender, RoutedEventArgs e)
        {
            this.Button_UpdateQueues.IsEnabled = false;
             BackgroundWorker worker = new BackgroundWorker();

             worker.DoWork += delegate(object s, DoWorkEventArgs args)
             {
                 StatusReporter reporter = new StatusReporter();
                 reporter.updateQueues();
             };
             worker.RunWorkerAsync();

             this.Button_UpdateQueues.IsEnabled = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// moves files to a failed folder and emails a recipient and logs the fail
        /// </summary>
        /// <param name="file">the file to be processed</param>
        /// <param name="report">the report to email</param>
        private static void failFile(FileInfo file, string report, testingSpecs target)
        {
            StatusReporter reporter = new StatusReporter();
            reporter.addFail(file.Name, report);

            string projectFileName;
            if (target.projectFile == null)
            {
                 projectFileName = "No Project";
            }
            else
            {
                 projectFileName = System.IO.Path.GetFileNameWithoutExtension(target.projectFile.Name);
            }
            reporter.addResult(4, file.Name, projectFileName, report);

            Adjudicator adjudicator = new Adjudicator();
            adjudicator.googleBot.logItConference(file.Name, report);
                try
                {
                    taskmaster.moveAfterAutoQCFail(file);
                }
                catch (Exception e)
                {
                    logger.writeErrorLog(e, file.FullName);
                    //MessageBox.Show("Could not move the file because: \n" + e.Message + "\n---------------------------------------\n" + e.ToString());
                }
            

            // use the reporter for the mini sheet


            //save to txt file
            logger.saveToTXT("AutoQCLog", logsDirectory,file.Name +
                      "\r\n------------------------------------------------------------\r\n" +
                      "failed on \n\r" +
                      DateTime.Now.ToString() +
                      " because: " +
                      report +
                      "\r\n" +
                      "\r\n" +
                      "\r\n");

            logger.saveToTabDilimited("AutoQCTabLog", logsDirectory, file.Name + "\t" + " :" + report + "\t" + DateTime.Now.ToString() + "\t" + "AutoQC" + "\r\n");

            string emailMessage = "Dear User,\r\n\n" + "The following file: \r\n\n" + file.Name + "\r\n\n" + report + "\r\n\n" + "Thanks, \r\n\n" + "QC Android Lady";

            string recipient = utility.getValueFromXML(target.projectFile, "ToEmailOnFail");

            if (recipient == null || recipient == "NA")
            {
                recipient = "*****@*****.**";
            }

            if (file.Name.Contains("Training"))
            {
                return;
            }
            email(file.Name + " failed auto-qc: " + report, emailMessage, recipient);
  
            //if(file.Name.Contains("2012-10-"))
            //{
            //    //track it on the Google doc
            //    new Googler(file.Name, report);
            //}
        }
Exemplo n.º 3
0
        //TODO: figure out what the report parameter report does.  Johnson?
        public bool ProcessFile(FileInfo file, string result, string report, string currentUser, string currentUserInitials, string currentProject)
        {
            // Log it

            StatusReporter reporter = new StatusReporter();
            string fullReport = this.generateReport(file, report, result, currentUser);
            string fullTabReport = this.generateTabReport(file, report, result, currentUser);
            //user logs
            logger.saveToTXT("AdjudicatorLogs" + currentUser, logsDirectory, fullReport);
            logger.saveToTabDilimited("AdjudicatorLogs" + currentUser, logsDirectory, fullTabReport);
            //project log
            logger.saveToTXT(currentProject, logsDirectory, fullReport);
            logger.saveToTabDilimited(currentProject, logsDirectory, fullTabReport);
            string moveStatus;
            switch (result)
            {
                case("Passed"):
                    {
                        // move it
                        // is it a mezzanine?
                        bool mezzanine = utility.isMezzanine(file);
                        if (mezzanine)
                        {
                            moveStatus = utility.moveFile(file, this.MezzaninePassedDirectory);
                            //utility.moveFile(file, this.MezzaninePassedDirectory);

                        }
                        else
                        {
                            moveStatus = utility.moveFile(file, this.WebPassedDirectory);
                            //utility.moveFile(file, this.WebPassedDirectory);
                        }

                        reporter.addResult(2, file.Name, currentProject, "");
                        googleBot.logItConference(file.Name, report + currentUserInitials + DateTime.Now);
                        break;
                    }
                case ("Failed"):
                    {
                        // move it
                        //moveStatus = utility.moveFile(file, failedDirectory);
                        this.emailFail(file, report);
                        utility.moveFile(file, failedDirectory);
                        googleBot.logItConference(file.Name, "Failed: " + report + currentUserInitials + DateTime.Now);
                        reporter.addFail(file.Name, report);
                        reporter.addResult(4, file.Name, currentProject, report);

                       

                        break;
                    }
                case("Cautioned"):
                    {
                        // move it
                        // is it a mezzanine?
                        bool mezzanine = utility.isMezzanine(file);
                        if (mezzanine)
                        {
                            //moveStatus = utility.moveFile(file, this.MezzaninePassedDirectory);
                            utility.moveFile(file, this.MezzaninePassedDirectory);
                        }
                        else
                        {
                            //moveStatus = utility.moveFile(file, this.WebPassedDirectory);
                            utility.moveFile(file, this.WebPassedDirectory);
                        }

                        googleBot.logItConference(file.Name, "Cautioned: " + report + currentUserInitials + DateTime.Now);

                        // email on a caution
                        emailCaution(file, report);
                        reporter.addResult(3, file.Name, currentProject, report);
                        break;
                    }
                case("WrongProject"):
                    {
                        // move it to the brig
                       //moveStatus = utility.moveFile(file, wrongProjectDirectory);
                       utility.moveFile(file, wrongProjectDirectory);
                       try
                       {
                           reporter.tryToRemoveFromQueue(file.Name, reporter.getWorksheetByProjectName(currentProject));
                       }
                       catch (Exception e)
                       {

                       }
                        break;
                    }
                default:
                     return false;

            }

            return true;
        }