private ResourceDescription CreateLocationResourceDescription(FTN.Location cimLocation) { ResourceDescription rd = null; if (cimLocation != null) { long gid = ModelCodeHelper.CreateGlobalId(0, (short)DMSType.LOCATION, importHelper.CheckOutIndexForDMSType(DMSType.LOCATION)); rd = new ResourceDescription(gid); importHelper.DefineIDMapping(cimLocation.ID, gid); ////populate ResourceDescription PowerTransformerConverter.PopulateLocationProperties(cimLocation, rd); } return(rd); }
public static void PopulateLocationProperties(FTN.Location cimLocation, ResourceDescription rd) { if ((cimLocation != null) && (rd != null)) { PowerTransformerConverter.PopulateIdentifiedObjectProperties(cimLocation, rd); if (cimLocation.CategoryHasValue) { rd.AddProperty(new Property(ModelCode.LOCATION_CATEGORY, cimLocation.Category)); } if (cimLocation.CorporateCodeHasValue) { rd.AddProperty(new Property(ModelCode.LOCATION_CORPORATECODE, cimLocation.CorporateCode)); } } }
private void ImportLocations() { SortedDictionary <string, object> cimLocations = concreteModel.GetAllObjectsOfType("FTN.Location"); if (cimLocations != null) { foreach (KeyValuePair <string, object> cimLocationPair in cimLocations) { FTN.Location cimLocation = cimLocationPair.Value as FTN.Location; ResourceDescription rd = CreateLocationResourceDescription(cimLocation); if (rd != null) { delta.AddDeltaOperation(DeltaOpType.Insert, rd, true); report.Report.Append("Location ID = ").Append(cimLocation.ID).Append(" SUCCESSFULLY converted to GID = ").AppendLine(rd.Id.ToString()); } else { report.Report.Append("Location ID = ").Append(cimLocation.ID).AppendLine(" FAILED to be converted"); } } report.Report.AppendLine(); } }