public Parameters(XmlElement taskNode, UtilsLogger logger)
        {
            logger.WriteToLog("Beginning Parameters() constructor", LogLevel.Verbose);
            logger.WriteToLog("taskNode: " + taskNode.OuterXml, LogLevel.Verbose);

            //Location = taskNode.GetAttribute("Locations");
            //EventCode = taskNode.GetAttribute("EventCode");
            CallType = taskNode.GetAttribute("CallType");

            logger.WriteToLog("Instantiated Parameters", LogLevel.Verbose);
        }
예제 #2
0
        public Parameters(XmlElement taskNode, UtilsLogger logger)
        {
            logger.WriteToLog("Beginning Parameters() constructor", LogLevel.Verbose);
            logger.WriteToLog("taskNode: " + taskNode.OuterXml, LogLevel.Verbose);

            InputFilePath     = taskNode.GetAttribute("InputFilePath");
            ProcessedFilePath = taskNode.GetAttribute("ProcessedFilePath");
            ReportFilePath    = taskNode.GetAttribute("OutputFilePath");

            logger.WriteToLog("Instantiated Parameters", LogLevel.Verbose);
        }
        public override void Run()
        {
            Logger.WriteToLog("Beginning Run Method", LogLevel.Basic);

            // TODO: Update API Processing Logic
            try
            {
                // Input Parameters

                string  callType    = Context.Parameters.CallType;
                DataSet caseDataSet = null;

                // Used progress call
                if (callType == "DMEXCALL")
                {
                    Logger.WriteToLog("------- Running DMEXCALL -------", LogLevel.Verbose);
                    caseDataSet = GetListOfDMEXCasesSQL();
                    DataTable listOfCasesDS = caseDataSet.Tables[0];
                    foreach (DataRow row in listOfCasesDS.Rows)
                    {
                        Logger.WriteToLog("----- Processing Case Number:  " + row[1] + " -----", LogLevel.Basic);
                        // Need fileDate Logic
                        // CaseID, CaseNbr, DtFile, NodeID, CurrCaseStatusCode, CalendarCode, CaseTypeCode, CaseSequence
                        // If less than 27 weeks from the filing week, then we want to schedule at least 27 weeks
                        if (DateTime.Parse(row[2].ToString()).AddDays(189) > DateTime.Today)
                        {
                            string hearingEventCode = "DRCSOPC"; // This is hardcoded due to time contraints.
                            bool   eventAddSuccess  = AddCaseEvent(row[0].ToString(), hearingEventCode);

                            if (eventAddSuccess)
                            {
                                string eventCode        = "DR4406"; // This is hardcoded due to time contraints.
                                bool   eventAddSuccess2 = AddCaseEvent(row[0].ToString(), eventCode);
                                Logger.WriteToLog("Case Number " + row[1] + " processed successfully.", LogLevel.Basic);
                            }
                            else
                            {
                                Logger.WriteToLog("Case Number " + row[1] + " processed unsuccessfully.", LogLevel.Basic);
                            }
                        }
                        else // Logic to schedule hearing within file date timeframe.
                        {
                            string startDate   = DateTime.Today.AddDays(189).ToString("MM/dd/yyyy");
                            string endDate     = DateTime.Today.AddDays(210).ToString("MM/dd/yyyy");
                            string hearingType = "DRPROG";

                            // Find Hearing
                            string result = FindHearing(row, startDate, endDate, hearingType);
                            Logger.WriteToLog("Hearings " + result, LogLevel.Verbose);
                            if (result != "ERROR")
                            {
                                // If hearings are found, spin through the results to find the first open session.
                                string sessionID = FindFirstOpenSession(result);
                                if (sessionID != "0")
                                {
                                    ScheduleHearing(row, startDate, endDate, hearingType, sessionID);
                                    Logger.WriteToLog("Case Number " + row[1] + " processed successfully.", LogLevel.Basic);
                                }
                                else
                                {
                                    Logger.WriteToLog("Case Number " + row[1] + " processed unsuccessfully.  Cannot find an open session.", LogLevel.Basic);
                                }
                            }
                            else
                            {
                                Logger.WriteToLog("Case Number " + row[1] + " processed unsuccessfully.  Cannot find a hearing.", LogLevel.Basic);
                            }
                        }
                    }
                }
                else // DMSTCALL - used status call
                {
                    Logger.WriteToLog("------- Running DMSTCALL -------", LogLevel.Verbose);
                    caseDataSet = GetListOfDMSTCasesSQL();
                    DataTable listOfCasesDS = caseDataSet.Tables[0];
                    foreach (DataRow row in listOfCasesDS.Rows)
                    {
                        // Need fileDate Logic
                        // CaseID, CaseNbr, DtFile, NodeID, CurrCaseStatusCode, CalendarCode, CaseTypeCode, CaseSequence
                        // If less than 27 weeks from the filing week, then we want to schedule at least 27 weeks
                        if (DateTime.Parse(row[2].ToString()).AddDays(140) > DateTime.Today)
                        {
                            string hearingEventCode = "DRCSOSC"; // This is hardcoded due to time contraints.
                            bool   eventAddSuccess  = AddCaseEvent(row[0].ToString(), hearingEventCode);

                            if (eventAddSuccess)
                            {
                                string eventCode        = "DR4406"; // This is hardcoded due to time contraints.
                                bool   eventAddSuccess2 = AddCaseEvent(row[0].ToString(), eventCode);
                                Logger.WriteToLog("Case Number " + row[1] + " processed successfully.", LogLevel.Basic);
                            }
                            else
                            {
                                Logger.WriteToLog("Case Number " + row[1] + " processed unsuccessfully.", LogLevel.Basic);
                            }
                        }
                        else // Logic to schedule hearing within file date timeframe.
                        {
                            string startDate   = DateTime.Today.AddDays(140).ToString("MM/dd/yyyy");
                            string endDate     = DateTime.Today.AddDays(161).ToString("MM/dd/yyyy");
                            string hearingType = "DRSTATUS";

                            // Find Hearing
                            string result = FindHearing(row, startDate, endDate, hearingType);
                            Logger.WriteToLog("Hearings" + result, LogLevel.Verbose);
                            if (result != "ERROR")
                            {
                                // If hearing is found, then spin through results to find the first available hearing.
                                string sessionID = FindFirstOpenSession(result);
                                ScheduleHearing(row, startDate, endDate, hearingType, sessionID);
                                Logger.WriteToLog("Case Number " + row[1] + " processed successfully.", LogLevel.Basic);
                            }
                            else
                            {
                                Logger.WriteToLog("Case Number " + row[1] + " processed unsuccessfully.", LogLevel.Basic);
                            }
                        }
                    }
                }

                // Identify Cases that haven't had any disposition codes per input parameters.



                // Of those cases, try to apply the event to schedule on a status call.
                //foreach(string caseID in casesList)
                //{
                //    AddCaseEvent(caseID);
                //}

                //string caseID = FindCase();

                Logger.WriteToLog("End no error.", LogLevel.Verbose);
            }
            catch (Exception e)
            {
                Context.Errors.Add(new BaseCustomException(e.Message));
            }

            // TODO: Handle errors we've collected during the job run.
            if (Context.Errors.Count > 0)
            {
                // Add a message to the job indicating that something went wrong.
                AddInformationToJob();

                // Collect errors, write them to a file, and attach the file to the job.
                LogErrors();
            }

            ContinueWithProcessing("Job Completed Successfully");
        }
 // Static constructor
 static DataProcessor()
 {
     Logger = new UtilsLogger(LogManager);
     Logger.WriteToLog("Logger Instantiated", LogLevel.Basic);
 }
