public DocumentEquipmentDataAdapter(OleDbDataReader dr, int rowNumber, CommonUtils.ImportType importType) { DocumentName = string.Empty; EquipmentTypeName = string.Empty; RowNumber = rowNumber; mImportType = importType; DocumentName = dr.SafeString((int)DocumentEquipmentColumn.DocumentName).Trim(); EquipmentTypeName = dr.SafeString((int)DocumentEquipmentColumn.EquipmentType).Trim(); Tag = dr.SafeString((int)DocumentEquipmentColumn.Tag).Trim(); this.Validate(rowNumber, importType == CommonUtils.ImportType.LinkRelatedEquipmentDocument); }
public InstrumentComponentDataAdapter(OleDbDataReader dr, List<InstrumentProperty> existingInstrumentProperties, IList<string> spreadSheetComponentPropertyNames, int rowNumber, bool canCreateProperties, CommonUtils.ImportType importType) { base.PopulateCommonProperties(dr); RowNumber = rowNumber; mImportType = importType; int k = 0; const int StartColumnIndex = (int)BaseComponentColumn.Model + 1; for (int i = StartColumnIndex; i < StartColumnIndex + spreadSheetComponentPropertyNames.Count; i++) { if (string.IsNullOrEmpty(dr.SafeString(i))) { continue; } string propertyName = spreadSheetComponentPropertyNames[k]; k++; InstrumentProperty property = (from x in existingInstrumentProperties where x.Name.ToLower() == propertyName.ToLower() select x).FirstOrDefault(); if (property != null) { PropertyValues.Add(property.Name, dr.SafeValueToString(i)); } else { if (canCreateProperties) { if (!PropertyValues.ContainsValue(dr.SafeString(i))) { PropertyValues.Add(propertyName, dr.SafeString(i)); } } else { ErrorMessages.Add(RaiseMissingPropertyMessage(ComponentName, rowNumber, propertyName)); break; } } } base.Validate(rowNumber, mImportType==CommonUtils.ImportType.CreateInstrumentComponent); }