/// <summary> /// check input fno is of type ploygon /// </summary> /// <param name="g3eFno"></param> /// <returns></returns> public static bool CheckForBoundaryFno(int g3eFno) { bool flag = false; Recordset rs = _gtDataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO=" + g3eFno + " AND G3E_TYPE=8"); if (rs != null && rs.RecordCount > 0) { flag = true; } return(flag); }
private string GetDialogType(string m_sDialogNo) { ADODB.Recordset tmpDiaRS; string sDialogType; sDialogType = ""; tmpDiaRS = m_oDataContext.MetadataRecordset("G3E_DIALOGS_OPTABLE"); tmpDiaRS.Filter = "G3E_DNO=" + m_sDialogNo.ToString(); if (!(tmpDiaRS.EOF && tmpDiaRS.BOF)) { sDialogType = tmpDiaRS.Fields["G3E_TYPE"].Value.ToString(); } return(sDialogType); }
/// <summary> /// Method to get the primary graphic cno for fno /// </summary> /// <param name="fNo"></param> /// <param name="Geo">true to return Geo CNO, false to return Detail CNO</param> /// <returns>cno or 0</returns> internal short GetPrimaryGraphicCno(short fNo, bool Geo) { short primaryGraphicCno = 0; Recordset tempRs = null; try { tempRs = gTDataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO = " + fNo); if (tempRs != null && tempRs.RecordCount > 0) { tempRs.MoveFirst(); string field = Geo ? "G3E_PRIMARYGEOGRAPHICCNO" : "G3E_PRIMARYDETAILCNO"; //if(System.DBNull.Value != tempRs.Fields[field].Value) if (!Convert.IsDBNull(tempRs.Fields[field].Value)) { primaryGraphicCno = Convert.ToInt16(tempRs.Fields[field].Value); } } return(primaryGraphicCno); } catch { throw; } finally { if (tempRs != null) { tempRs.Close(); tempRs = null; } } }
/// <summary> /// Method to get the tie Feeder Attribute Field Name. /// </summary> /// <param name="p_tieANO"></param> /// <param name="p_CNO"></param> /// <returns></returns> public string GetTieFeederAttributeFieldName(long p_tieANO, short p_CNO) { string strTieFeederFieldName = null; Recordset rs = null; try { rs = m_oGTDataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE"); rs.Filter = "G3E_ANO = " + p_tieANO + " AND G3E_CNO = " + p_CNO; if (rs != null) { if (!(rs.EOF && rs.BOF)) { rs.MoveFirst(); strTieFeederFieldName = Convert.ToString(rs.Fields["G3E_FIELD"].Value); } } } catch { throw; } return(strTieFeederFieldName); }
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); } }
/// <summary> /// Method to get the primary graphic cno for fno /// </summary> /// <param name="fNo"></param> /// <returns>cno or 0</returns> internal short GetPrimaryGraphicCno(short fNo) { short primaryGraphicCno = 0; try { Recordset tempRs = m_dataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO = " + fNo); if (tempRs != null && tempRs.RecordCount > 0) { tempRs.MoveFirst(); primaryGraphicCno = Convert.ToInt16(tempRs.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value); } return(primaryGraphicCno); } catch (Exception) { throw; } }
/// <summary> /// Establish ownership between street light and Miscellaneous Structure. /// </summary> /// <param name="gtStreetLightKObject"></param> private void EstablishOwnership(IGTKeyObject gtStreetLightKObject) { IGTRelationshipService gtRelationshipService = GTClassFactory.Create <IGTRelationshipService>(); try { Recordset ownerRNORecords = m_oGTDataContext.MetadataRecordset("G3E_RELATIONSHIPS_OPTABLE", "G3E_TYPE = 3 AND G3E_TABLE = 'G3E_OWNERSHIP_ELEC' AND G3E_USERNAME = '******'"); ownerRNORecords.MoveFirst(); gtRelationshipService.DataContext = m_oGTDataContext; gtRelationshipService.ActiveFeature = gtStreetLightKObject; if (gtRelationshipService.AllowSilentEstablish(gTOwnerKeyObject)) { gtRelationshipService.SilentEstablish(Convert.ToInt16(ownerRNORecords.Fields["G3E_RNO"].Value), gTOwnerKeyObject); } } catch { throw; } }
/// <summary> /// Method to build the MetadataRecordset. /// </summary> /// <param name="p_tableName">SQL Query</param> /// <returns></returns> public Recordset GetMetadataRecordset(string p_tableName) { Recordset recordset = null; try { recordset = m_oGTDataContext.MetadataRecordset(p_tableName); } catch { throw; } return(recordset); }
/// <summary> /// SetLandbaseAttributes /// </summary> private void SetLandbaseAttributes() { Recordset attributeRS = null; string userANONewFieldName = string.Empty; string dateANONewFieldName = string.Empty; string userANOUpdateFieldName = string.Empty; string dateANOUpdateFieldName = string.Empty; IGTComponent landbaseAuditingComp = null; short landbaseAuditingCNO = 3; try { landbaseAuditingComp = Components.GetComponent(landbaseAuditingCNO); if (CheckValidManualLandbaseFeature(landbaseAuditingComp)) { attributeRS = m_gtDataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE"); if (attributeRS != null) { GetAttributeField(attributeRS, m_iuserANONew, ref userANONewFieldName); GetAttributeField(attributeRS, m_idateANONew, ref dateANONewFieldName); GetAttributeField(attributeRS, m_iuserANOUpdate, ref userANOUpdateFieldName); GetAttributeField(attributeRS, m_idateANOUpdate, ref dateANOUpdateFieldName); attributeRS.Filter = FilterGroupEnum.adFilterNone; } string sql = "select user, SYSDATE from dual"; attributeRS = m_gtDataContext.OpenRecordset(sql, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, (int)CommandTypeEnum.adCmdText, new object[1]); attributeRS.MoveFirst(); if (Type == GTFunctionalTypeConstants.gtftcAddNew) { if (landbaseAuditingComp != null && landbaseAuditingComp.Recordset.RecordCount > 0) { landbaseAuditingComp.Recordset.MoveFirst(); landbaseAuditingComp.Recordset.Fields[userANONewFieldName].Value = attributeRS.Fields["user"].Value; landbaseAuditingComp.Recordset.Fields[dateANONewFieldName].Value = attributeRS.Fields["sysdate"].Value; } } else if (Type == GTFunctionalTypeConstants.gtftcUpdate) { if (landbaseAuditingComp != null && landbaseAuditingComp.Recordset.RecordCount > 0) { landbaseAuditingComp.Recordset.MoveFirst(); landbaseAuditingComp.Recordset.Fields[userANOUpdateFieldName].Value = attributeRS.Fields["user"].Value; landbaseAuditingComp.Recordset.Fields[dateANOUpdateFieldName].Value = attributeRS.Fields["sysdate"].Value; } } } } catch { throw; } }
/// <summary> /// Method to create an Isolation Point. /// </summary> /// <param name="isoPtNumber">Isolation point number</param> /// <returns>Boolean indicating method execution status</returns> private bool CreateIsolationPoint(short isoPtNumber) { bool returnValue = false; short primaryCNO = 0; short isoPtCNO = 0; try { IGTKeyObject isoPtKO = m_dataContext.NewFeature(6); string errMessage; m_IsoCommon.SetAttributeDefaults(isoPtKO, out errMessage); m_IsoCommon.SetVirtualPointAttributes(m_IsolationScenarioFeature, isoPtKO, out errMessage); Recordset oRSFeature = m_dataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "g3e_fno = " + m_IsolationScenarioFeature.GtKeyObject.FNO); m_IsoCommon.IsDetailMapWindow(); if (m_IsoCommon.detailID == 0) { primaryCNO = Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value); isoPtCNO = 78; } else { primaryCNO = Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value); isoPtCNO = 79; } // Check if symbol component has been created. If metadata is defined with alternate required component then symbol record will need to be added. if (isoPtKO.Components.GetComponent(isoPtCNO).Recordset.RecordCount == 0) { isoPtKO.Components.GetComponent(isoPtCNO).Recordset.AddNew(); isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_FNO"].Value = isoPtKO.FNO; isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_FID"].Value = isoPtKO.FID; if (m_IsoCommon.detailID != 0) { isoPtKO.Components.GetComponent(isoPtCNO).Recordset.Fields["G3E_DETAILID"].Value = m_IsoCommon.detailID; } isoPtKO.Components.GetComponent(isoPtCNO).Recordset.MoveFirst(); } // Set the geometry IGTPoint gtPt = GTClassFactory.Create <IGTPoint>(); IGTOrientedPointGeometry orientedPtGeom = GTClassFactory.Create <IGTOrientedPointGeometry>(); orientedPtGeom = (IGTOrientedPointGeometry)m_IsolationScenarioFeature.GtKeyObject.Components.GetComponent(primaryCNO).Geometry; double xOffset = 0; double yOffset = 0; if (isoPtNumber == 1) { xOffset = IsoCommon.AUTO_XFMR_ISO_PT1_OFFSET_X; yOffset = IsoCommon.AUTO_XFMR_ISO_PT1_OFFSET_Y; } else { xOffset = IsoCommon.AUTO_XFMR_ISO_PT2_OFFSET_X; yOffset = IsoCommon.AUTO_XFMR_ISO_PT2_OFFSET_Y; } gtPt = m_IsoCommon.GetOffsetPoint(orientedPtGeom.Origin, xOffset * .3048, yOffset * .3048, orientedPtGeom.Orientation); orientedPtGeom.Origin = gtPt; isoPtKO.Components.GetComponent(isoPtCNO).Geometry = orientedPtGeom; if (isoPtNumber == 1) { //m_IsoCommon.EstablishConnectivity(isoPtKO, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); m_IsolationScenarioFeature.RelatedFeaturesNode1.Add(isoPtKO); m_IsolationScenarioFeature.IsolationPoint1 = isoPtKO; } else { //m_IsoCommon.EstablishConnectivity(isoPtKO, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); m_IsolationScenarioFeature.RelatedFeaturesNode2.Add(isoPtKO); m_IsolationScenarioFeature.IsolationPoint2 = isoPtKO; } returnValue = true; } catch (Exception ex) { returnValue = false; if (m_IsoCommon.InteractiveMode) { MessageBox.Show("Error in Isolation Scenario FI:CreateIsolationPoint - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } return(returnValue); }
private void CopyValuesFromBoundaries(Recordset premiseAttributesRs) { short fNo = 0; int fId = 0; string city = string.Empty; string county = string.Empty; string zipCode = string.Empty; string insideCityLimits = string.Empty; string tmpQry = string.Empty; try { short cityFNO = Convert.ToInt16(m_Arguments.GetArgument(0)); int cityANO = Convert.ToInt32(m_Arguments.GetArgument(1)); short countyFNO = Convert.ToInt16(m_Arguments.GetArgument(2)); int countyANO = Convert.ToInt32(m_Arguments.GetArgument(3)); short zipFNO = Convert.ToInt16(m_Arguments.GetArgument(4)); int zipANO = Convert.ToInt32(m_Arguments.GetArgument(5)); Recordset commonComponentRs = Components.GetComponent(1).Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); fNo = Convert.ToInt16(commonComponentRs.Fields["G3E_FNO"].Value); fId = Convert.ToInt32(commonComponentRs.Fields["G3E_FID"].Value); } short primaryGraphicCno = GetPrimaryGraphicCno(fNo); if (primaryGraphicCno == 0) { return; } IGTKeyObject servicePointFeature = m_DataContext.OpenFeature(fNo, fId); IGTOrientedPointGeometry geometry = (IGTOrientedPointGeometry)servicePointFeature.Components.GetComponent(primaryGraphicCno).Geometry; if (geometry == null) { return; } IGTPoint point = GTClassFactory.Create <IGTPoint>(); point.X = geometry.FirstPoint.X; point.Y = geometry.FirstPoint.Y; // City customBoundaryQuery objCustomBoundaryQuery = new customBoundaryQuery(point, cityFNO); Recordset rs = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs != null && rs.RecordCount > 0) { IGTKeyObject cityFeature = DataContext.OpenFeature(Convert.ToInt16(rs.Fields["G3E_FNO"].Value), Convert.ToInt32(rs.Fields["G3E_FID"].Value)); Recordset tempRs = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + cityANO); if (tempRs != null && tempRs.RecordCount > 0) { tempRs.MoveFirst(); string field = Convert.ToString(tempRs.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["CITY_C"].Value))) && cno > 0) { Recordset cityRs = cityFeature.Components.GetComponent(cno).Recordset; if (cityRs != null && cityRs.RecordCount > 0) { cityRs.MoveFirst(); city = Convert.ToString(cityRs.Fields[field].Value); } if (!string.IsNullOrEmpty(city)) { //premiseAttributesRs.Fields["CITY_C"].Value = city; m_City = city; //premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = "Y"; m_CityLimits = "Y"; } } } } } // County objCustomBoundaryQuery = new customBoundaryQuery(point, countyFNO); Recordset rs1 = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs1 != null && rs1.RecordCount > 0) { IGTKeyObject countyFeature = DataContext.OpenFeature(Convert.ToInt16(rs1.Fields["G3E_FNO"].Value), Convert.ToInt32(rs1.Fields["G3E_FID"].Value)); Recordset tempRs1 = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + countyANO); if (tempRs1 != null && tempRs1.RecordCount > 0) { tempRs1.MoveFirst(); string field = Convert.ToString(tempRs1.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs1.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs1.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["COUNTY_C"].Value))) && cno > 0) { Recordset countyRs = countyFeature.Components.GetComponent(cno).Recordset; if (countyRs != null && countyRs.RecordCount > 0) { countyRs.MoveFirst(); county = Convert.ToString(countyRs.Fields[field].Value); } if (!string.IsNullOrEmpty(county)) { //premiseAttributesRs.Fields["COUNTY_C"].Value = county; m_CountyCode = county; } } } } } // Zip Code objCustomBoundaryQuery = new customBoundaryQuery(point, zipFNO); Recordset rs2 = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs2 != null && rs2.RecordCount > 0) { IGTKeyObject zipCodeFeature = DataContext.OpenFeature(Convert.ToInt16(rs2.Fields["G3E_FNO"].Value), Convert.ToInt32(rs2.Fields["G3E_FID"].Value)); Recordset tempRs2 = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + zipANO); if (tempRs2 != null && tempRs2.RecordCount > 0) { tempRs2.MoveFirst(); string field = Convert.ToString(tempRs2.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs2.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs2.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["ZIP_C"].Value))) && cno > 0) { Recordset zipRs = zipCodeFeature.Components.GetComponent(cno).Recordset; if (zipRs != null && zipRs.RecordCount > 0) { zipRs.MoveFirst(); zipCode = Convert.ToString(zipRs.Fields[field].Value); } if (!string.IsNullOrEmpty(zipCode)) { //premiseAttributesRs.Fields["ZIP_C"].Value = zipCode; m_ZipCode = zipCode; } } } } try { premiseAttributesRs.Fields["CITY_C"].Value = m_City; premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = m_CityLimits; premiseAttributesRs.Fields["COUNTY_C"].Value = m_CountyCode; premiseAttributesRs.Fields["ZIP_C"].Value = m_ZipCode; } catch (Exception ex) { if (ex.Message == "Operation was canceled.") { int tmpRecModified = 0; tmpQry = "begin update premise_n set CITY_C = '" + m_City + "', INSIDE_CITY_LIMITS_YN = '" + m_CityLimits + "', COUNTY_C = '" + m_CountyCode + "', ZIP_C = '" + m_ZipCode + "' where g3e_fid = " + premiseAttributesRs.Fields["G3E_FID"].Value.ToString() + " and g3e_cid = " + premiseAttributesRs.Fields["G3E_CID"].Value.ToString() + "; end;"; m_DataContext.Execute(tmpQry, out tmpRecModified, (int)CommandTypeEnum.adCmdText); } else { throw; } } } } catch (Exception) { throw; } }
public void Execute() { GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Aggregate Phase FI"); IGTComponent activeComponent = Components[ComponentName]; short cNo = 0; string field = string.Empty; string alphabetizedPhase = string.Empty; string alphabetizedOperatedPhase = string.Empty; try { if (activeComponent != null) { //Get the active feature current CID int aCID = Convert.ToInt32(activeComponent.Recordset.Fields["G3E_CID"].Value); if ((aCID != 0)) { int anoPhase = Convert.ToInt32(m_Arguments.GetArgument(0)); int anoPhaseQty = Convert.ToInt32(m_Arguments.GetArgument(1)); int anoPhaseOperated = Convert.ToInt32(m_Arguments.GetArgument(2)); Tuple <string, string> phaseValues = GetAggregatePhaseValue(); Recordset phaseRs = DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + anoPhase);// GetRecordSet(sqlString); // Update PHASE if (phaseRs.RecordCount > 0) { phaseRs.MoveFirst(); cNo = Convert.ToInt16(phaseRs.Fields["G3E_CNO"].Value); field = Convert.ToString(phaseRs.Fields["G3E_FIELD"].Value); IGTComponent connectivityComponent = Components.GetComponent(cNo); connectivityComponent.Recordset.MoveFirst(); alphabetizedPhase = GetAlphabetizedPhase(phaseValues.Item1); connectivityComponent.Recordset.Fields[field].Value = alphabetizedPhase; } Recordset operatedPhaseRs = DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + anoPhaseOperated); // Update As-Operated Phase if (operatedPhaseRs.RecordCount > 0) { operatedPhaseRs.MoveFirst(); cNo = Convert.ToInt16(operatedPhaseRs.Fields["G3E_CNO"].Value); field = Convert.ToString(operatedPhaseRs.Fields["G3E_FIELD"].Value); IGTComponent connectivityComponent = Components.GetComponent(cNo); connectivityComponent.Recordset.MoveFirst(); alphabetizedOperatedPhase = GetAlphabetizedPhase(phaseValues.Item2); connectivityComponent.Recordset.Fields[field].Value = alphabetizedOperatedPhase; } // Update PHASE QUANTITY if (anoPhaseQty != 0) { Recordset phaseQuantityRs = DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + anoPhaseQty); if (phaseQuantityRs.RecordCount > 0) { phaseQuantityRs.MoveFirst(); cNo = Convert.ToInt16(phaseQuantityRs.Fields["G3E_CNO"].Value); field = Convert.ToString(phaseQuantityRs.Fields["G3E_FIELD"].Value); IGTComponent primaryAttributeComponent = Components.GetComponent(cNo); primaryAttributeComponent.Recordset.MoveFirst(); primaryAttributeComponent.Recordset.Fields[field].Value = GetDistinctPhaseCount(alphabetizedPhase); } } } } } catch (Exception ex) { MessageBox.Show("Error during Phase Aggregation FI execution. " + ex.Message, "G/Technology"); } }