예제 #5
0
        public override void Run()
        {
            Logger.WriteToLog("Beginning Run Method", LogLevel.Basic);

            // TODO: Update File Transformation Logic

            if (Directory.GetFiles(Context.Parameters.InputFilePath, "*.csv").Count() > 0)
            {
                foreach (string fileName in Directory.GetFiles(Context.Parameters.InputFilePath, "*.csv"))
                {
                    try
                    {
                        // 1. Determine which file is being retrieved.
                        string tableName = "";
                        switch (Path.GetFileName(fileName))
                        {
                        case "OFKYCTCL_UPDATE.csv":
                            tableName = "CookAutoHearingCallConfiguration";
                            break;

                        case "OFKYOFCR_UPDATE.csv":
                            tableName = "CookAutoHearingOfficerConfiguration";
                            break;

                        case "OFKYOFKD_UPDATE.csv":
                            tableName = "CookAutoHearingOfficerKeyConfiguration";
                            break;

                        case "OFKYOFKN_UPDATE.csv":
                            tableName = "xCookAutoHearingOfficerKeyConfigurationDate";
                            break;

                        default:
                            string errorMesage = "The file: " + fileName + " is not recognized by the program.";
                            Logger.WriteToLog(errorMesage, LogLevel.Basic);
                            break;
                        }

                        // 2. Extract data and update tables with respective data.
                        OfficerKeyTablesEntity data = ExtractDataFromFile(fileName, tableName);
                        UpdateTable(data, tableName);

                        // 3. Move File to Procesed Folder with a timestamp.
                        string targetFileName = fileName.Replace(Context.Parameters.InputFilePath, Context.Parameters.ProcessedFilePath);

                        if (File.Exists(targetFileName))
                        {
                            File.Delete(targetFileName);
                        }
                        File.Move(fileName, targetFileName);
                    }
                    catch (Exception e)
                    {
                        Context.Errors.Add(new BaseCustomException(e.Message));
                    }
                }
            }

            // TODO: Handle errors we've collected during the job run.
            if (Context.Errors.Count > 0)
            {
                // Add a message to the job indicating that something went wrong.
                AddInformationToJob();

                // Collect errors, write them to a file, and attach the file to the job.
                LogErrors();
            }

            ContinueWithProcessing("Job Completed Successfully");
        }