Esempio n. 1
0
        public AnalysisResult Analyze()
        {
            AnalysisResult analysisResult = new AnalysisResult();
            try
            {
                string[] recordLines = reader.ReadInput();
                List<Record> records = transformer.Transform(recordLines).ToList();

                bool[] checkedRecords = new bool[records.Count];
                int duplicated = 0;
                bool firstDuplicated = true;
                Record currentRecord;
                Record comparedRecord;
                for (int i = 0; i < records.Count; i++)
                {
                    if (!checkedRecords[i])
                    {
                        currentRecord = records.ElementAt(i);

                        firstDuplicated = true;
                        for (int j = i + 1; j < records.Count; j++)
                        {
                            if (!checkedRecords[j])
                            {
                                comparedRecord = records.ElementAt(j);
                                if (currentRecord.Equals(comparedRecord))
                                {
                                    if (firstDuplicated)
                                    {
                                        analysisResult.fraudulentIds.Add(currentRecord.OrderId);
                                        duplicated++;
                                        firstDuplicated = false;
                                    }

                                    analysisResult.fraudulentIds.Add(comparedRecord.OrderId);
                                    checkedRecords[j] = true;
                                }
                            }
                        }

                        checkedRecords[i] = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ex.Log("");
                throw;
            }

            return analysisResult;
        }
Esempio n. 2
0
 public ConsoleDumper(AnalysisResult analysisResult)
 {
     this.analysisResult = analysisResult;
 }
Esempio n. 3
0
 public FileDumper(AnalysisResult analysisResult, string filePathTarget)
 {
     this.analysisResult = analysisResult;
     this.filePathTarget = filePathTarget;
 }