private async Task CompositToFullCompositeAsync() { if (AllScores != null) { var Compo = from mydata in AllScores.AsParallel() select new { RefNo = mydata.RefNo.ToString(), Barcode = mydata.Barcode.ToString(), LastName = mydata.Surname, FName = mydata.Name, Initials = mydata.Initials, SAID = HelperUtils.ToSAID(mydata.SAID), FID = mydata.ForeignID, DOB = String.Format("{0:yyyyMMdd}", mydata.DOB), IDType = mydata.ID_Type, Citizenship = (mydata.Citizenship != null ? mydata.Citizenship : null), Classification = mydata.Classification, Gender = mydata.Gender, faculty1 = HelperUtils.GetFacultyName(mydata.Faculty), Testdate = String.Format("{0:yyyyMMdd}", mydata.DOT), VenueCode = mydata.VenueCode.ToString("D5"), VenueName = mydata.VenueName, Hlanguage = mydata.HomeLanguage, G12L = mydata.GR12Language, AQLLang = mydata.AQLLanguage, AQLCode = mydata.AQLCode, MatLang = mydata.MatLanguage, MatCode = mydata.MatCode, Faculty2 = HelperUtils.GetFacultyName(mydata.Faculty2), Faculty3 = HelperUtils.GetFacultyName(mydata.Faculty3), SessionID = mydata.Barcode.ToString(), NBTNumber = mydata.RefNo.ToString(), Surname = mydata.Surname, Name = mydata.Name, Initial = mydata.Initials, SouthAfricanID = HelperUtils.ToSAID(mydata.SAID), Passport = mydata.ForeignID, Birth = (mydata.SAID != null ? HelperUtils.DOBfromSAID(mydata.SAID.ToString()) : String.Format("{0:dd/MM/yyyy}", mydata.DOB)), W_AL = mydata.WroteAL, W_QL = mydata.WroteQL, W_Mat = mydata.WroteMat, StNo = "", Faculty = "", Programme = "", DateTest = String.Format("{0:yyyyMMdd}", mydata.DOT), Venue = mydata.VenueName, Sex = (mydata.Gender == "1" ? "M" : mydata.Gender == "2" ? "F" : mydata.Gender), street1 = "", street2 = "", Suburb = "", City = "", Province = "", Postal = "", Email = "", Landline = "", Mobile = "", ALScore = mydata.ALScore, ALLevel = mydata.ALLevel, QLScore = mydata.QLScore, QLLevel = mydata.QLLevel, MatScore = mydata.MATScore, MatLevel = mydata.MATLevel, AQL_Lang = mydata.AQLLanguage, Mat_Lang = mydata.MatLanguage }; foreach (var a in Compo) { FullComposite FC = new FullComposite(); FC.RefNo = a.RefNo; FC.Barcode = a.Barcode; FC.LastName = a.LastName; FC.FirstName = a.FName; FC.Initials = a.Initials; FC.SAID = a.SAID; FC.FID = a.FID; FC.DOB = a.DOB; FC.IDType = a.IDType; FC.Citizenship = a.Citizenship.ToString(); FC.Classification = a.Classification; FC.Gender = a.Gender; FC.Faculty1 = a.faculty1; FC.DOT = a.Testdate; FC.VenueCode = a.VenueCode; FC.VenueName = a.VenueName; FC.HomeLanguage = a.Hlanguage.ToString(); FC.SchLanguage = a.G12L; FC.AQLLang = a.AQLLang; FC.AQLCode = a.AQLCode.ToString(); FC.MATLang = a.MatLang; FC.MATCode = a.MatCode.ToString(); FC.Faculty2 = a.Faculty2; FC.Faculty3 = a.Faculty3; FC.SessionId = a.SessionID; FC.NBT = a.NBTNumber; FC.Surname = a.Surname; FC.Name = a.Name; FC.MiddleInitials = a.Initial; FC.SouthAfricanID = a.SouthAfricanID; FC.Passport = a.Passport; FC.Birth = a.Birth; FC.WroteAL = a.W_AL; FC.WroteQL = a.W_QL; FC.WroteMat = a.W_Mat; FC.StudentNo = a.StNo; FC.Faculty = a.Faculty; FC.Programme = a.Programme; FC.TestDate = a.DateTest; FC.Venue = a.Venue; FC.Sex = a.Sex; FC.Street1 = a.street1; FC.Street2 = a.street2; FC.Suburb = a.Suburb; FC.City = a.City; FC.Province = a.Province; FC.Postal = a.Postal; FC.Email = a.Email; FC.Landline = a.Landline; FC.Mobile = a.Mobile; FC.ALScore = a.ALScore.ToString(); FC.ALLevel = a.ALLevel; FC.QLScore = a.QLScore.ToString(); FC.QLLevel = a.QLLevel; FC.MatScore = a.MatScore.ToString(); FC.MatLevel = a.MatLevel; FC.AQLLanguage = a.AQL_Lang; FC.MatLanguage = a.Mat_Lang; FComposite.Add(FC); } } }