public void Execute() { short fNo = 0; string attributeValue; try { IGTComponent component = Components[ComponentName]; ADODB.Recordset componentRs = component.Recordset; if (componentRs.RecordCount > 0) { componentRs.MoveFirst(); if (componentRs.Fields["G3E_FNO"].Value == null) { return; } fNo = Convert.ToInt16(componentRs.Fields["G3E_FNO"].Value); CheckForActiveFnoInValueMap(fNo, out attributeValue); if (!String.IsNullOrEmpty(attributeValue)) { componentRs.Fields["ORIENTATION_C"].Value = attributeValue; } } } catch (Exception ex) { MessageBox.Show("Error during Set Attributes By FeatureClass execution. " + ex.Message, "G/Technology"); } }
/// <summary> /// Method to check whether the CU attributes component exists for active feature /// </summary> /// <returns>true, if CU attributes component exists</returns> private bool CheckIfValidCuAttributesExists(out bool isDummyCUCodeExists) { isDummyCUCodeExists = false; try { IGTKeyObject feature = m_iGtApplication.DataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID); IGTComponent cuComponent = feature.Components.GetComponent(21); if (cuComponent != null) { Recordset cuComponentRs = cuComponent.Recordset; if (cuComponentRs != null && cuComponentRs.RecordCount > 0) { cuComponentRs.MoveFirst(); while (!cuComponentRs.EOF) { string cuCode = Convert.ToString(cuComponentRs.Fields["CU_C"].Value); if (!string.IsNullOrEmpty(cuCode) && cuCode.Length > 2 && cuCode.ToUpper().Substring(0, 2).Contains("ZZ")) { isDummyCUCodeExists = true; break; } cuComponentRs.MoveNext(); } } return(true); } return(false); } catch (Exception) { throw; } }
public void Execute() { //JIRA-686 FI to blank out the Phase Postion when Phase is set to N if (_fieldName == "PHASE_C") { IGTComponent comp = Components[ComponentName]; Recordset compRecords = comp.Recordset; string strPhase; try { if (compRecords != null) { compRecords.MoveFirst(); while (!(compRecords.EOF || compRecords.BOF)) { strPhase = Convert.ToString(compRecords.Fields[_fieldName].Value); if (strPhase != null && strPhase == "N") { compRecords.Fields["PHASE_POS_C"].Value = null; } compRecords.MoveNext(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Caption); } finally { comp = null; } } }
/// <summary> /// Get the CU activity from CU Attributes for the input UNIT CNO and CID /// </summary> /// <param name="cno">UNIT component number in the CU component instance</param> /// <param name="cid">UNIT CID in the CU component instance</param> /// <returns>CU activity</returns> private string GetCorrespondingCUActivityForUnitInstance(short cno, int cid) { try { string sReturn = string.Empty; IGTComponent cuComponent = Components.GetComponent(21); Recordset tmpRs = cuComponent.Recordset; tmpRs.Filter = "UNIT_CNO = " + cno + " AND UNIT_CID = " + cid; if (tmpRs.RecordCount > 0) { sReturn = Convert.ToString(tmpRs.Fields["ACTIVITY_C"].Value); tmpRs.Filter = FilterGroupEnum.adFilterNone; } else { tmpRs.Filter = FilterGroupEnum.adFilterNone; tmpRs.Filter = "G3E_CID = " + cid; if (tmpRs.RecordCount > 0) { tmpRs.MoveFirst(); sReturn = Convert.ToString(tmpRs.Fields["ACTIVITY_C"].Value); } tmpRs.Filter = FilterGroupEnum.adFilterNone; } return(sReturn); } catch (Exception) { throw; } }
/// <summary> /// Method to delete work label geometry /// </summary> /// <param name="currentFeature"> Tree trimming feature</param> /// <returns></returns> private bool DeleteWorkLabelGeometry(IGTKeyObject currentFeature) { Recordset rs = null; try { IGTComponent igtComp = currentFeature.Components.GetComponent(19006); if (igtComp != null) { rs = currentFeature.Components.GetComponent(19006).Recordset; if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); while (!rs.EOF) { rs.Delete(); rs.MoveNext(); } } } return(true); } catch (Exception) { throw; } }
/// <summary> /// Checks that features with a closed status have the same value for both Feeder ID and Tie Feeder ID. /// </summary> private bool CheckForEqualFeederTieFeederValues() { bool equal = true; try { IGTComponent connecComp = Components[ComponentName]; if (connecComp != null && connecComp.Recordset != null && connecComp.Recordset.RecordCount > 0) { connecComp.Recordset.MoveFirst(); if (Convert.ToString(connecComp.Recordset.Fields["STATUS_OPERATED_C"].Value).ToUpper() == "CLOSED") { if (!connecComp.Recordset.Fields["FEEDER_1_ID"].Value.Equals(connecComp.Recordset.Fields["FEEDER_2_ID"].Value)) { equal = false; } } } } catch { throw; } return(equal); }
private void CheckForVirtualGeometry(IGTKeyObject feature, ref bool isoPtDelete) { short virtualPointCNO = 0; try { if (m_IsoCommon.IsDetailMapWindow()) { virtualPointCNO = 79; } else { virtualPointCNO = 78; } IGTComponent virtualPointPrimaryComp = feature.Components.GetComponent(virtualPointCNO); if (virtualPointPrimaryComp != null) { if (virtualPointPrimaryComp.Geometry == null) { isoPtDelete = true; } } } catch { throw; } }
/// <summary> /// Method to create Work Label geometry /// </summary> /// <param name="wpGeometry"> WorkPoint geometry</param> /// <param name="tTVfeature"> Tree trimming feature </param> /// <param name="cid">cid</param> private void CreateWorkLabelGeometry(IGTOrientedPointGeometry wpGeometry, IGTKeyObject tTVfeature, short cid) { try { IGTTextPointGeometry iGtTxtPointGeometry = GTClassFactory.Create <IGTTextPointGeometry>(); IGTPoint textPoint = GTClassFactory.Create <IGTPoint>(); textPoint.X = wpGeometry.Origin.X + Convert.ToDouble(m_Arguments.GetArgument(0)); textPoint.Y = wpGeometry.Origin.Y + Convert.ToDouble(m_Arguments.GetArgument(1)); textPoint.Z = 0; iGtTxtPointGeometry.Origin = textPoint; IGTComponent igtComponent = tTVfeature.Components.GetComponent(19006); if (igtComponent.Recordset.RecordCount != 0) { igtComponent.Recordset.MoveLast(); } igtComponent.Recordset.AddNew("G3E_FID", tTVfeature.FID); igtComponent.Recordset.Fields["G3E_FNO"].Value = 190; igtComponent.Recordset.Fields["G3E_CNO"].Value = 19006; igtComponent.Recordset.Fields["G3E_CID"].Value = cid; igtComponent.Geometry = iGtTxtPointGeometry; igtComponent.Recordset.Update(System.Type.Missing, System.Type.Missing); } catch (Exception) { throw; } }
private void DeleteComponent(IGTComponent p_oComponent) { try { if (p_oComponent != null) { if (p_oComponent.Recordset != null) { if (p_oComponent.Recordset.RecordCount > 0) { p_oComponent.Recordset.MoveFirst(); while (p_oComponent.Recordset.EOF == false) { p_oComponent.Recordset.Delete(); if (p_oComponent.Recordset.EOF == false) { p_oComponent.Recordset.MoveNext(); } } } } } } 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 void CUAttributesLengthUpdate(IGTComponent p_commonComponent, short compCNO) { try { if (m_components.GetComponent(compCNO) != null) { if (m_components.GetComponent(compCNO).Recordset != null && m_components.GetComponent(compCNO).Recordset.RecordCount > 0) { Recordset rsCU = m_components.GetComponent(compCNO).Recordset; p_commonComponent.Recordset.MoveFirst(); rsCU.MoveFirst(); while (!rsCU.EOF) { rsCU.Fields["QTY_LENGTH_Q"].Value = p_commonComponent.Recordset.Fields["LENGTH_ACTUAL_Q"].Value; rsCU.MoveNext(); } } } } catch { throw; } }
/// <summary> /// Method to set the Actual and Graphic length attribute of both Common and Connectivity/Ductivity Attributes Components. /// </summary> /// <param name="p_commonGraphicLengthMtr">Graphic Length in meters</param> /// <param name="p_commonComp">Common component</param> private void SetLengthAttributes(double p_commonGraphicLengthMtr, IGTComponent p_commonComp) { IGTComponent component = null; try { GetGraphicLengthConvertedMtrToFt(p_commonGraphicLengthMtr); GetConnectivityComp(ref component); if (m_type == GTFunctionalTypeConstants.gtftcSetValue) { p_commonComp.Recordset.MoveFirst(); if (p_commonComp.Recordset.Fields["LENGTH_GRAPHIC_FT"].Value.GetType() != typeof(DBNull)) { m_ftGraphicLengthValueBeforeChange = Convert.ToDouble(p_commonComp.Recordset.Fields["LENGTH_GRAPHIC_FT"].Value); } p_commonComp.Recordset.Fields["LENGTH_GRAPHIC_FT"].Value = m_ftGraphicLength; p_commonComp.Recordset.Update(); } SetActualLength(p_commonComp.Recordset, null); SetConnectivityLengthAttributes(component, p_commonComp.Recordset); } catch { throw; } }
/// <summary> /// Method to set the tie Feeder Attribute and Feeder Attribute of the active component from the value of related component. /// </summary> /// <param name="p_ActiveComponent"></param> /// <param name="p_FeederAttribute"></param> /// <param name="p_activeField"></param> /// <param name="p_tieFeederAttribute"></param> /// <param name="p_normalStatus"></param> public void SetFeederAttribute(IGTComponent p_ActiveComponent, string p_FeederAttribute, string p_activeField, string p_tieFeederAttribute, string p_normalStatus) { try { if (p_ActiveComponent != null && p_ActiveComponent.Recordset != null && p_ActiveComponent.Recordset.RecordCount > 0) { p_ActiveComponent.Recordset.MoveFirst(); p_ActiveComponent.Recordset.Fields[p_activeField].Value = p_FeederAttribute; if (p_tieFeederAttribute != null) { if (string.Equals(p_normalStatus.ToUpper(), "CLOSED")) { p_ActiveComponent.Recordset.Fields[p_tieFeederAttribute].Value = p_FeederAttribute; } } p_ActiveComponent.Recordset.Update(); } } catch { throw; } }
private bool ValidateRestrictedAreaFeature(IGTComponent restrictedAreaAttributes) { Recordset restrictedAreaAttributesRs = null; string authorizedRole = string.Empty; string authorizedWrs = string.Empty; List <string> authorizedWrList = null; try { if (restrictedAreaAttributes != null) { restrictedAreaAttributesRs = restrictedAreaAttributes.Recordset; if (restrictedAreaAttributesRs != null && restrictedAreaAttributesRs.RecordCount > 0) { restrictedAreaAttributesRs.MoveFirst(); authorizedRole = Convert.ToString(restrictedAreaAttributesRs.Fields["AUTH_ROLE"].Value); authorizedWrs = Convert.ToString(restrictedAreaAttributesRs.Fields["AUTH_WR_LIST"].Value); if (authorizedWrs != null) { authorizedWrList = authorizedWrs.Split(',').ToList(); return(CheckPermissions(authorizedRole, authorizedWrList)); } } } return(true);//Prathyusha: return false; } catch (Exception) { throw; } }
/// <summary> /// This method will update the feature state for the selected feature /// </summary> /// <param name="selectedObject"></param> private void SetFeatureState(IGTDDCKeyObject selectedObject) { string featureState = string.Empty; ADODB.Recordset commonComponentRs = null; try { IGTKeyObject feature = m_iGtApp.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID); IGTComponent commonComponent = feature.Components.GetComponent(1); if (commonComponent != null) { commonComponentRs = commonComponent.Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); featureState = Convert.ToString(commonComponentRs.Fields["FEATURE_STATE_C"].Value); if (featureState == "PPI" || featureState == "ABI") { commonComponentRs.Fields["FEATURE_STATE_C"].Value = "INI"; } if (featureState == "PPR" || featureState == "ABR") { commonComponentRs.Fields["FEATURE_STATE_C"].Value = "OSR"; } } } } catch (Exception) { throw; } }
/// <summary> /// When a feature is created with a SCADA Attributes component, this interface sets the Device ID attribute to the next available unique value /// </summary> public void Execute() { IGTApplication _gtApp = (IGTApplication)GTClassFactory.Create <IGTApplication>(); _gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Device ID Attribute Update FI"); IGTComponent comp = Components[ComponentName]; try { if (comp != null) { Recordset rs = null; int i = 0; comp.Recordset.MoveFirst(); rs = _gtApp.DataContext.Execute("SELECT " + m_seqName + ".NEXTVAL FROM DUAL", out i, (int)CommandTypeEnum.adCmdText); if (rs != null && rs.RecordCount > 0) { comp.Recordset.Fields[m_fieldName].Value = Convert.ToString(rs.Fields[0].Value); comp.Recordset.Update(); } } } catch (Exception ex) { MessageBox.Show("Error occured in fiSetAttributeBySequence FI " + ex.Message, Caption); } finally { // comp = null; } }
/// <summary> /// Update StreetLightAttributes component. /// </summary> /// <param name="gtCompo">Street light attribute component.</param> private void UpdateStreetLightAttributes(IGTComponent gtCompo) { try { Recordset tempRs = null; tempRs = gtCompo.Recordset; if (tempRs != null) { if (tempRs.RecordCount > 0) { gtCompo.Recordset.MoveFirst(); if (m_Islocatable) { gtCompo.Recordset.Fields["LOCATABLE_YN"].Value = "Y"; } else { gtCompo.Recordset.Fields["LOCATABLE_YN"].Value = "N"; } gtCompo.Recordset.Update(); } } } catch { 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 update the new Structure Id for owned features only if the structure id is existing previously and it is same the owner's structure Id /// </summary> /// <param name="commonCompRs">Common component recordset of active feature</param> /// <param name="newStructureId">Structure Id to update on the owned features</param> private void UpdateStructureIdForOwnedFeatures(Recordset commonCompRs, string newStructureId) { List <Tuple <short, int> > ownedFeatures = null; // FNO,FID IGTComponent commonComponent = null; try { int fid = Convert.ToInt32(commonCompRs.Fields["G3E_FID"].Value); short fno = Convert.ToInt16(commonCompRs.Fields["G3E_FNO"].Value); // string oldStructureId = Convert.ToString(commonCompRs.Fields["STRUCTURE_ID"].Value); IGTKeyObject activeFeature = DataContext.OpenFeature(fno, fid); ownedFeatures = GetOwnedFeatures(activeFeature); if (ownedFeatures == null) { return; } foreach (Tuple <short, int> feature in ownedFeatures) { commonComponent = DataContext.OpenFeature(feature.Item1, feature.Item2).Components.GetComponent(1); commonComponent.Recordset.MoveFirst(); commonComponent.Recordset.Fields["STRUCTURE_ID"].Value = newStructureId; } } catch (Exception) { throw; } }
private bool CheckValidManualLandbaseFeature(IGTComponent landbaseAuditingComp) { short m_ActiveFNO = 0; bool valid = false; try { if (landbaseAuditingComp != null && landbaseAuditingComp.Recordset.RecordCount > 0) { landbaseAuditingComp.Recordset.MoveFirst(); m_ActiveFNO = Convert.ToInt16(landbaseAuditingComp.Recordset.Fields["G3E_FNO"].Value); if (m_LandbaseManualFNOs.Contains(m_ActiveFNO)) { valid = true; } } } catch { throw; } return(valid); }
/// <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> /// This method validated the selected feature is Structure or not. /// </summary> /// <param name="Fid"></param> /// <param name="Fno"></param> private void ConfirmSelectedFeatureIsStructure(int fid, short fno) { try { IGTComponent gTCommonComponent = null; assetHistoryModel.m_FID = fid; assetHistoryModel.m_KeyObject = assetHistoryModel.m_DataContext.OpenFeature(fno, fid); assetHistoryModel.m_WRID = null; if (assetHistoryModel.m_KeyObject.Components["COMMON_N"] != null) { gTCommonComponent = assetHistoryModel.m_KeyObject.Components["COMMON_N"]; } if (gTCommonComponent != null && gTCommonComponent.Recordset != null && gTCommonComponent.Recordset.RecordCount > 0) { gTCommonComponent.Recordset.MoveFirst(); if (!string.IsNullOrEmpty(Convert.ToString(gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value))) { assetHistoryModel.m_isStructure = true; assetHistoryModel.m_StructureID = Convert.ToString(gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value); } else { assetHistoryModel.m_isStructure = false; } } } catch { throw; } }
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> /// Method to validate the feature state /// </summary> /// <param name="selectedObject">Selected feature on map window</param> /// <returns>false if feature state is not in one of legel features states</returns> private bool ValidateFeatureState() { string featureState = string.Empty; Recordset commonComponentRs = null; try { IGTKeyObject feature = m_iGtApplication.DataContext.OpenFeature(m_originalObject.FNO, m_originalObject.FID); IGTComponent commonComponent = feature.Components.GetComponent(1); if (commonComponent != null) { commonComponentRs = commonComponent.Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); featureState = Convert.ToString(commonComponentRs.Fields["FEATURE_STATE_C"].Value); } } if (featureState != "PPX") { return(false); } return(true); } catch (Exception) { throw; } }
/// <summary> /// Finds and Validates the workpoints associated to the input component parameter. /// </summary> /// <param name="gTCommonComponent">Common component</param> private void CreateOrUpdateWorkpoint(IGTComponent gTCommonComponent, bool isLinear, int ownerCount) { try { IGTKeyObjects gTKeyObjects = FindWorkpointsOfFeature(gTCommonComponent); if (gTKeyObjects != null) { if (gTKeyObjects.Count <= 0) { CreateNewWorkpointFeature(Convert.ToInt16(gTCommonComponent.Recordset.Fields["G3E_FNO"].Value), Convert.ToInt32(gTCommonComponent.Recordset.Fields["G3E_FID"].Value), isLinear, Convert.ToString(gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value), ownerCount); } else { UpdateWorkpointComponents(Convert.ToInt16(gTCommonComponent.Recordset.Fields["G3E_FNO"].Value), Convert.ToInt32(gTCommonComponent.Recordset.Fields["G3E_FID"].Value), gTKeyObjects[0], false, Convert.ToString(gTCommonComponent.Recordset.Fields["STRUCTURE_ID"].Value), ownerCount, isLinear); } } } catch { throw; } }
/// <summary> /// Updates the Workpoint attributes component fiedls. /// </summary> /// <param name="component">Work Point Attributes component</param> private void UpdateWorkPointAttributes(IGTComponent component, string strStructureID) { Recordset tempRs = null; tempRs = component.Recordset; if (tempRs != null) { if (tempRs.RecordCount > 0) { component.Recordset.MoveFirst(); component.Recordset.Fields["STRUCTURE_ID"].Value = strStructureID; component.Recordset.Fields["WR_NBR"].Value = m_dataContext.ActiveJob; if (m_WorkpointNumber == 0) { m_WorkpointNumber = m_gtcommonFunctions.GetWorkPointNumber(); } else { m_WorkpointNumber = m_WorkpointNumber + 1; } component.Recordset.Fields["WP_NBR"].Value = m_WorkpointNumber; component.Recordset.Update(); } } }
public override void Delete() { try { m_WorkPointCommonFunctions = new WorkPointCommonFunctions(ActiveKeyObject, DataContext); m_gTActiveComponent = GetActiveComponent(); m_WorkPointCommonFunctions.m_gTActiveComponent = m_gTActiveComponent; m_WorkPointCommonFunctions.m_gTComponents = Components; if ((m_gTActiveComponent != null) && (m_gTActiveComponent.CNO == 21 || m_gTActiveComponent.CNO == 22)) { DeleteWorkpointCUInstace(); if (m_gTActiveComponent.CNO == 22) { SetAncillaryAttribute(); } } } catch (Exception ex) { MessageBox.Show("Error during execution of Accounting Impact FI." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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); }
private void DeleteWorkPointCULabel(IGTKeyObject p_WPKeyObject) { try { IGTComponent oCUComponent = p_WPKeyObject.Components.GetComponent(19105); if (oCUComponent != null) { if (oCUComponent.Recordset != null) { if (oCUComponent.Recordset.RecordCount > 0) { oCUComponent.Recordset.MoveFirst(); while (oCUComponent.Recordset.EOF == false) { oCUComponent.Recordset.Delete(); if (oCUComponent.Recordset.EOF == false) { oCUComponent.Recordset.MoveNext(); } } } } } } catch (Exception) { throw; } }
/// <summary> /// CheckAssociatedFeature: Check whether the active feature is present as ASSOCIATED_FID for virtual point. /// </summary> /// <param name="relatedFeature">Virtaul point Features related to active feature</param> /// <param name="activeFID">FID of the active feature</param> /// <returns></returns> private bool CheckAssociatedFeature(IGTKeyObject relatedFeature, Int32 activeFID) { IGTComponent virtualComponent = null; bool associated = false; try { virtualComponent = relatedFeature.Components.GetComponent(m_virtualAttributesCNO); if (virtualComponent != null) { if (virtualComponent.Recordset != null && virtualComponent.Recordset.RecordCount > 0) { virtualComponent.Recordset.MoveFirst(); if (Convert.ToInt32(virtualComponent.Recordset.Fields["ASSOCIATED_FID"].Value == DBNull.Value ? 0.0 : virtualComponent.Recordset.Fields["ASSOCIATED_FID"].Value) == activeFID && Convert.ToChar(virtualComponent.Recordset.Fields["PERMANENT_YN"].Value) == 'N') { associated = true; } } } } catch { throw; } return(associated); }
/// <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"); //} }