/// <summary> /// Get Design Area KeyObject of current Job. /// </summary> /// <returns></returns> private IGTKeyObject GetDesignAreaKeyObject() { string sql = "SELECT G3E_FID FROM DESIGNAREA_P WHERE JOB_ID=:1"; int outRecords = 0; Recordset rsDesignArea = null; try { rsDesignArea = m_gTDataContext.Execute(sql, out outRecords, (int)CommandTypeEnum.adCmdText, m_gTDataContext.ActiveJob); if (rsDesignArea.RecordCount > 0) { rsDesignArea.MoveFirst(); return(m_gTDataContext.OpenFeature(8100, Convert.ToInt32(rsDesignArea.Fields[0].Value))); } } catch { throw; } finally { rsDesignArea.Close(); rsDesignArea = null; } return(null); }
/// <summary> /// Method to set feature state for the feature in context /// </summary> internal void SetFeatureState() { try { IGTKeyObject feature = m_dataContext.OpenFeature(m_fno, m_fid); IGTComponent commonComponent = feature.Components.GetComponent(1); if (commonComponent != null) { Recordset commonComponentRs = commonComponent.Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); commonComponentRs.Fields["FEATURE_STATE_C"].Value = m_featureState; if (m_replacedFid > 0) { commonComponentRs.Fields["REPLACED_FID"].Value = m_replacedFid; } } } } catch (Exception) { throw; } }
/// <summary> /// Method to delete existing CUs /// </summary> private void DeleteExistingACUs() { try { foreach (IGTDDCKeyObject ddcObject in m_selectedObjects) { Recordset acuRs = m_dataContext.OpenFeature(ddcObject.FNO, ddcObject.FID).Components.GetComponent(22).Recordset; if (acuRs != null && acuRs.RecordCount > 0) { acuRs.MoveFirst(); while (!acuRs.EOF) { if (Convert.ToString(acuRs.Fields["WR_ID"].Value) == m_dataContext.ActiveJob) { acuRs.Delete(); } acuRs.MoveNext(); } } } } catch (Exception) { throw; } }
/// <summary> /// Update StreetLight Geometry. /// </summary> /// <param name="gtCompo">Street light attribute symbol component.</param> private void UpdateStreetLightGeometry(IGTComponent gtCompo) { try { Recordset tempRs = null; tempRs = gtCompo.Recordset; if (tempRs != null) { if (tempRs.RecordCount > 0) { tempRs.MoveFirst(); gtCompo.Recordset.MoveFirst(); short gTPrimaryCno = GetPrimaryGraphicCno(gTOwnerKeyObject.FNO); IGTComponent gTPrimaryComponent = m_oGTDataContext.OpenFeature(gTOwnerKeyObject.FNO, gTOwnerKeyObject.FID).Components.GetComponent(gTPrimaryCno); if (gTPrimaryComponent != null && gTPrimaryComponent.Recordset != null) { gTPrimaryComponent.Recordset.MoveFirst(); gtCompo.Geometry = gTPrimaryComponent.Geometry; tempRs.Fields["G3E_CNO"].Value = gtCompo.CNO; gtCompo.Recordset.Update(); } } } } catch { throw; } }
/// <summary> /// Method to delete StreetLight. /// </summary> /// <param name="streetLightAttributeRS">Recordset of StreetLight Attribute</param> /// <param name="locatable">Bool value whether StreetLight is Located to delete</param> /// <returns></returns> private void DeleteStreetLight(Recordset streetLightAttributeRS, bool locatable) { IGTKeyObjects relatedFeatures = GTClassFactory.Create <IGTKeyObjects>(); IGTKeyObjects deleteFeatures = GTClassFactory.Create <IGTKeyObjects>(); IGTKeyObject feature = GTClassFactory.Create <IGTKeyObject>(); try { StreetLightImportUtility importUtility = new StreetLightImportUtility(m_oGTDataContext); if (!m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Begin("Importing Street Light(s) using Import Tool"); } if (locatable) { streetLightAttributeRS.MoveFirst(); feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value)); deleteFeatures.Add(feature); relatedFeatures = importUtility.GetRelatedFeatures(feature, 3); if (relatedFeatures.Count > 0) { feature = CheckForMiscellaneousStructure(relatedFeatures, feature.FID); if (feature != null) { deleteFeatures.Add(feature); } } } else { streetLightAttributeRS.MoveFirst(); while (!streetLightAttributeRS.EOF) { feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value)); deleteFeatures.Add(feature); streetLightAttributeRS.MoveNext(); } } importUtility.DeleteFeatures(deleteFeatures); if (m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Commit(true); m_oGTTransactionManager.RefreshDatabaseChanges(); } } catch { throw; } }
public bool CheckIsoScenarioFeature(short selectedFeatureFNO, int selectedFeatureFID) { bool isolationScenario = false; try { IGTKeyObject selectedFeature = m_dataContext.OpenFeature(selectedFeatureFNO, selectedFeatureFID); string feedType = string.Empty; if (selectedFeatureFNO == 59 && selectedFeature.Components.GetComponent(5901).Recordset != null && selectedFeature.Components.GetComponent(5901).Recordset.RecordCount > 0) { selectedFeature.Components.GetComponent(5901).Recordset.MoveFirst(); feedType = Convert.ToString(selectedFeature.Components.GetComponent(5901).Recordset.Fields["FEED_TYPE"].Value); } else if (selectedFeatureFNO == 60 && selectedFeature.Components.GetComponent(6002).Recordset != null && selectedFeature.Components.GetComponent(6002).Recordset.RecordCount > 0) { selectedFeature.Components.GetComponent(6002).Recordset.MoveFirst(); feedType = Convert.ToString(selectedFeature.Components.GetComponent(6002).Recordset.Fields["FEED_TYPE"].Value); } //ISODUAL if (selectedFeatureFNO == 34) //Autotransformer { isolationScenario = true; m_isolationScenarioType = IsolationScenarios.ISODUAL; } //ISOSINGLE else if (selectedFeatureFNO == 4 || selectedFeatureFNO == 12 || selectedFeatureFNO == 59 || (selectedFeatureFNO == 60 && feedType.ToUpper() == "RADIAL") || selectedFeatureFNO == 99 || selectedFeatureFNO == 98) { isolationScenario = true; m_isolationScenarioType = IsolationScenarios.ISOSINGLE; } //ELBOW else if (selectedFeatureFNO == 5 || (selectedFeatureFNO == 60 && feedType.ToUpper() == "LOOP")) { isolationScenario = true; m_isolationScenarioType = IsolationScenarios.ELBOW; } //BYPASS else if (selectedFeatureFNO == 14 || selectedFeatureFNO == 15 || selectedFeatureFNO == 36) { isolationScenario = true; m_isolationScenarioType = IsolationScenarios.BYPASS; } else { isolationScenario = false; } } catch { throw; } return(isolationScenario); }
public IGTKeyObject GetOwner(string p_structureId) { Recordset rsOwner = null; try { rsOwner = GetOwnerRecordSet(p_structureId); if (rsOwner != null) { rsOwner.MoveFirst(); if (rsOwner.RecordCount > 1) { while (!rsOwner.EOF) { if (rsOwner.Fields[0] != null && !string.IsNullOrEmpty(Convert.ToString(rsOwner.Fields[0].Value))) { if (Convert.ToString(rsOwner.Fields[0].Value) == "PPI" || Convert.ToString(rsOwner.Fields[0].Value) == "ABI" || Convert.ToString(rsOwner.Fields[0].Value) == "INI") { return(m_oGTDataContext.OpenFeature(Convert.ToInt16(rsOwner.Fields[1].Value), Convert.ToInt32(rsOwner.Fields[2].Value))); } } rsOwner.MoveNext(); } } else if (rsOwner.RecordCount == 1) { return(m_oGTDataContext.OpenFeature(Convert.ToInt16(rsOwner.Fields[1].Value), Convert.ToInt32(rsOwner.Fields[2].Value))); } } else { m_strStatus = "ERROR"; m_strComment = "Invalid Structure located. Valid features are Miscellaneous Structure, Pole, and Street Light Standard."; } } catch { throw; } finally { if (rsOwner != null) { rsOwner.Close(); rsOwner = null; } } return(null); }
public void Execute() { int fId = 0; short fNo = 0; short treeTrimmingGraphicCno = 19002; short workPointFno = 191; short treeTrimmingFno = 190; short workPointGcNo = 19102; IGTOrientedPointGeometry workPointGeometry = null;; IGTKeyObject treeTrimmingFeature = null; IGTKeyObject workPointFeature = null; IGTComponent mainComponent = null; short cid = 0; try { IGTSpatialService spatialService = GTClassFactory.Create <IGTSpatialService>(); spatialService.DataContext = m_DataContext; spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContains; spatialService.FilterGeometry = Components.GetComponent(treeTrimmingGraphicCno).Geometry; Recordset rs = spatialService.GetResultsByFNO(new short[] { workPointFno }); if (rs != null) { IGTComponent tTVGraphic = Components.GetComponent(treeTrimmingGraphicCno); int tTVFid = Convert.ToInt32(tTVGraphic.Recordset.Fields["G3E_FID"].Value); treeTrimmingFeature = DataContext.OpenFeature(treeTrimmingFno, tTVFid); DeleteWorkLabelGeometry(treeTrimmingFeature); if (rs.RecordCount > 0) { rs.MoveFirst(); while (!rs.EOF) { fId = Convert.ToInt32(rs.Fields["G3E_FID"].Value.ToString()); workPointFeature = DataContext.OpenFeature(workPointFno, fId); mainComponent = workPointFeature.Components.GetComponent(workPointGcNo); mainComponent.Recordset.MoveFirst(); workPointGeometry = (IGTOrientedPointGeometry)mainComponent.Geometry; cid = (short)(cid + 1); CreateWorkLabelGeometry(workPointGeometry, treeTrimmingFeature, cid); rs.MoveNext(); } } } } catch (Exception ex) { MessageBox.Show("Error during Tree Trimming Labels execution." + ex.Message, "G/Technology"); } }
private void ProcessActiveStreetLightDDC(IGTDDCKeyObjects ddcStreetLightList) { try { foreach (IGTDDCKeyObject ddcobj in ddcStreetLightList) { if ((ddcobj.Geometry.Type == GTGeometryTypeConstants.gtgtOrientedPointGeometry) || (ddcobj.Geometry.Type == GTGeometryTypeConstants.gtgtPointGeometry)) { IGTKeyObject koStreetLight = oDC.OpenFeature(ddcobj.FNO, ddcobj.FID); oRelationService.ActiveFeature = koStreetLight; IGTKeyObjects koOwnedByList = oRelationService.GetRelatedFeatures(3); // Owned By if (koOwnedByList == null) { continue; } if (koOwnedByList.Count == 0) { continue; } //Should only be one IGTKeyObject that owns a streetlight //Need Common_N data on both the structure and the streetlight IGTKeyObject koStructure = koOwnedByList[0]; GTActiveStreetLight objStreetLight = CommandUtilities.GetCommonNActiveFeature(koStreetLight, koStructure, oDiag); if (objStreetLight == null) { continue; } objStreetLight.G3E_FID = ddcobj.FID; objStreetLight.G3E_FNO = ddcobj.FNO; objStreetLight.Structure_FID = koStructure.FID; objStreetLight.StructureFNO = koStructure.FNO; this.oActiveList.Add(objStreetLight); } } } catch (Exception ex) { CommandUtilities.LogException(oDiag, "ProcessActiveStreetLightDDC", ex); throw ex; } }
public void DeleteExistingDucts(short p_FNO, int p_FID) { try { IGTKeyObject oKeyObject = m_oDataContext.OpenFeature(p_FNO, p_FID); IGTRelationshipService oRelSVC = GTClassFactory.Create <IGTRelationshipService>(); oRelSVC.DataContext = m_oDataContext; oRelSVC.ActiveFeature = oKeyObject; IGTKeyObjects oDucks = oRelSVC.GetRelatedFeatures(7); if (oDucks != null && oDucks.Count > 0) { for (int i = 0; i < oDucks.Count; i++) { foreach (IGTComponent item in oDucks[i].Components) { DeleteComponent(item); } } } } catch (Exception ex) { string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message); throw new Exception(exMsg); } }
private bool DeleteFeature(short FNO, int FID) { try { IGTKeyObject removeObject = gtDataContext.OpenFeature(FNO, FID); Recordset deleteOrder = gtDataContext.MetadataRecordset("G3E_FEATURECOMPS_OPTABLE", "G3E_FNO = " + FNO); deleteOrder.MoveFirst(); while (!deleteOrder.EOF && !deleteOrder.BOF) { for (int i = 0; i < removeObject.Components.Count; i++) { if (removeObject.Components[i].CNO == Convert.ToInt16(deleteOrder.Fields["G3E_CNO"].Value)) { if (!removeObject.Components[i].Recordset.EOF && !removeObject.Components[i].Recordset.BOF) { removeObject.Components[i].Recordset.MoveFirst(); removeObject.Components[i].Recordset.Delete(); } } } deleteOrder.MoveNext(); } return(true); } catch { return(false); } }
internal bool ISPrimaryGraphicComponentExist(short fNo, int fid) { bool exist = false; try { // Get the Primary Geo Graphic CNO short primaryCno = GetPrimaryGraphicCno(fNo, true); // If the CNO is zero (not defined), then try the detail CNO if (0 == primaryCno) { primaryCno = GetPrimaryGraphicCno(fNo, false); } // If we have a CNO (and we should for either Geo or Detail at this point), then proceed to validate the existence of the component recordset if (0 != primaryCno) { IGTComponent gTPrimaryComponent = gTDataContext.OpenFeature(fNo, fid).Components.GetComponent(primaryCno); if (gTPrimaryComponent != null && gTPrimaryComponent.Recordset != null && gTPrimaryComponent.Recordset.RecordCount > 0) { exist = true; } } } catch { throw; } return(exist); }
/// <summary> /// Verify Selected objects are streetlights or not. /// </summary> /// <returns></returns> public bool IsSelectSetStreetLight() { IList <int> SelectedFeatureIDList = new List <int>(); bool returnValue = true; try { if (m_gTDDCKeyObjects.Count > 0) { foreach (IGTDDCKeyObject ddcKey in m_gTDDCKeyObjects) { if (!SelectedFeatureIDList.Contains(ddcKey.FID)) { SelectedFeatureIDList.Add(ddcKey.FID); if (ddcKey.FNO != 56) { returnValue = false; } m_SelectedKeyObjects.Add(m_gTDataContext.OpenFeature(56, ddcKey.FID)); } } } } catch { throw; } dataLayer.m_SelectedKeyObjects = m_SelectedKeyObjects; return(returnValue); }
public void Execute() { try { Recordset rsVPAttributes = m_gComps[m_gCompName].Recordset; if (ValidateVirtualPoint(rsVPAttributes)) { IGTKeyObject associatedFeature = DataContext.OpenFeature(m_gtAssociatedFNO, m_gtAssociatedFID); IGTComponent associatedCommonComp = associatedFeature.Components.GetComponent(1); if (associatedCommonComp != null) { if (associatedCommonComp.Recordset != null && associatedCommonComp.Recordset.RecordCount > 0) { associatedCommonComp.Recordset.MoveFirst(); SetFieldsOfVirtualPoints(Convert.ToString(associatedCommonComp.Recordset.Fields["FEATURE_STATE_C"].Value), associatedFeature.Components.GetComponent(11)); } } //SetNormalAsOperatedStatusOfVirtualPoints(); } } catch (Exception ex) { MessageBox.Show("There is an error in \"Virtual Point Association\" Funtional Interface \n" + ex.Message, "G/Technology"); } }
/// <summary> /// /// </summary> /// <param name="edits"></param> public static void SaveData(System.Data.DataTable edits) { gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving edits…"); //try { foreach (System.Data.DataRow row in edits.Rows) { transactionManager.Begin("Edit Feature"); IGTKeyObject editedFeature = gtDataContext.OpenFeature(FNO, Convert.ToInt32(row["G3E_FID"])); IGTComponent editedComponenent = editedFeature.Components.GetComponent(Convert.ToInt16(row["G3E_CNO"])); editedComponenent.Recordset.Filter = "G3E_CID = " + row["G3E_CID"].ToString(); editedComponenent.Recordset.MoveFirst(); foreach (Field field in editedComponenent.Recordset.Fields) { if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adVarChar) { if (field.Value != row[field.Name].ToString()) { field.Value = row[field.Name]; } } else if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adNumeric) { if (DBNull.Value.Equals(row[field.Name]) || field.Value != Convert.ToDecimal(row[field.Name])) { if (row[field.Name].Equals(null)) { field.Value = null; } else { field.Value = row[field.Name]; } } } else if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adDBTimeStamp) { if (field.Value != Convert.ToDateTime(row[field.Name])) { field.Value = row[field.Name]; } } else if (DBNull.Value.Equals(field.Value) && !DBNull.Value.Equals(row[field.Name])) { field.Value = row[field.Name]; } } transactionManager.Commit(); editedFeature = null; gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); } } //catch (Exception error) //{ // transactionManager.Rollback(); // MessageBox.Show("Error in SaveData (" + error.Message + ")", "G/Technology"); //} }
private IGTKeyObject CheckforVirtualpoint(short isoPtNumber) { IGTKeyObject feature = null; bool exist = false; try { String sql = "select G3E_FID,G3E_FNO from VIRTUALPT_N where ASSOCIATED_FID = ?"; Recordset virtualRS = m_dataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, m_IsolationScenarioFeature.GtKeyObject.FID); if (virtualRS != null && virtualRS.RecordCount > 0) { virtualRS.MoveFirst(); while (!virtualRS.EOF) { feature = m_dataContext.OpenFeature(Convert.ToInt16(virtualRS.Fields["G3E_FNO"].Value), Convert.ToInt32(virtualRS.Fields["G3E_FID"].Value)); if (isoPtNumber == 1) { foreach (IGTKeyObject relFeature in m_IsolationScenarioFeature.RelatedFeaturesNode2) { if (feature.FID != relFeature.FID && (feature.FNO == 6 || feature.FNO == 82)) { exist = true; break; } } } else { foreach (IGTKeyObject relFeature in m_IsolationScenarioFeature.RelatedFeaturesNode1) { if (feature.FID != relFeature.FID && (feature.FNO == 6 || feature.FNO == 82)) { exist = true; break; } } } if (exist) { break; } virtualRS.MoveNext(); } } } catch { throw; } return(feature); }
/// <summary> /// Gets the pole owner list /// </summary> /// <returns>List of pole owners</returns> private List <string> GetPoleOwnerList() { try { List <string> ownersList = new List <string>(); IGTKeyObject gTKeyObject = DataContext.OpenFeature(110, POLE_FID); Recordset rs = gTKeyObject.Components.GetComponent(11001).Recordset; rs.MoveFirst(); while (!rs.EOF) { ownersList.Add(Convert.ToString(rs.Fields["OWNING_COMPANY_C"].Value)); rs.MoveNext(); } return(ownersList); } catch (Exception) { throw; } }
/// <summary> /// Performs buffer query with a given reference point, distance and FNO. /// FNO is the target feature FNO for which feature class instances are to be searched inside the buffer zone. /// </summary> /// <returns>Key Value pair of feature class instance and distance from reference point</returns> public Dictionary <int, double> PerformBufferQuery() { Recordset resultRecordSet = null; IGTGeometry gTGeometry = null; try { IGTOrientedPointGeometry gTOrientedPointGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>(); gTOrientedPointGeometry.Origin = m_referencePoint; IGTZoneService gTZoneService = GTClassFactory.Create <IGTZoneService>(); gTZoneService.ZoneWidth = m_distance; gTZoneService.InputGeometries = gTOrientedPointGeometry; IGTGeometry outPutGeometry = gTZoneService.OutputGeometries; IGTSpatialService spatialService = GTClassFactory.Create <IGTSpatialService>(); spatialService.DataContext = m_iGtDataContext; spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContains; spatialService.FilterGeometry = outPutGeometry; resultRecordSet = spatialService.GetResultsByFNO(new short[] { this.m_targetFno }); if (resultRecordSet != null && resultRecordSet.RecordCount > 0) { resultRecordSet.MoveFirst(); m_fidDistancePair = new Dictionary <int, double>(); short primaryGraphicCno = GetPrimaryGraphicCno(m_targetFno); while (!resultRecordSet.EOF) { int fid = Convert.ToInt32(resultRecordSet.Fields["G3E_FID"].Value); gTGeometry = m_iGtDataContext.OpenFeature(m_targetFno, fid).Components.GetComponent(primaryGraphicCno).Geometry; if (gTGeometry != null) { m_fidDistancePair.Add(fid, CalculateDistanceFromReferencePoint(gTGeometry.FirstPoint)); } resultRecordSet.MoveNext(); } } return(m_fidDistancePair); } catch (Exception) { throw; } finally { if (resultRecordSet != null) { resultRecordSet.Close(); resultRecordSet = null; } } }
public void featureHandler() { if (selectedFeatures[0].FNO == g_Secondary_Box_FNO) { foreach (IGTDDCKeyObject feature in selectedFeatures) { IGTKeyObject keyObject = dataContext.OpenFeature(feature.FNO, feature.FID); IGTComponent cuAttributes = keyObject.Components.GetComponent(21); cuAttributes.Recordset.Fields["ACTIVITY_C"].Value = "UR"; } } else { foreach (IGTDDCKeyObject feature in selectedFeatures) { replaceOrRemoveDialog dialog = new replaceOrRemoveDialog(feature.FNO); dialog.ShowDialog(); IGTKeyObject keyObject = dataContext.OpenFeature(feature.FNO, feature.FID); IGTComponent cuAttributes = keyObject.Components.GetComponent(21); cuAttributes.Recordset.Fields["ACTIVITY_C"].Value = dialog.activityCode; dialog.Close(); } } }
/// <summary> /// Locate the associated Work Point feature (if it exists) for the active WR job. /// </summary> /// <param name="gTCommonComponent">Common component</param> /// <returns></returns> public IGTKeyObjects FindWorkpointsOfFeature(IGTComponent gTCommonComponent) { IGTKeyObjects workPointKeyObjects = GTClassFactory.Create <IGTKeyObjects>(); try { if (gTCommonComponent != null && gTCommonComponent.Recordset.RecordCount > 0) { gTCommonComponent.Recordset.MoveFirst(); if (DBNull.Value != gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value) { string strStructureId = Convert.ToString(gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value); if (!string.IsNullOrEmpty(strStructureId)) { string sql = "select g3e_fid,g3e_fno from workpoint_n where STRUCTURE_ID=? and wr_nbr=?"; Recordset rs = m_gTDataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, strStructureId, m_gTDataContext.ActiveJob); if (rs != null && 0 < rs.RecordCount) { if (1 < rs.RecordCount) { // If we get multiple workpoints for the same structure that below to the same WR, // then that's an error and validation should stop. throw new Exception("Multiple Workpoints found having the same Structure ID and WR values.", new Exception("MULTIPLE WORKPOINTS")); } rs.MoveFirst(); do { workPointKeyObjects.Add(m_gTDataContext.OpenFeature(Convert.ToInt16(rs.Fields["g3e_fno"].Value), Convert.ToInt32(rs.Fields["g3e_fid"].Value))); rs.MoveNext(); } while (!rs.EOF); } } } } } catch { throw; } return(workPointKeyObjects); }
public void SynchronizeWorkPointForObsoleteCUs(Dictionary <int, Int16> p_m_WorkPointsKeyObjects) { IGTKeyObject oKeyObject = GTClassFactory.Create <IGTKeyObject>(); try { foreach (KeyValuePair <int, Int16> item in p_m_WorkPointsKeyObjects) { oKeyObject = m_dataContext.OpenFeature(item.Value, item.Key); DeleteObsoleteCURecords(oKeyObject); } } catch (Exception ex) { string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message); throw new Exception(exMsg); } }
/// <summary> /// Method to check whether the active feature has Isolation Point on Node1. /// If Isolation Point exists then validate association and update if necessary. /// </summary> /// <param name="isoPtExists">True, if virtual point was found</param> /// <returns>Boolean indicating method execution status</returns> private bool ValidateIsolationPoint(ref bool isoPtExists, ref bool isoPtDelete) { bool returnValue = false; try { isoPtExists = false; IGTKeyObject feature = null; String sql = "select G3E_FID,G3E_FNO from VIRTUALPT_N where ASSOCIATED_FID = ?"; Recordset virtualRS = m_dataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, m_IsolationScenarioFeature.GtKeyObject.FID); if (virtualRS != null && virtualRS.RecordCount > 0) { virtualRS.MoveFirst(); feature = m_dataContext.OpenFeature(Convert.ToInt16(virtualRS.Fields["G3E_FNO"].Value), Convert.ToInt32(virtualRS.Fields["G3E_FID"].Value)); isoPtExists = true; CheckForVirtualGeometry(feature, ref isoPtDelete); if (!isoPtDelete) { m_IsolationScenarioFeature.IsolationPoint1 = feature; // Validate and set, if necessary, specific Isolation Point attributes to associated feature string errMessage; m_IsoCommon.SetVirtualPointAttributes(m_IsolationScenarioFeature, feature, out errMessage); } } returnValue = true; } catch (Exception ex) { returnValue = false; if (m_IsoCommon.InteractiveMode) { MessageBox.Show("Error in Isolation Scenario FI:ValidateIsolationPoint - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } return(returnValue); }
/// <summary> /// Method to update the Structure Id of associated work points for a structure /// </summary> /// <param name="fno"></param> /// <param name="fid"></param> /// <param name="newStructureId"></param> private void UpdateAssociatedWorkPointsStructureId(short fno, int fid, string newStructureId) { List <int> workPointFidList = null; try { int recordsAffected = 0; ADODB.Recordset rs = DataContext.Execute("select g3e_fid WPFID from workpoint_cu_n where assoc_fid = " + fid + " and assoc_fno =" + fno, out recordsAffected, (int)ADODB.CommandTypeEnum.adCmdText, new int[0]); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); workPointFidList = new List <int>(); while (!rs.EOF) { workPointFidList.Add(Convert.ToInt32(rs.Fields["WPFID"].Value)); rs.MoveNext(); } } if (workPointFidList != null) { foreach (int wpFid in workPointFidList) { IGTKeyObject workPointFeature = m_DataContext.OpenFeature(191, wpFid); if (workPointFeature != null) { Recordset workPointFeatureRs = workPointFeature.Components.GetComponent(19101).Recordset; if (workPointFeatureRs != null && workPointFeatureRs.RecordCount > 0) { workPointFeatureRs.MoveFirst(); workPointFeatureRs.Fields["STRUCTURE_ID"].Value = newStructureId; } } } } } catch (Exception) { throw; } }
/// <summary> /// This method performs point in polygon query and if the point exists inside polygon, then it returns the boundary feature recordset /// </summary> /// <returns></returns> public Recordset PerformPointInPolygon() { Recordset resultRecordSet = null; try { IGTSpatialService spatialService = GTClassFactory.Create <IGTSpatialService>(); spatialService.DataContext = m_iGtDataContext; if (this.m_boundaryFid == 0) { spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContainedBy; IGTOrientedPointGeometry pointGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>(); IGTPoint gtPoint = GTClassFactory.Create <IGTPoint>(); gtPoint.X = m_iGtpoint.X; gtPoint.Y = m_iGtpoint.Y; gtPoint.Z = 0; pointGeometry.Origin = gtPoint; spatialService.FilterGeometry = pointGeometry; resultRecordSet = spatialService.GetResultsByFNO(new short[] { this.m_boundaryFno }); return(resultRecordSet); } // FID is provided. Retrieve the geometry of the boundary feature and check whether the boundary contains the point IGTKeyObject boundaryFeature = m_iGtDataContext.OpenFeature(this.m_boundaryFno, this.m_boundaryFid); IGTGeometry boundaryGeometry = (IGTGeometry)boundaryFeature.Components.GetComponent(FnoGraphicCnoPair[this.m_boundaryFno]).Geometry; spatialService.Operator = GTSpatialOperatorConstants.gtsoEntirelyContains; spatialService.FilterGeometry = boundaryGeometry; resultRecordSet = spatialService.GetResultsByFNO(new short[] { this.m_pointFno }); if (resultRecordSet != null && resultRecordSet.RecordCount > 0) { resultRecordSet = boundaryFeature.Components.GetComponent(FnoGraphicCnoPair[this.m_boundaryFno]).Recordset; } return(resultRecordSet); } catch (Exception) { throw; } }
/// <summary> /// Method to find whether a given secondary feature is a network feature based on the FEEDER_TYPE_C value of NETWORK /// </summary> /// <param name="fid"></param> /// <param name="fno"></param> /// <returns></returns> private bool IsNetworkFeature(int fid, short fno) { bool bReturn = false; IGTKeyObject keyObject = m_oDataContext.OpenFeature(fno, fid); if (keyObject.Components.GetComponent(11) != null) { if (keyObject.Components.GetComponent(11).Recordset != null) { if (keyObject.Components.GetComponent(11).Recordset.RecordCount > 0) { keyObject.Components.GetComponent(11).Recordset.MoveFirst(); if (keyObject.Components.GetComponent(11).Recordset.Fields["FEEDER_TYPE_C"].Value.Equals("NETWORK")) { bReturn = true; } } } } return(bReturn); }
void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e) { IGTLocateService selectedFeaturesService; IGTDDCKeyObjects selectedFeatures; try { m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); m_iGtApplication.BeginWaitCursor(); m_invalidFeatureMessage = false; if (e.Button == 1) { selectedFeaturesService = m_iGtApplication.ActiveMapWindow.LocateService; selectedFeatures = selectedFeaturesService.Locate(e.WorldPoint, -1, 0, GTSelectionTypeConstants.gtmwstSelectAll); IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); List <int> fidList = new List <int>(); foreach (IGTDDCKeyObject ddcKeyObject in selectedFeatures) { if (!fidList.Contains(ddcKeyObject.FID)) { fidList.Add(ddcKeyObject.FID); selectedObjects.Add(ddcKeyObject); } } if (selectedObjects == null || selectedObjects.Count == 0) { return; } m_selectedObject = selectedObjects[0]; if (m_selectedObject.FNO != m_originalObject.FNO || m_selectedObject.FID == m_originalObject.FID) // Restrict selection to features of the same class as the original feature { m_invalidFeatureMessage = true; m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Invalid feature selected.Selected feature(s) are not of same class as source feature or selected feature itself is source feature."); return; } m_iGtApplication.ActiveMapWindow.HighlightedObjects.AddSingle(m_selectedObject); if (m_oGTTransactionManager != null && !m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Begin(" begin Repeat reconductoring..."); } if (ProcessChangeOutsToTargetFeature()) { m_oGTTransactionManager.Commit(); m_oGTTransactionManager.RefreshDatabaseChanges(); // Synchronize Work points - ALM-1838-JIRA-2514 SynchronizeWP(m_dataContext.OpenFeature(m_originalObject.FNO, m_originalObject.FID)); SynchronizeWP(m_dataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID)); m_iGtApplication.EndWaitCursor(); m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Identify next span to changeout wires; double-click to exit."); } } } catch (Exception ex) { if (m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Rollback(); } ExitCommand(); MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { m_iGtApplication.EndWaitCursor(); } }
public void Execute() { GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Creating Duct COnfiguration"); String valueEntered = ""; String sFNO = ""; int FID = 0; int iHorz = 0; int iVert = 0; IGTKeyObject Feature = null; short FNO = 0; IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); try { //objGlobal.gServices = GTClassFactory.Create<IGTRelationshipService>(); //objGlobal.gDataCont = DataContext; ADODB.Recordset netElementSet = _components.GetComponent(2401).Recordset; netElementSet.MoveFirst(); valueEntered = netElementSet.Fields["CONFIG_C"].Value.ToString(); sFNO = netElementSet.Fields["G3E_FNO"].Value.ToString(); FID = Convert.ToInt32(netElementSet.Fields["G3E_FID"].Value.ToString()); FNO = Convert.ToInt16(sFNO); Feature = DataContext.OpenFeature(FNO, FID); ////Validate if the Duct Configuration is defined already //csGlobals.gServices.ActiveFeature = Feature; //IGTKeyObjects oCollection = GTClassFactory.Create<IGTKeyObjects>(); //oCollection = csGlobals.gServices.GetRelatedFeatures(csConstant.iContains); //if (oCollection != null) //{ // GTClassFactory.Create<IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); // MessageBox.Show( " Duct Configuration is alredy defined", "Create Duct Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); // netElementSet.Fields["CU_C"].Value = _original.FieldValue.ToString(); // return; //} csGlobals objGlobal = new csGlobals(DataContext, Feature); if (sFNO != "2400") { GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); return; } if (valueEntered == "") { GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); return; } else { try { Char Delimiter = 'X'; String[] sValues = valueEntered.Split(Delimiter); int iVal = 1; foreach (var sValue in sValues) { if (iVal == 1) { string sCorrectValue = Regex.Match(sValue, @"\d").Value; iHorz = Convert.ToInt32(sCorrectValue); } else { string sCorrectValue = Regex.Match(sValue, @"\d").Value; iVert = Convert.ToInt32(sCorrectValue); } iVal = iVal + 1; } } catch (Exception exValue) { MessageBox.Show(exValue.Message + " Value is incorrect, should be Horizontal Number X Vertical Number. Example: 2X2", "Create Duct Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error); } oApp.BeginWaitCursor(); objGlobal.DeleteExistingDucts(FNO, FID); objGlobal.CreateDucConfiguration(iHorz, iVert); oApp.EndWaitCursor(); } } catch (Exception ex) { MessageBox.Show("Error in Duct Creation " + ex.Message); } finally { oApp.EndWaitCursor(); } GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); }
/// <summary> /// Method to set the ONCOR specific default attributes /// </summary> /// <param name="oCompRS"></param> /// <param name="iCurrentCID"></param> /// <param name="iCNO"></param> private void SetONCORSpecificDefaultAttributes(ADODB.Recordset oCompRS, int iCurrentCID) { try { string sFieldName = ""; string sCU = Convert.ToString(oCompRS.Fields["CU_C"].Value); IGTKeyObject oKeyObj = m_oDataContext.OpenFeature(Convert.ToInt16(oCompRS.Fields["G3E_FNO"].Value), Convert.ToInt32(oCompRS.Fields["G3E_FID"].Value)); ADODB.Recordset rs = m_oDataContext.OpenRecordset("select * from CULIB_UNIT where CU_ID =?", CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, sCU); if (rs != null) { if (rs.RecordCount > 0) { sFieldName = ""; sFieldName = GetParameter("CU Description Field Name", "CUSelection", "CUSelection", true).ToString(); if (Convert.ToString(rs.Fields["CU_DESC"].Value).Length > 59) { oCompRS.Fields[sFieldName].Value = Convert.ToString(rs.Fields["CU_DESC"].Value).Substring(0, 59); } else { oCompRS.Fields[sFieldName].Value = Convert.ToString(rs.Fields["CU_DESC"].Value); } MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); sFieldName = ""; sFieldName = GetParameter("CU Prime Account # Field Name", "CUSelection", "CUSelection", true).ToString(); if (!IsDBNull(rs.Fields["PRIME_ACCT_NBR"].Value)) { oCompRS.Fields[sFieldName].Value = Convert.ToString(rs.Fields["PRIME_ACCT_NBR"].Value); MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); } sFieldName = ""; sFieldName = GetParameter("CU Property Unit Field Name", "CUSelection", "CUSelection", true).ToString(); if (!IsDBNull(rs.Fields["PROPERTY_UNIT_C"].Value)) { oCompRS.Fields[sFieldName].Value = Convert.ToString(rs.Fields["PROPERTY_UNIT_C"].Value); MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); } sFieldName = ""; sFieldName = GetParameter("CU Retirement Type Name", "CUSelection", "CUSelection", true).ToString(); if (!IsDBNull(rs.Fields["RETIREMENT_NBR"].Value)) { oCompRS.Fields[sFieldName].Value = Convert.ToString(rs.Fields["RETIREMENT_NBR"].Value); MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); } sFieldName = ""; sFieldName = GetParameter("CU Length Flag Field Name", "CUSelection", "CUSelection", true).ToString(); string sFieldName2 = GetParameter("CU Quantity/Length Name", "CUSelection", "CUSelection", true).ToString(); if (Convert.ToString(rs.Fields["UNIT_OF_MEASURE_C"].Value).Equals("FT")) { oCompRS.Fields[sFieldName].Value = "L"; oCompRS.Fields[sFieldName2].Value = GetQuantityLength(oKeyObj); } else { oCompRS.Fields[sFieldName].Value = "Q"; //if (Convert.ToInt32(oCompRS.Fields["G3E_CNO"].Value) != m_iAncCompUnitCNO) //{ oCompRS.Fields[sFieldName2].Value = 1; //} } MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); sFieldName = ""; sFieldName = GetParameter("CU Installed WR", "CUSelection", "CUSelection", true).ToString(); string sInstalledWR = Convert.ToString(oCompRS.Fields[sFieldName].Value); oCompRS.Fields[sFieldName].Value = m_oApp.DataContext.ActiveJob; MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); sFieldName = ""; sFieldName = GetParameter("CU Edited WR", "CUSelection", "CUSelection", true).ToString(); if (!sInstalledWR.Equals(m_oApp.DataContext.ActiveJob)) { oCompRS.Fields[sFieldName].Value = m_oApp.DataContext.ActiveJob; MoveRecordSetToCurrentCID(oCompRS, iCurrentCID); } } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Get the pole attributes and populates Ticket Attributes class /// </summary> /// <returns>True, if Ticket Attributes are populated successfully. Else returns false</returns> private bool GetPoleAttributes() { string serviceAreaCode = string.Empty; string countyBoundaryId = string.Empty; int nearestServicePointFid = 0; Dictionary <int, double> servicePointsDictionary = null; try { m_TicketAttributes = new TicketAttributes(); IGTKeyObject gTKeyObject = m_DataContext.OpenFeature(110, m_PoleFid); Recordset rs = gTKeyObject.Components.GetComponent(1).Recordset; if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); m_TicketAttributes.POLE_FID = m_PoleFid; m_TicketAttributes.POLE_NUMBER = Convert.ToString(rs.Fields["STRUCTURE_ID"].Value); m_TicketAttributes.MISCELLANEOUS_ID = m_WrNumber; m_TicketAttributes.LATITUDE = Convert.ToString(rs.Fields["LATITUDE"].Value); m_TicketAttributes.LONGITUDE = Convert.ToString(rs.Fields["LONGITUDE"].Value); } IGTGeometry geometry = gTKeyObject.Components.GetComponent(11002).Geometry; IGTPoint point = GTClassFactory.Create <IGTPoint>(); point.X = geometry.FirstPoint.X; point.Y = geometry.FirstPoint.Y; point.Z = geometry.FirstPoint.Z; customBoundaryQuery boundaryQuery = new customBoundaryQuery(point, 235);// County boundary FNO 235 Recordset resultRs1 = boundaryQuery.PerformPointInPolygon(); if (resultRs1 != null && resultRs1.RecordCount > 0) { IGTKeyObject countyFeature = m_DataContext.OpenFeature(Convert.ToInt16(resultRs1.Fields["G3E_FNO"].Value), Convert.ToInt32(resultRs1.Fields["G3E_FID"].Value)); Recordset boundaryAttributesRs = countyFeature.Components.GetComponent(23501).Recordset; // // County Boundary Attributes if (boundaryAttributesRs != null && boundaryAttributesRs.RecordCount > 0) { boundaryAttributesRs.MoveFirst(); m_TicketAttributes.COUNTY = Convert.ToString(boundaryAttributesRs.Fields["NAME"].Value); if (!string.IsNullOrEmpty(Convert.ToString(boundaryAttributesRs.Fields["ID"].Value))) { countyBoundaryId = Convert.ToString(boundaryAttributesRs.Fields["ID"].Value).Replace("TX", string.Empty).Trim(); } } } if (!string.IsNullOrEmpty(countyBoundaryId)) { int nJunsMemberId = 0; Recordset contactRs = GetRecordSet(string.Format("SELECT NJUNS_MEMBER_ID,CONTACT_NAME,CONTACT_PHONE FROM NJUNS_CONTACTS WHERE COUNTY_N_ID = {0}", countyBoundaryId)); if (contactRs != null && contactRs.RecordCount > 0) { contactRs.MoveFirst(); m_TicketAttributes.CONTACT_NAME = Convert.ToString(contactRs.Fields["CONTACT_NAME"].Value); m_TicketAttributes.CONTACT_PHONE = Convert.ToString(contactRs.Fields["CONTACT_PHONE"].Value); // m_TicketAttributes.PLACE = Convert.ToString(contactRs.Fields["NJUNS_PLACE_NAME"].Value); nJunsMemberId = Convert.ToInt32(contactRs.Fields["NJUNS_MEMBER_ID"].Value); contactRs.Close(); contactRs = null; } contactRs = GetRecordSet(string.Format("SELECT NJUNS_MEMBER FROM NJUNS_MEMBER WHERE NJUNS_MEMBER_ID = {0}", nJunsMemberId)); if (contactRs != null && contactRs.RecordCount > 0) { contactRs.MoveFirst(); m_TicketAttributes.CREATED_MEMBER = Convert.ToString(contactRs.Fields["NJUNS_MEMBER"].Value); m_TicketAttributes.POLE_OWNER = Convert.ToString(contactRs.Fields["NJUNS_MEMBER"].Value); } } customBufferQuery oCustomBufferQuery = new customBufferQuery(point, m_DistanceFromPoleInFeet, 55); //Closest Premise feature within 300 feet of the Pole. Service point FNO 55 servicePointsDictionary = oCustomBufferQuery.PerformBufferQuery(); if (servicePointsDictionary != null && servicePointsDictionary.Count > 0) { servicePointsDictionary.OrderBy(key => key.Value); nearestServicePointFid = servicePointsDictionary.First().Key; IGTKeyObject servicePointFeature = m_DataContext.OpenFeature(55, nearestServicePointFid); Recordset premiseAttributesRs = servicePointFeature.Components.GetComponent(5504).Recordset; // PREMISE_N if (premiseAttributesRs != null && premiseAttributesRs.RecordCount > 0) { premiseAttributesRs.MoveFirst(); m_TicketAttributes.HOUSE_NUMBER = Convert.ToString(premiseAttributesRs.Fields["HOUSE_NBR"].Value); m_TicketAttributes.STREET_NAME = Convert.ToString(premiseAttributesRs.Fields["DIR_LEADING_C"].Value) + " " + Convert.ToString(premiseAttributesRs.Fields["STREET_NM"].Value) + " " + Convert.ToString(premiseAttributesRs.Fields["STREET_TYPE_C"].Value) + " " + Convert.ToString(premiseAttributesRs.Fields["DIR_TRAILING_C"].Value); } } // Set default vaues m_TicketAttributes.TICKET_NUMBER = string.Empty; m_TicketAttributes.TICKET_TYPE = "Transfer"; m_TicketAttributes.TICKET_STATUS = "OPEN"; m_TicketAttributes.STATE = "TX"; m_TicketAttributes.PRIORITY_CODE = "3"; m_TicketAttributes.NJUNS_TICKET_ID = -1; m_TicketAttributes.DAYS_INTERVAL = "30"; m_TicketAttributes.JOB_TYPE = "Transfer"; m_TicketAttributes.NUMBER_OF_POLES = "1"; m_TicketAttributes.REMARKS = string.Empty; return(true); } catch (Exception) { MessageBox.Show("Failed to populate some ticket attributes.", "Custom Create Ticket Error", MessageBoxButtons.OK); return(false); } }
/// <summary> /// Method to validate that the Isolation Scenario is configured correctly. /// If configured correctly then no action. /// Else, create virtual points and/or establish connectivity as necessary. /// </summary> public void ValidateIsolationScenario() { Dictionary <int, GTRelationshipOrdinalConstants> dicRelatedNodes = new Dictionary <int, GTRelationshipOrdinalConstants>(); try { bool isoPtExists = false; bool bypassPtCreated = false; // Check if Isolation Scenario is valid on Node1. if (ValidateIsolationPoint(m_IsolationScenarioFeature.RelatedFeaturesNode1, ref isoPtExists, 1)) { if (!isoPtExists) { // Create Isolation Point since one doesn't exist CreateIsolationPoint(1); bypassPtCreated = true; m_IsoCommon.SetNormalAndAsOperatedStatus(m_IsolationScenarioFeature.IsolationPoint1, 1); } // Check if Isolation Scenario is valid on Node2. if (ValidateIsolationPoint(m_IsolationScenarioFeature.RelatedFeaturesNode2, ref isoPtExists, 2)) { if (!isoPtExists) { // Create Isolation Point since one doesn't exist CreateIsolationPoint(2); bypassPtCreated = true; m_IsoCommon.SetNormalAndAsOperatedStatus(m_IsolationScenarioFeature.IsolationPoint2, 2); } // Check if for bypass point short fno = 0; Int32 fid = 0; if (ValidateBypassPoint(ref isoPtExists, ref fno, ref fid)) { if (!isoPtExists) { // Create Bypass Point since one doesn't exist CreateIsolationPoint(3); bypassPtCreated = true; m_IsoCommon.SetNormalAndAsOperatedStatus(m_IsolationScenarioFeature.IsolationPoint3); } else { m_IsolationScenarioFeature.IsolationPoint3 = m_dataContext.OpenFeature(fno, fid); } } GTRelationshipOrdinalConstants relatedNode = GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1; foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode1) { if (feature.FID != m_IsolationScenarioFeature.IsolationPoint1.FID) { m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode); dicRelatedNodes.Add(feature.FID, relatedNode); } } using (IGTRelationshipService oRel = GTClassFactory.Create <IGTRelationshipService>()) { oRel.DataContext = m_dataContext; oRel.ActiveFeature = m_IsolationScenarioFeature.GtKeyObject; oRel.SilentDelete(14, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); // If features related to Isolation Scenario feature are connected directly to Node 1 of Isolation Scenario feature, then // reconnect features to Isolation Point feature. foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode1) { // Skip the processing for the Isolation Point feature since the Isolation Point was already validated/updated. if (feature.FID != m_IsolationScenarioFeature.IsolationPoint1.FID && dicRelatedNodes.TryGetValue(feature.FID, out relatedNode) && feature.FNO != 40) { //m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode); m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint1, feature, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, relatedNode); } } dicRelatedNodes.Clear(); foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode2) { if (feature.FID != m_IsolationScenarioFeature.IsolationPoint2.FID) { m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode); dicRelatedNodes.Add(feature.FID, relatedNode); } } oRel.SilentDelete(14, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); // If features related to Isolation Scenario feature are connected directly to Node 2 of Isolation Scenario feature, then // reconnect features to Isolation Point feature. foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode2) { // Skip the processing for the Isolation Point feature since the Isolation Point was already validated/updated. if (feature.FID != m_IsolationScenarioFeature.IsolationPoint2.FID && dicRelatedNodes.TryGetValue(feature.FID, out relatedNode) && feature.FNO != 40) { // m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode); m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint2, feature, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, relatedNode); } } } m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint1, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint2, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint3, m_IsolationScenarioFeature.IsolationPoint1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint3, m_IsolationScenarioFeature.IsolationPoint2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); m_IsoCommon.EstablishOwnerShip(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint1); m_IsoCommon.EstablishOwnerShip(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint2); m_IsoCommon.EstablishOwnerShip(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint3); m_IsoCommon.PopulateProtectionDeviceIDForIsoPt(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint1); m_IsoCommon.PopulateProtectionDeviceIDForIsoPt(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint2); m_IsoCommon.PopulateProtectionDeviceIDForIsoPt(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint3); } } } catch (Exception ex) { if (m_IsoCommon.InteractiveMode) { MessageBox.Show("Error in Isolation Scenario FI:ValidateIsolationScenario - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } finally { dicRelatedNodes.Clear(); dicRelatedNodes = null; } }