public override DbImportResult Import(bool canCreateProperties = false)
        {
            DbImportResult = new DbImportResult();

            if (MetaData.ImportType != CommonUtils.ImportType.LinkRelatedEquipmentDocument)
            {
                DbImportResult.ErrorMessages.Add(IMPORT_TYPE_NOT_COMPATIBLE);
                return DbImportResult;
            }

            mExistingDocuments = Cee.Documents.Select(x => new LightDocument {Id = x.Id, Name = x.Name}).ToList();
            mExistingDocumentEquipments = Cee.DocumentEquipments.ToList();
            mExistingEquipmentTypes = Cee.EquipmentTypes.ToList();

            CanCreateProperties = false;

            string connString = BuildConnectionString(MetaData.FullFileName);

            IList<DocumentEquipmentDataAdapter> importData = new List<DocumentEquipmentDataAdapter>();
            using (var excelConn = new OleDbConnection(connString))
            {
                try
                {
                    using (var cmd = new OleDbCommand())
                    {
                        cmd.CommandTimeout = 600;
                        cmd.Connection = excelConn;
                        cmd.CommandText = string.Format(@"SELECT * FROM [{0}$] WHERE [{1}] IS NOT NULL", WorkSheetName, DocumentEquipmentColumn.DocumentName);
                        excelConn.Open();

                        if (!WorkSheetCheckColumnNamesAreValid<DocumentEquipmentColumn>(GetColumnHeadersFromDataSet(cmd, (int) DocumentEquipmentColumn.Tag)))
                        {
                            DbImportResult.ErrorMessages.Add(ExcelWorkSheetColumnsNotValidMessage());
                            return DbImportResult;
                        }

                        int rowNumber = 1;
                        using (OleDbDataReader dr = cmd.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                rowNumber++;
                                var adapter = new DocumentEquipmentDataAdapter(dr, rowNumber, MetaData.ImportType);
                                importData.Add(adapter);
                            }
                        }

                        excelConn.Close();
                    }

                    SaveData(importData);

                    DbImportResult.ImportedCount = mSavedResults.Count;
                    return DbImportResult;
                }
                catch (OleDbException ex)
                {
                    DbImportResult.ErrorMessages.Add(ex.ToString());
                    return DbImportResult;
                }
                finally
                {
                    if (excelConn.State == ConnectionState.Open)
                    {
                        excelConn.Close();
                    }
                }
            }
        }
        private bool SetEquipmentIdFailed(DocumentEquipmentDataAdapter adapter)
        {
            int equipmentId;

            switch (adapter.EquipmentTypeId)
            {
                case (int) CommonUtils.EquipmentTypeCode.CONTR:

                    equipmentId = (from x in Cee.ControlSystems where x.Name.Equals(adapter.Tag, StringComparison.CurrentCultureIgnoreCase) select x.Id).FirstOrDefault();

                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    return false;

                case (int) CommonUtils.EquipmentTypeCode.ELECT:

                    equipmentId = (from x in Cee.ElectricalEquipments where x.Name.Equals(adapter.Tag, StringComparison.CurrentCultureIgnoreCase) select x.Id).FirstOrDefault();
                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    return false;

                case (int) CommonUtils.EquipmentTypeCode.MECH:

                    equipmentId = (from x in Cee.MechanicalEquipments where x.Name.Equals(adapter.Tag, StringComparison.CurrentCultureIgnoreCase) select x.Id).FirstOrDefault();
                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    return false;

                case (int) CommonUtils.EquipmentTypeCode.MOB:
                    if (mExistingMobilePlants.Count == 0)
                    {
                        mExistingMobilePlants = Cee.MobilePlants.ToList();
                    }

                    equipmentId = (from x in mExistingMobilePlants where x.Name == adapter.Tag select x.Id).FirstOrDefault();
                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    return false;

                case (int) CommonUtils.EquipmentTypeCode.INSTR:

                    equipmentId = (from x in Cee.Instruments where x.Name.Equals(adapter.Tag, StringComparison.CurrentCultureIgnoreCase) select x.Id).FirstOrDefault();
                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    return false;

                case (int) CommonUtils.EquipmentTypeCode.PIPE:
                    if (mExistingQuickPipes.Count == 0)
                    {
                        mExistingQuickPipes = GetQuickPipes();
                    }

                    equipmentId = (from x in mExistingQuickPipes
                        where x.Name == adapter.Tag
                        select x.Id).FirstOrDefault();

                    if (equipmentId == 0)
                    {
                        RaiseMessage(CommonUtils.MessageType.Error, string.Format(BuildItemNameDoesNotExistInDbMessage(adapter.Tag, adapter.RowNumber)));
                        return true;
                    }
                    adapter.EquipmentId = equipmentId;
                    break;
            }
            return false;
        }