using System; using System.Collections.Generic; using System.Data; using System.Linq; using HRM.BO; using HRM.DA; using Microsoft.Reporting.NETCore; namespace HRM.Report { public class rptCandidateInfo { public byte[] GetCandidatedata(InterviewSession obs,int payrollTypeId) { DataRow dRow = null; DataSet resultDataSet = new DataSet(); var candidateIds = string.Join(",", obs.Candidates.Select(p => p.CandidateID.ToString()).Distinct()); List cvList = new List(); cvList = new CVService().GetCVByCandidateIDs(candidateIds); PayrollDataSet.PayrollDataSet.CandidateInformationDataTable dCandidateInformation = new PayrollDataSet.PayrollDataSet.CandidateInformationDataTable(); foreach (var cv in cvList) { var InterviewDate = obs.Candidates?.Where(p => p.CandidateID == cv.CandidateID)?.FirstOrDefault()?.InterviewDateTime; dRow = dCandidateInformation.NewRow(); dRow["Name"] = cv.Name; dRow["Email"] =cv.Email; dRow["Mobile"] = cv.Mobile; dRow["Time"] = InterviewDate != null ? ((DateTime)InterviewDate).ToString("hh:mm tt") : string.Empty; dCandidateInformation.Rows.Add(dRow); } dCandidateInformation.TableName = "PayrollDataset_CandidateInformation"; string positionName = null; var sessionDate = obs.interviewDate.ToString("dd/MM/yyyy"); var sessionTime = obs.StartTime.ToString("hh:mm tt"); if(obs.Candidates != null && obs.Candidates.Count > 0) positionName = obs.Candidates[0].positionName; ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.ShowForCandidateInfoReport(null, dCandidateInformation, sessionDate,sessionTime, positionName, payrollTypeId, "PDF"); } } }