Example #1
0
        public List <string> GetReportIssues(List <string> clientLogNames, List <string> additionalIssues, string latencyTable = null)
        {
            var latencyConversionTable = _logDal.GetReportLatencyLog(latencyTable);
            var clientLogs             = clientLogNames.Select(logName => _logDal.GetClientLog(logName, latencyConversionTable)).Select(x => x.Item1).ToList();

            var duplicateClientReportInvoiceRow = GetDuplicateClientReportInvoiceRows(clientLogs);
            var differentClientNumberRowsWithSameCompanyNumber = GetClientRowsWithDifferentClientNumberForTheSameCompanyNumber(clientLogs);

            var issuesList = GetIssuesList(duplicateClientReportInvoiceRow,
                                           differentClientNumberRowsWithSameCompanyNumber, additionalIssues);

            return(issuesList);
        }
        public Tuple <FullDatabaseModel, List <string> > GetFullReportModel(List <string> centurionLogNames, List <string> clientLogNames, string latencyTable = null)
        {
            try
            {
                var fullDatabaseModel = new FullDatabaseModel();
                var issues            = new List <string>();

                var centurionLogsAndIssues = centurionLogNames.Select(_logDal.GetCenturionLog).ToList();
                var latencyConversionTable = _logDal.GetReportLatencyLog(latencyTable);
                var clientLogsAndIssues    = clientLogNames.Select(logName => _logDal.GetClientLog(logName, latencyConversionTable)).ToList();

                centurionLogsAndIssues.ForEach(x => issues.AddRange(x.Item2));
                clientLogsAndIssues.ForEach(x => issues.AddRange(x.Item2));

                try
                {
                    issues.AddRange(AddClientLogsGetBackIssues(fullDatabaseModel, clientLogsAndIssues.Select(x => x.Item1).ToList()).Where(x => !string.IsNullOrEmpty(x)));
                }
                catch (Exception e)
                {
                    MessageBox.Show($@"Failed adding client logs to full report model. InnerMessage: {e.Message}, issues cataloged in issues file.");
                    throw;
                }
                try
                {
                    issues.AddRange(AddCenturionLogsGetBackIssues(fullDatabaseModel, centurionLogsAndIssues.Select(x => x.Item1).ToList()).Where(x => !string.IsNullOrEmpty(x)));
                }
                catch (Exception e)
                {
                    MessageBox.Show($@"Failed adding centurions logs to full report model. InnerMessage: {e.Message}, issues cataloged in issues file.");
                    throw;
                }

                return(new Tuple <FullDatabaseModel, List <string> >(fullDatabaseModel, issues));
            }
            catch (Exception e)
            {
                MessageBox.Show($@"Failed calculating full report model. InnerMessage: {e.Message}, issues cataloged in issues file.");
                throw;
            }
        }