public void ImportInterviewResult() { if (!string.IsNullOrWhiteSpace(FileName)) { using (var context = new VnrHrmDataContext()) { IUnitOfWork unitOfWork = new UnitOfWork(context); ExcelImporter importer = new ExcelImporter(context); importer.FileName = FileName; var objectType = typeof(Rec_ImportInterviewResultEntity); List<ImportItemInfo> importTemplateItems = new List<ImportItemInfo>(); importTemplateItems.Add(CreateImportItemInfo(0, false, true, 1, "CandidateCode", string.Empty, FieldMappings["CandidateCode"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(1, true, true, 1, "CandidateName", string.Empty, FieldMappings["CandidateName"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(2, false, true, 1, "JobVacancyCode", string.Empty, FieldMappings["JobVacancyCode"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(3, true, true, 1, "CandidateEmail", string.Empty, FieldMappings["CandidateEmail"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(4, true, true, 1, "LanguageCode", string.Empty, FieldMappings["LanguageCode"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(5, true, true, 1, "Group1Score1", string.Empty, FieldMappings["Group1Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(6, true, true, 1, "Group1Score2", string.Empty, FieldMappings["Group1Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(7, true, true, 1, "Group1Score3", string.Empty, FieldMappings["Group1Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(8, false, true, 1, "GroupCondition1", string.Empty, FieldMappings["GroupCondition1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(9, false, true, 1, "GroupResult1", string.Empty, FieldMappings["GroupResult1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(10, true, true, 1, "Group2Score1", string.Empty, FieldMappings["Group2Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(11, true, true, 1, "Group2Score2", string.Empty, FieldMappings["Group2Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(12, true, true, 1, "Group2Score3", string.Empty, FieldMappings["Group2Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(13, false, true, 1, "GroupCondition2", string.Empty, FieldMappings["GroupCondition2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(14, false, true, 1, "GroupResult2", string.Empty, FieldMappings["GroupResult2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(15, true, true, 1, "Group3Score1", string.Empty, FieldMappings["Group3Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(16, true, true, 1, "Group3Score2", string.Empty, FieldMappings["Group3Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(17, true, true, 1, "Group3Score3", string.Empty, FieldMappings["Group3Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(18, false, true, 1, "GroupCondition3", string.Empty, FieldMappings["GroupCondition3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(19, false, true, 1, "GroupResult3", string.Empty, FieldMappings["GroupResult3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(20, true, true, 1, "Group4Score1", string.Empty, FieldMappings["Group4Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(21, true, true, 1, "Group4Score2", string.Empty, FieldMappings["Group4Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(22, true, true, 1, "Group4Score3", string.Empty, FieldMappings["Group4Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(23, false, true, 1, "GroupCondition4", string.Empty, FieldMappings["GroupCondition4"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(24, false, true, 1, "GroupResult4", string.Empty, FieldMappings["GroupResult4"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(25, false, true, 1, "GroupCondition5", string.Empty, FieldMappings["GroupCondition5"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(26, true, true, 1, "Group5Score1", string.Empty, FieldMappings["Group5Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(27, true, true, 1, "Group5Score2", string.Empty, FieldMappings["Group5Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(28, true, true, 1, "Group5Score3", string.Empty, FieldMappings["Group5Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(29, false, true, 1, "GroupResult5", string.Empty, FieldMappings["GroupResult5"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(30, true, true, 1, "Group6Score1", string.Empty, FieldMappings["Group6Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(31, true, true, 1, "Group6Score2", string.Empty, FieldMappings["Group6Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(32, true, true, 1, "Group6Score3", string.Empty, FieldMappings["Group6Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(33, false, true, 1, "GroupCondition6", string.Empty, FieldMappings["GroupCondition6"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(34, false, true, 1, "GroupResult6", string.Empty, FieldMappings["GroupResult6"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(35, true, true, 1, "Group7Score1", string.Empty, FieldMappings["Group7Score1"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(36, true, true, 1, "Group7Score2", string.Empty, FieldMappings["Group7Score2"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(37, true, true, 1, "Group7Score3", string.Empty, FieldMappings["Group7Score3"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(38, false, true, 1, "GroupCondition7", string.Empty, FieldMappings["GroupCondition7"], string.Empty)); importTemplateItems.Add(CreateImportItemInfo(39, false, true, 1, "GroupResult7", string.Empty, FieldMappings["GroupResult7"], string.Empty)); var dtImportObject = importer.ReadExcelData(objectType, 0, 4, 0, importTemplateItems); listInvisibleField = importTemplateItems.Where(d => d.IsOutOfRange).Select(d => d.ExcelField1.TrimAll()).ToList(); var listJobVacancyCode = dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["JobVacancyCode"])).Select(d => d[FieldMappings["JobVacancyCode"]].GetString()).Distinct().ToList(); var listLanguageCode = dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["LanguageCode"])).Select(d => d[FieldMappings["LanguageCode"]].GetString()).Distinct().ToList(); var listCandidateCode = dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["CandidateCode"])).Select(d => d[FieldMappings["CandidateCode"]].GetString()).Distinct().ToList(); var listGroupConditionCode = dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition1"])).Select(d => d[FieldMappings["GroupCondition1"]].GetString()).Distinct().ToList(); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition2"])).Select(d => d[FieldMappings["GroupCondition2"]].GetString()).Distinct().ToList()); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition3"])).Select(d => d[FieldMappings["GroupCondition3"]].GetString()).Distinct().ToList()); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition4"])).Select(d => d[FieldMappings["GroupCondition4"]].GetString()).Distinct().ToList()); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition5"])).Select(d => d[FieldMappings["GroupCondition5"]].GetString()).Distinct().ToList()); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition6"])).Select(d => d[FieldMappings["GroupCondition6"]].GetString()).Distinct().ToList()); listGroupConditionCode.AddRange(dtImportObject.Rows.OfType<DataRow>().Where(d => !d.IsNull(FieldMappings["GroupCondition7"])).Select(d => d[FieldMappings["GroupCondition7"]].GetString()).Distinct().ToList()); var listJobVacancy = new List<Rec_JobVacancy>().Select(d => new { d.ID, d.Code }).ToList(); var listLanguage = new List<Cat_NameEntity>().Select(d => new { d.ID, d.Code }).ToList(); var listCandidate = new List<Rec_Candidate>().Select(d => new { d.ID, d.CodeCandidate, d.CandidateName }).ToList(); var listGroupCondition = new List<Rec_GroupCondition>().Select(d => new { d.ID, d.Code, d.GroupName }).ToList(); var listRecruitmentHistory = new List<Rec_RecruitmentHistory>().Select(d => new { d.ID, d.CandidateID, d.DateApply }).ToList(); var listInterview = new List<Rec_Interview>().Select(d => new { d.ID, d.CandidateID, d.GroupConditionID, d.RecruitmentHistoryID }).ToList(); foreach (var item in listLanguageCode.Chunk(1000)) { listLanguage.AddRange(unitOfWork.CreateQueryable<Cat_NameEntity>(d => item.Contains(d.Code)).Select(d => new { d.ID, d.Code }).ToList()); } foreach (var item in listJobVacancyCode.Chunk(1000)) { listJobVacancy.AddRange(unitOfWork.CreateQueryable<Rec_JobVacancy>(d => item.Contains(d.Code)).Select(d => new { d.ID, d.Code }).ToList()); } foreach (var item in listCandidateCode.Chunk(1000)) { listCandidate.AddRange(unitOfWork.CreateQueryable<Rec_Candidate>(d => item.Contains(d.CodeCandidate)).Select(d => new { d.ID, d.CodeCandidate, d.CandidateName }).ToList()); } foreach (var item in listGroupConditionCode.Chunk(1000)) { listGroupCondition.AddRange(unitOfWork.CreateQueryable<Rec_GroupCondition>(d => item.Contains(d.Code)).Select(d => new { d.ID, d.Code, d.GroupName }).ToList()); } var listCandidateID = listCandidate.Select(d => d.ID).Distinct().ToList(); foreach (var item in listCandidateID.Chunk(1000)) { listRecruitmentHistory.AddRange(unitOfWork.CreateQueryable<Rec_RecruitmentHistory>(d => item.Contains(d.CandidateID)).Select(d => new { d.ID, d.CandidateID, d.DateApply }).ToList()); } foreach (var item in listCandidateID.Chunk(1000)) { listInterview.AddRange(unitOfWork.CreateQueryable<Rec_Interview>(d => d.CandidateID.HasValue && item.Contains(d.CandidateID.Value)).Select(d => new { d.ID, d.CandidateID, d.GroupConditionID, d.RecruitmentHistoryID }).ToList()); } dtImportObject.Columns.Add("CandidateID", typeof(Guid)); dtImportObject.Columns.Add("JobVacancyID", typeof(Guid)); dtImportObject.Columns.Add("LanguageID", typeof(Guid)); dtImportObject.Columns.Add("InterviewID", typeof(Guid)); dtImportObject.Columns.Add("RecruitmentHistoryID", typeof(Guid)); dtImportObject.Columns.Add("InterviewID1", typeof(Guid)); dtImportObject.Columns.Add("InterviewID2", typeof(Guid)); dtImportObject.Columns.Add("InterviewID3", typeof(Guid)); dtImportObject.Columns.Add("InterviewID4", typeof(Guid)); dtImportObject.Columns.Add("InterviewID5", typeof(Guid)); dtImportObject.Columns.Add("InterviewID6", typeof(Guid)); dtImportObject.Columns.Add("InterviewID7", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID1", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID2", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID3", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID4", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID5", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID6", typeof(Guid)); dtImportObject.Columns.Add("GroupConditionID7", typeof(Guid)); var dtInvalidObject = new DataTable("InvalidObject"); dtInvalidObject.Columns.Add("DataField", typeof(string)); dtInvalidObject.Columns.Add("InvalidValue", typeof(string)); dtInvalidObject.Columns.Add("ExcelField", typeof(string)); dtInvalidObject.Columns.Add("ExcelValue", typeof(object)); dtInvalidObject.Columns.Add("ValueType", typeof(string)); dtInvalidObject.Columns.Add("Desciption", typeof(string)); List<DataRow> listInvalidRow = new List<DataRow>(); foreach (DataRow excelRow in dtImportObject.Rows) { var excelRowIndex = excelRow.Field<int>(DefaultConstants.ExcelRowIndex); var nullData = HRM.Business.Main.Domain.InvalidDataType.NullData.ToString().TranslateString(); var duplicateInDb = HRM.Business.Main.Domain.InvalidDataType.DuplicateInDb.ToString().TranslateString(); var duplicateInFile = HRM.Business.Main.Domain.InvalidDataType.DuplicateInFile.ToString().TranslateString(); var referenceNotFound = HRM.Business.Main.Domain.InvalidDataType.ReferenceNotFound.ToString().TranslateString(); var listGroupConditionID = new List<Guid>(); Guid recruitmentHistoryID = Guid.Empty; Guid candidateID = Guid.Empty; bool isInvalid = false; foreach (var templateItem in importTemplateItems) { string fieldName = templateItem.ChildFieldLevel1.TrimAll(); var excelField = templateItem.ExcelField1.TrimAll(); string excelAddress = excelField + (excelRowIndex + 1); if (excelRow.IsNull(excelField)) { if (!templateItem.AllowNull.GetBoolean()) { bool isNotNullGroup = false; if (fieldName == "GroupCondition1" || fieldName == "GroupResult1") { if (!excelRow.IsNull(FieldMappings["GroupCondition1"]) || !excelRow.IsNull(FieldMappings["Group1Score1"]) || !excelRow.IsNull(FieldMappings["Group1Score2"]) || !excelRow.IsNull(FieldMappings["Group1Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult1"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition2" || fieldName == "GroupResult2") { if (!excelRow.IsNull(FieldMappings["GroupCondition2"]) || !excelRow.IsNull(FieldMappings["Group2Score1"]) || !excelRow.IsNull(FieldMappings["Group2Score2"]) || !excelRow.IsNull(FieldMappings["Group2Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult2"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition3" || fieldName == "GroupResult3") { if (!excelRow.IsNull(FieldMappings["GroupCondition3"]) || !excelRow.IsNull(FieldMappings["Group3Score1"]) || !excelRow.IsNull(FieldMappings["Group3Score2"]) || !excelRow.IsNull(FieldMappings["Group3Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult3"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition4" || fieldName == "GroupResult4") { if (!excelRow.IsNull(FieldMappings["GroupCondition4"]) || !excelRow.IsNull(FieldMappings["Group4Score1"]) || !excelRow.IsNull(FieldMappings["Group4Score2"]) || !excelRow.IsNull(FieldMappings["Group4Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult4"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition5" || fieldName == "GroupResult5") { if (!excelRow.IsNull(FieldMappings["GroupCondition5"]) || !excelRow.IsNull(FieldMappings["Group5Score1"]) || !excelRow.IsNull(FieldMappings["Group5Score2"]) || !excelRow.IsNull(FieldMappings["Group5Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult5"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition6" || fieldName == "GroupResult6") { if (!excelRow.IsNull(FieldMappings["GroupCondition6"]) || !excelRow.IsNull(FieldMappings["Group6Score1"]) || !excelRow.IsNull(FieldMappings["Group6Score2"]) || !excelRow.IsNull(FieldMappings["Group6Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult6"])) { isNotNullGroup = true; } } else if (fieldName == "GroupCondition7" || fieldName == "GroupResult7") { if (!excelRow.IsNull(FieldMappings["GroupCondition7"]) || !excelRow.IsNull(FieldMappings["Group7Score1"]) || !excelRow.IsNull(FieldMappings["Group7Score2"]) || !excelRow.IsNull(FieldMappings["Group7Score3"]) || !excelRow.IsNull(FieldMappings["GroupResult7"])) { isNotNullGroup = true; } } else { isNotNullGroup = true; } if (isNotNullGroup) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", string.Empty); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", string.Empty); invalidRow.SetField("Desciption", nullData); isInvalid = true; } } } else { var excelValue = excelRow[excelField]; if (fieldName == "JobVacancyCode") { var jobVacancy = listJobVacancy.Where(d => d.Code == excelValue.GetString()).FirstOrDefault(); if (jobVacancy == null) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", referenceNotFound); isInvalid = true; } else { excelRow.SetField("JobVacancyID", jobVacancy.ID); } } else if (fieldName == "LanguageCode") { var language = listLanguage.Where(d => d.Code == excelValue.GetString()).FirstOrDefault(); if (language == null) { if (!string.IsNullOrWhiteSpace(excelValue.GetString())) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", referenceNotFound); isInvalid = true; } } else { excelRow.SetField("LanguageID", language.ID); } } else if (fieldName == "CandidateCode") { candidateID = listCandidate.Where(d => d.CodeCandidate == excelValue.GetString()).Select(d => d.ID).FirstOrDefault(); if (candidateID == Guid.Empty) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", referenceNotFound); isInvalid = true; } else { excelRow.SetField("CandidateID", candidateID); recruitmentHistoryID = listRecruitmentHistory.Where(d => d.CandidateID == candidateID) .OrderByDescending(d => d.DateApply).Select(d => d.ID).FirstOrDefault(); if (recruitmentHistoryID != Guid.Empty) { excelRow.SetField("RecruitmentHistoryID", recruitmentHistoryID); } } } else if (fieldName == "GroupCondition1" || fieldName == "GroupCondition2" || fieldName == "GroupCondition3" || fieldName == "GroupCondition4" || fieldName == "GroupCondition5" || fieldName == "GroupCondition6" || fieldName == "GroupCondition7") { var groupConditionID = listGroupCondition.Where(d => d.Code == excelValue.GetString()).Select(d => d.ID).FirstOrDefault(); if (groupConditionID == Guid.Empty) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", referenceNotFound); isInvalid = true; } else { string groupIDField = fieldName.Substring(14); groupIDField = "GroupConditionID" + groupIDField; excelRow.SetField(groupIDField, groupConditionID); if (listGroupConditionID.Contains(groupConditionID)) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", duplicateInFile); isInvalid = true; } else { listGroupConditionID.Add(groupConditionID); var isDupplicateOnTable = dtImportObject.Rows.OfType<DataRow>().Any(d => d != excelRow && d["CandidateID"].GetString() == candidateID.ToString() && (d["GroupConditionID1"].GetString() == groupConditionID.ToString() || d["GroupConditionID2"].GetString() == groupConditionID.ToString() || d["GroupConditionID3"].GetString() == groupConditionID.ToString() || d["GroupConditionID4"].GetString() == groupConditionID.ToString() || d["GroupConditionID5"].GetString() == groupConditionID.ToString() || d["GroupConditionID6"].GetString() == groupConditionID.ToString() || d["GroupConditionID7"].GetString() == groupConditionID.ToString())); if (isDupplicateOnTable) { var invalidRow = dtInvalidObject.NewRow(); dtInvalidObject.Rows.Add(invalidRow); invalidRow.SetField("DataField", fieldName); invalidRow.SetField("InvalidValue", excelValue.GetString()); invalidRow.SetField("ExcelField", excelAddress); invalidRow.SetField("ExcelValue", excelValue); invalidRow.SetField("Desciption", duplicateInFile); isInvalid = true; } else { var listInterviewByCandidate = listInterview.Where(d => d.CandidateID == candidateID && d.RecruitmentHistoryID == recruitmentHistoryID).ToList(); var interViewDupplicate = listInterviewByCandidate.Where(d => d.GroupConditionID == groupConditionID).FirstOrDefault(); if (interViewDupplicate != null) { string interviewIDField = fieldName.Substring(14); interviewIDField = "InterviewID" + interviewIDField; excelRow.SetField(interviewIDField, interViewDupplicate.ID); } } } } } } } if (isInvalid) { listInvalidRow.Add(excelRow); } } if (listInvalidRow.Count() > 0) { foreach (DataRow item in listInvalidRow) { dtImportObject.Rows.Remove(item); } } if (ImportObjects.ContainsKey(UserID)) { ImportObjects[UserID] = dtImportObject; } else { ImportObjects.Add(UserID, dtImportObject); } if (InvalidObjects.ContainsKey(UserID)) { InvalidObjects[UserID] = dtInvalidObject; } else { InvalidObjects.Add(UserID, dtInvalidObject); } } } }