/// <summary> /// Based on FID,CNO,CID GetActivityOftheFeature will return the activity of the instance. /// </summary> /// <param name="pFID"></param> /// <param name="pCNO"></param> /// <param name="pCID"></param> /// <param name="gTApplication"></param> /// <returns></returns> private string GetActivityOftheFeature(int pFID, int pCNO, int pCID, IGTApplication gTApplication) { Recordset rs = null; try { string sql = string.Format("select ACTIVITY_C from COMP_UNIT_N where g3e_fid={0} and g3e_cno={1} and g3e_cid={2}", pFID, pCNO, pCID); rs = gTApplication.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); return(Convert.ToString(rs.Fields[0].Value)); } } catch (Exception ex) { throw ex; } finally { rs = null; } return(null); }
private void DoExit() { try { SetStatusBarText("Exiting Street Light History..."); // This is not in the design; however, if nothing is found to display, // the system appears to have done nothing at all and this // at least gives some feedback in that case. if (0 == this.oActiveList.Count) { MessageBox.Show("No historical Street Light information was found for the features in the active map window.", "G/Technology", System.Windows.Forms.MessageBoxButtons.OK); } if (this.oCustomCmdHelper != null) { this.oDC = null; this.oMap = null; this.oApp = null; this.oCustomCmdHelper.Complete(); } } catch (Exception ex) { CommandUtilities.LogException(oDiag, "StreetLightHistory.DoExit", ex); throw ex; } }
public void Activate() { try { m_oGTApp = GTClassFactory.Create <IGTApplication>(); m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Initializing CorrectionsMode..."); m_oGTApp.Application.BeginWaitCursor(); SetJobAttributes(); if (Validate()) { CorrectionsMode(); } m_oGTApp.Application.EndWaitCursor(); m_oGTApp.Application.RefreshWindows(); return; } catch (Exception ex) { MessageBox.Show("Error in Corrections Mode command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { } }
public CommonSetCUStandardAttributes(IGTComponents p_component, string p_componentName) { m_oApp = GTClassFactory.Create <IGTApplication>(); m_oDataContext = m_oApp.DataContext; m_oComponents = p_component; m_componentName = p_componentName; }
/// <summary> /// Constructor /// </summary> /// <param name="p_voucherRS">Work Point Vouchers Recordset</param> /// <param name="p_application">The current G/Technology application object.</param> /// <param name="p_newTreeTrimmingfeature">Current placed feature</param> public ccTreeTrimRequestForm(Recordset p_voucherRS, IGTApplication p_application, IGTKeyObject p_newTreeTrimmingfeature) { InitializeComponent(); m_oWorkPointVoucherRS = p_voucherRS; this.m_oGTApp = p_application; this.m_oGTTreeTrimmingFeature = p_newTreeTrimmingfeature; }
/// <summary> /// True if conflicts exist; else, false /// </summary> public bool ConflictsExist() { try { bool retVal = false; IGTApplication app = GTClassFactory.Create <IGTApplication>(); IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>(); jobService.DataContext = app.DataContext; Recordset rs = jobService.FindConflicts(); if (null != rs && 0 < rs.RecordCount) { MessageBox.Show("Some edits conflict with other posted jobs; please run Conflict Detection to resolve before marking for closure.", "G /Technology", MessageBoxButtons.OK); retVal = true; } return(retVal); } 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> /// Attaches the construction prints, passed in as the prints parameter, to the active job. /// </summary> /// <param name="prints">File path/name of generated construction prints.</param> /// <returns>true if successful; else, false</returns> private bool AttachConstructionPrints(string prints) { bool retVal = false; try { IGTApplication app = GTClassFactory.Create <IGTApplication>(); AttachWRDocument attachWRDocument = new AttachWRDocument(); TransactionManager.Begin("Attach Archival Prints"); if (attachWRDocument.AttachDocument(app.DataContext.ActiveJob, prints, "Work Prints Design")) { TransactionManager.Commit(); retVal = true; } else { TransactionManager.Rollback(); } } 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); MessageBox.Show(exMsg, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(retVal); }
internal ValidationErrors ValidateInitialInput(IGTApplication p_App, string p_OutputLocation, string p_LegendName, out List <PlotBoundaryAttributes> p_outPlotBoundaries) { ValidationErrors b_Return = ValidationErrors.NoError; try { p_outPlotBoundaries = GetPlotBoundaries(p_App); if (string.IsNullOrEmpty(p_App.DataContext.ActiveJob)) { b_Return = ValidationErrors.ActiveJobDoesNotExist; } else if (!CanCreateFile(p_OutputLocation)) { b_Return = ValidationErrors.OutputFilePathNotAccessible; } else if (p_outPlotBoundaries.Count == 0) { b_Return = ValidationErrors.PlotBoundaryDoesNotExist; } else if (!IsValidLegend(p_App, p_LegendName)) { b_Return = ValidationErrors.NotValidLegend; } } catch (Exception) { throw; } return(b_Return); }
public bool Execute(object InputValue) { Boolean selection = false; DataTable associatedFeaturesRs = null; try { m_gtApplication = GTClassFactory.Create <IGTApplication>(); m_gtOutputValue = GTClassFactory.Create <IGTFieldValue>(); if (ProcessVirtualPointAssociation(ref associatedFeaturesRs)) { DisplayFormWithAssociatedFeatures(associatedFeaturesRs, m_gtApplication); } selection = true; } catch (Exception ex) { MessageBox.Show("There is an error in \"Virtual Point Association\" Foreign Key Query Interface \n" + ex.Message, "G/Technology"); } finally { } return(selection); }
private void btnOK_Click(object sender, EventArgs e) { IGTApplication app = GTClassFactory.Create <IGTApplication>(); app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, string.Empty); this.Close(); }
internal ValidationErrors ValidatePlotTemplate(IGTApplication p_App, string p_PlotTemplateName) { ValidationErrors b_Return = ValidationErrors.PlotTemplateDoesNotExist; try { foreach (IGTNamedPlot item in p_App.NamedPlots) { if (item.Name.Equals(p_PlotTemplateName)) { b_Return = ValidationErrors.NoError; if (!MapFrameExists(item)) { b_Return = ValidationErrors.MapFrameInPlotTemplateDoesNotExist; break; } } } } catch (Exception) { throw; } return(b_Return); }
/// <summary> /// Method to check give fid belongs to substation breaker or not /// </summary> /// <param name="protectiveDeviceFID">FID</param> /// <param name="gtApp">Application object</param> /// <returns></returns> private bool CheckIsFIDSubstation(int protectiveDeviceFID, IGTApplication gtApp) { bool isSubstationBreaker = false; int recordsEffected = 1; Recordset rsResult; try { if (protectiveDeviceFID == 0) { return(isSubstationBreaker); } String strSQL = string.Empty; strSQL += "SELECT G3E_FNO from COMMON_N where G3E_FID=" + protectiveDeviceFID + " AND G3E_FNO=16"; rsResult = gtApp.DataContext.Execute(strSQL, out recordsEffected, Convert.ToInt32(CommandTypeEnum.adCmdText)); if (rsResult.RecordCount != 0) { isSubstationBreaker = true; } rsResult.Close(); } catch (Exception ex) { throw new Exception("Error during Protective Device Validation method checkIsFIDSubstation()" + ex.Message); } finally { rsResult = null; } return(isSubstationBreaker); }
/// <summary> /// Exceutes an SQL with one string parameter /// </summary> /// <param name="sql">SQL statement to execute</param> /// <param name="p">Parameter for the SQL</param> private void ExecuteSQL(string sql, string p) { IGTApplication app = GTClassFactory.Create <IGTApplication>(); app.DataContext.Execute(sql, out int recs, (int)ADODB.CommandTypeEnum.adCmdText, p); app.DataContext.Execute("commit", out recs, (int)ADODB.CommandTypeEnum.adCmdText); }
/// <summary> /// Post the active job edits using LTT_POST.POST /// </summary> /// <returns></returns> private bool PostJobEdits() { IGTApplication app = GTClassFactory.Create <IGTApplication>(); try { // Since validations have already been performed, using the LTT_POST.POST to avoid rechecking validations, etc. TransactionManager.Begin("Post Job"); bool returnValue = Handleblanketunitizationactivity(); app.DataContext.Execute("begin ltt_post.post;end;", out int recs, (int)CommandTypeEnum.adCmdText); if (TransactionManager.TransactionInProgress) { TransactionManager.Commit(true); } return(true); } catch (Exception ex) { if (TransactionManager.TransactionInProgress) { TransactionManager.Rollback(); } app.DataContext.Execute("rollback", out int rec, (int)CommandTypeEnum.adCmdText); 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); } }
void IGTCustomCommandModal.Activate() { gtApp = GTClassFactory.Create <IGTApplication>(); try { if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND")) { PurgeLandbase(); MessageBox.Show("Sucessfully purge expired archived landbase", msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Command Access Denied. Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { var errMsg = ex.Message; if (ex.Message.Contains("ORA-20001")) { errMsg = "Parameter ArchivedLandbaseExpireDays missing in SYS_GENERALPARAMETER TABLE"; } MessageBox.Show("Error " + errMsg, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ValidationOverrides() { gtApp = GTClassFactory.Create <IGTApplication>(); wrValidationOverrides = GetValidationOverrides(gtApp.DataContext.ActiveJob); wrValidationRules = GetValidationRules(); FeatureClass = GetFeatureClass(); }
/// <summary> /// Method to initiate Update Job Status processing. This method is an asynchronous call and client will get notification of completion of the process through event WriteBackProcessCompleted /// </summary> /// <param name="p_wrNumber">G3E_JOB.WR_NBR</param> /// <param name="p_jobStatus">G3E_JOB.JOB_STATUS</param> /// <param name="taskId">Unique task ID that needs to be passed through caller. Example Guid taskID = Guid.NewGuid();</param> public void UpdateJobStatus(string p_wrNumber, string p_jobStatus, object taskId) { IGTApplication oApp = GTClassFactory.Create <IGTApplication>(); JobStatusUpdate oJobStatus = new JobStatusUpdate(oApp, UpdateJobStatusProcessCompleted); oJobStatus.UpdateJobStatus(p_wrNumber, p_jobStatus, taskId); }
/// <summary> /// The main entry point for the application. /// </summary> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { m_oGTCustomCommandHelper = CustomCommandHelper; try { if (ManualLandbaseReviewCtl == null) { m_application = (IGTApplication)GTClassFactory.Create <IGTApplication>(); ManualLandbaseReviewCtl = this; Application.EnableVisualStyles(); ManualLandbaseReviewFrm = new ManualLandbaseReviewFrm(m_oGTCustomCommandHelper, m_oGTTransactionManager); ManualLandbaseReviewFrm.Show(m_application.ApplicationWindow); } else { MessageBox.Show("Command already running"); } } catch (Exception ex) { ManualLandbaseReviewCtl = null; if (ManualLandbaseReviewFrm != null) { ManualLandbaseReviewFrm.CloseForm(); ManualLandbaseReviewFrm.Close(); } if (m_oGTCustomCommandHelper != null) { m_oGTCustomCommandHelper.Complete(); } } }
/// <summary> /// Returns the feature name by the FNO value /// </summary> /// <param name="FNO">G3E_FNO</param> /// <returns>G3E_FEATURE.G3E_USERNAME</returns> private string FeatureNameByFNO(short FNO) { try { string featureName = string.Empty; string sql = "select g3e_username from g3e_features_optlang where g3e_fno=?"; IGTApplication app = GTClassFactory.Create <IGTApplication>(); Recordset rs = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FNO); if (null != rs && 1 == rs.RecordCount) { if (System.DBNull.Value != rs.Fields["g3e_username"].Value) { featureName = rs.Fields["g3e_username"].Value.ToString(); } rs.Close(); rs = null; } return(featureName); } 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 is called when pad/vault mounted switch gear placement is started /// </summary> /// <param name="PTHelper"></param> /// <param name="KeyObject"></param> /// <param name="KeyObjectCollection"></param> public void StartPlacement(IGTPlacementTechniqueHelper PTHelper, IGTKeyObject KeyObject, IGTKeyObjects KeyObjectCollection) { try { m_PTHelper = PTHelper; m_KeyObject = KeyObject; m_KeyObjectCollection = KeyObjectCollection; m_PTHelper.ConstructionAidsEnabled = Intergraph.GTechnology.API.GTConstructionAidsEnabledConstants.gtptConstructionAidsNone; m_PTHelper.ConstructionAidDynamicsEnabled = false; m_PTHelper.StatusBarPromptsEnabled = false; m_PTHelper.StartPlacement(m_KeyObject, m_KeyObjectCollection); m_GTApplication = GTClassFactory.Create <IGTApplication>().Application; m_Arguments = m_ActiveGraphicComponent.Arguments; m_ActiveMapWindow = m_GTApplication.ActiveMapWindow; string ownerFeatureName = m_ActiveMapWindow.DetailID == 0 ? "Pad" : "Vault"; m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Click to select an existing " + ownerFeatureName + " feature to Own the Primary switch gear which is to be placed adjacent to it."); } catch (Exception ex) { MessageBox.Show(ex.Message, Caption); } }
/// <summary> /// Intialize variables and check selected feature is valid. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper) { IGTDDCKeyObjects ddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); gtApp = GTClassFactory.Create <IGTApplication>(); try { gtCustomCommandHelper = CustomCommandHelper; gtApp.SelectedObjectsChanged += GtApp_SelectedObjectsChanged; gtCustomCommandHelper.MouseMove += new EventHandler <GTMouseEventArgs>(gtCustomCommandHelper_MouseMove); if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND")) { if (gtApp.SelectedObjects.FeatureCount == 1) { g3eFno_trg = gtApp.SelectedObjects.GetObjects()[0].FNO; g3eFid_trg = gtApp.SelectedObjects.GetObjects()[0].FID; if (!ValidateSelectedFeature(g3eFno_trg)) { MessageBox.Show(ValidationMsg, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); CleanUp(); } } } else { MessageBox.Show("Command Access Denied. Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); CleanUp(); } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); CleanUp(); } }
private string GetCUCategoryCode(string p_cuCode, IGTApplication p_App) { string cuCategoryCode = string.Empty; ADODB.Recordset rs = null; try { string sql = "select CATEGORY_C from CULIB_UNIT where CU_ID = ?"; rs = p_App.DataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, p_cuCode); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); cuCategoryCode = Convert.ToString(rs.Fields[0].Value); } } } catch (Exception) { throw; } return(cuCategoryCode); }
public bool Execute(object InputValue) { Boolean selection = false; string currentJobStatus = null; string instanceJobStatus = null; try { if (m_gtFeature.FNO == 191) { m_gtApplication = GTClassFactory.Create <IGTApplication>(); if (CheckJobStatus(ref currentJobStatus, ref instanceJobStatus)) { m_gtOutputValue = GTClassFactory.Create <IGTFieldValue>(); QueryVoucherFERCAccount(); selection = true; } else { MessageBox.Show(String.Format("Selected Voucher cannot be queried as the specific voucher was created when the job was in '{0}' Status and the job is now in '{1}' Status", instanceJobStatus, currentJobStatus), "G/Technology"); selection = false; } } } catch (Exception ex) { MessageBox.Show("There is an error in \"Voucher FERC Account\" Foreign Key Query Interface \n" + ex.Message, "G/Technology"); } return(selection); }
//Dictionary<short, short> m_fnoGraphicCnoPair; //Dictionary<short, short> m_FnoAttributeCnoPair; /// <summary> /// Custom Boundary Query /// </summary> /// <param name="point"></param> /// <param name="boundaryFno"></param> public customBoundaryQuery(IGTPoint point, short boundaryFno) { this.m_iGtpoint = point; this.m_boundaryFno = boundaryFno; this.m_iGtApplication = GTClassFactory.Create <IGTApplication>(); this.m_iGtDataContext = m_iGtApplication.DataContext; }
public ccCompleteFeature() { if (m_iGtApp == null) { m_iGtApp = GTClassFactory.Create <IGTApplication>(); } }
private void GetRuleIDRuleMsg(string p_errDescription, out string p_RuleID, out string p_RuleName) { p_RuleID = string.Empty; p_RuleName = string.Empty; try { IGTApplication app = GTClassFactory.Create <IGTApplication>(); string sql = "select rule_nm, rule_id from wr_validation_rule where rule_msg=?"; Recordset rs = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, p_errDescription); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); p_RuleName = Convert.ToString(rs.Fields["rule_nm"].Value); p_RuleID = Convert.ToString(rs.Fields["rule_id"].Value); } } } 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> /// Intialize variables and check selected feature is valid. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper) { gtApp = GTClassFactory.Create <IGTApplication>(); List <KeyValuePair <int, string> > featureTypes = null; try { gtCustomCommandHelper = CustomCommandHelper; gtCustomCommandHelper.MouseMove += gtCustomCommandHelper_MouseMove; featureTypes = GetFeatureClass(); detectOverlappingAnalysis = new DetectOverlappingAnalysis(featureTypes); if (detectOverlappingAnalysis.ShowDialog() == DialogResult.OK) { // RunProcess(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap); DetectOverlapping(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap); } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { CleanUp(); } }
/// <summary> /// Returns the Structure ID of a feature based on its FID value /// </summary> /// <param name="FID">G3E_FID value</param> /// <returns>Structure ID</returns> private string StructureIDbyFID(int FID) { try { string retVal = string.Empty; IGTApplication app = GTClassFactory.Create <IGTApplication>(); string sql = "select structure_id from common_n where g3e_fid=?"; Recordset rs = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FID); if (null != rs && 1 == rs.RecordCount) { rs.MoveFirst(); if (DBNull.Value != rs.Fields[0].Value) { retVal = rs.Fields[0].Value.ToString(); } } if (null != rs) { if (rs.State != Convert.ToInt32(ObjectStateEnum.adStateClosed)) { rs.Close(); } rs = null; } return(retVal); } 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); } }
public CheckValidation(IGTDataContext gTDC, IGTDDCKeyObjects gTDDCKey, IGTApplication gTApp, IGTCustomCommandHelper gTCCHeler) { gTDataContext = gTDC; gTDDCKeyObjects = gTDDCKey; gTApplication = gTApp; gTCustomCommandHelper = gTCCHeler; }
/// <summary> /// Determines whether a feature has a workpoint associated to it (via common Structure ID) /// </summary> /// <param name="StructureID">Structure ID to use to find associated WorkPoint</param> /// <returns>true if feature has an associated workpoint; else, false</returns> private bool FeatureHasWorkPoint(string StructureID) { try { bool retVal = false; IGTApplication app = GTClassFactory.Create <IGTApplication>(); string sql = "select count(1) from workpoint_n where structure_id=?"; //Probably don't really need the FNO here but just in case... Recordset rs = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, StructureID); // If there's at least one Work Point, then return true if (null != rs && 0 < rs.RecordCount && 0 < Convert.ToInt32(rs.Fields[0].Value)) { retVal = true; rs.Close(); rs = null; } return(retVal); } 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); } }