private List <AllEgsOutputReport> GetExoReport(int Id, string Mode = "P")
        {
            var exchangeOutputReportList = new List <AllEgsOutputReport>();
            var qcRawResult = QcExecutionRawResultHandler.GetQcExecutionRawResultById(Id);

            if (qcRawResult != null)
            {
                // Deserialize the Result
                var qcResults = JsonConvert.DeserializeObject <List <AllEgsOutputModel> >(qcRawResult.Result);

                // Fetch the GDCO tickets
                var projectIds = new List <string>();
                foreach (var qcResult in qcResults)
                {
                    if (!string.IsNullOrEmpty(qcResult.ProjectId))
                    {
                        projectIds.Add(qcResult.ProjectId);
                    }
                    else if (!string.IsNullOrEmpty(qcResult.MdmId))
                    {
                        projectIds.Add(qcResult.MdmId);
                    }
                }
                var gdcoTicketsDictionary = new GdcoTicketHandler().GetTickets(projectIds, "msassetsku");

                foreach (var qcResult in qcResults)
                {
                    var exchangeOutputReport = new AllEgsOutputReport();
                    exchangeOutputReport.ExecutionDate = qcRawResult.ExecutionDate;
                    exchangeOutputReport.DetailReport  = qcRawResult.ReportFilePath;
                    if (qcResult != null && qcResult.AllEgsOutput != null)
                    {
                        if (Mode.Equals("P"))
                        {
                            exchangeOutputReport.ProjectId = qcResult.ProjectId;
                        }
                        else if (Mode.Equals("M") || Mode.Equals("D"))
                        {
                            exchangeOutputReport.MdmId = qcResult.MdmId;
                        }
                        exchangeOutputReport.TotalTests  = qcResult.AllEgsOutput.Count;
                        exchangeOutputReport.PassedTests = qcResult.AllEgsOutput.Where(eo => eo.TestStatus.Equals("Passed")).ToList().Count;
                        exchangeOutputReport.FailedTests = qcResult.AllEgsOutput.Where(eo => eo.TestStatus.Equals("Failed")).ToList().Count;
                        exchangeOutputReport.WorkOrder   = qcResult.WorkOrderName;
                        if ((!string.IsNullOrEmpty(qcResult.ProjectId) && gdcoTicketsDictionary.ContainsKey(qcResult.ProjectId)) || (!string.IsNullOrEmpty(qcResult.MdmId) && gdcoTicketsDictionary.ContainsKey(qcResult.MdmId)))
                        {
                            var pid = string.IsNullOrEmpty(qcResult.ProjectId) ? qcResult.MdmId : qcResult.ProjectId;
                            exchangeOutputReport.gdcoTickets = gdcoTicketsDictionary[pid];
                        }
                    }
                    exchangeOutputReportList.Add(exchangeOutputReport);
                }
            }
            return(exchangeOutputReportList);
        }
        private List <AllEgsOutputReport> GetExoReport(List <AllEgsOutputModel> AllEgsOutput, string Mode)
        {
            var allEgsOutputReportList = new List <AllEgsOutputReport>();

            if (AllEgsOutput != null)
            {
                // Fetch the GDCO tickets
                var projectIds = new List <string>();
                foreach (var qcResult in AllEgsOutput)
                {
                    if (!string.IsNullOrEmpty(qcResult.ProjectId))
                    {
                        projectIds.Add(qcResult.ProjectId);
                    }
                    else if (!string.IsNullOrEmpty(qcResult.MdmId))
                    {
                        projectIds.Add(qcResult.MdmId);
                    }
                }
                var gdcoTicketsDictionary = new GdcoTicketHandler().GetTickets(projectIds, "allegs_msassetsku");

                foreach (var qcResult in AllEgsOutput)
                {
                    var allEgsOutputReport = new AllEgsOutputReport();
                    allEgsOutputReport.PropertyGroupName = qcResult.PropertyGroupName;
                    if (qcResult != null && qcResult.AllEgsOutput != null)
                    {
                        if (Mode.Equals("P"))
                        {
                            allEgsOutputReport.ProjectId = qcResult.ProjectId;
                        }
                        else if (Mode.Equals("M") || Mode.Equals("D"))
                        {
                            allEgsOutputReport.MdmId = qcResult.MdmId;
                        }
                        allEgsOutputReport.TotalTests  = qcResult.AllEgsOutput.Count;
                        allEgsOutputReport.PassedTests = qcResult.AllEgsOutput.Where(eo => eo.TestStatus.Equals("Passed")).ToList().Count;
                        allEgsOutputReport.FailedTests = qcResult.AllEgsOutput.Where(eo => eo.TestStatus.Equals("Failed")).ToList().Count;
                        allEgsOutputReport.WorkOrder   = qcResult.WorkOrderName;
                        if ((!string.IsNullOrEmpty(qcResult.ProjectId) && gdcoTicketsDictionary.ContainsKey(qcResult.ProjectId)) || (!string.IsNullOrEmpty(qcResult.MdmId) && gdcoTicketsDictionary.ContainsKey(qcResult.MdmId)))
                        {
                            var pid = string.IsNullOrEmpty(qcResult.ProjectId) ? qcResult.MdmId : qcResult.ProjectId;
                            allEgsOutputReport.gdcoTickets = gdcoTicketsDictionary[pid];
                        }
                    }
                    allEgsOutputReportList.Add(allEgsOutputReport);
                }
            }
            return(allEgsOutputReportList);
        }