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 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; }
public CheckValidation(IGTDataContext gTDC, IGTDDCKeyObjects gTDDCKey, IGTApplication gTApp, IGTCustomCommandHelper gTCCHeler) { gTDataContext = gTDC; gTDDCKeyObjects = gTDDCKey; gTApplication = gTApp; gTCustomCommandHelper = gTCCHeler; }
//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 static DataTable GetDataTable(IGTDataContext oDC, string sSQL, GTDiagnostics _diag) { DataTable dt = null; try { //IGTDataContext oDC = GTClassFactory.Create<IGTApplication>().DataContext; Recordset oRS = oDC.OpenRecordset(sSQL, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); OleDbDataAdapter oDA = new System.Data.OleDb.OleDbDataAdapter(); dt = new DataTable(); oDA.Fill(dt, oRS); oDA.Dispose(); oRS.Close(); } catch (Exception ex) { if (_diag.IsEnabled(GTDiagCat.EE)) { _diag.LogException("CommandUtilities.GetDataTable", ex); } throw ex; } return(dt); }
public void Terminate() { transactionManager.Commit(); transactionManager = null; dataContext = null; customCommandHelper = null; }
/// <summary> /// Get active Job Design Area and attached the document /// </summary> public void Activate() { try { m_commonMessages = new CommonMessages(); m_gtApplication = GTClassFactory.Create <IGTApplication>(); m_dataContext = m_gtApplication.DataContext; m_strActiveJob = m_gtApplication.DataContext.ActiveJob; m_strSQL = "SELECT G3E_JOBTYPE FROM G3E_JOB WHERE G3E_IDENTIFIER='" + m_strActiveJob + "'"; m_strDASQL = "SELECT G3E_FID FROM DESIGNAREA_P WHERE JOB_ID='" + m_strActiveJob + "'"; if (IsJobTypeNONWR(m_strSQL)) { //Get the active job design area ExecuteCommand(m_strDASQL); if (m_rsDesignArea.RecordCount <= 0) { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.NoDesignArea, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (m_rsDesignArea.RecordCount > 1) { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.MoreDesignAreas, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (m_rsDesignArea.RecordCount > 0) { m_rsDesignArea.MoveFirst(); m_attachJobDocument = new AttachJobDocument(m_gtApplication, Convert.ToInt32(m_rsDesignArea.Fields["G3E_FID"].Value), m_ManageTransactions); m_attachJobDocument.ShowDialog(m_gtApplication.ApplicationWindow); } } } else { MessageBox.Show(m_gtApplication.ApplicationWindow, m_commonMessages.WRMessage, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(m_gtApplication.ApplicationWindow, "Error " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (m_rsDesignArea != null) { if (m_rsDesignArea.State == 1) { m_rsDesignArea.Close(); m_rsDesignArea.ActiveConnection = null; } m_rsDesignArea = null; } if (m_attachJobDocument != null) { m_attachJobDocument.Close(); m_attachJobDocument.Dispose(); m_attachJobDocument = null; } } }
public ccRepeatReconductoring() { if (m_iGtApplication == null) { m_iGtApplication = GTClassFactory.Create <IGTApplication>(); } m_dataContext = m_iGtApplication.DataContext; }
public customBufferQuery(IGTPoint point, double distance, short fno) { this.m_referencePoint = point; this.m_distance = distance; this.m_targetFno = fno; this.m_iGtApplication = GTClassFactory.Create <IGTApplication>(); this.m_iGtDataContext = m_iGtApplication.DataContext; }
public SupplementalAgreementPlotModel(IGTDataContext gTDC, IGTDDCKeyObjects gTDDCKey, IGTApplication gTApp, IGTCustomCommandHelper gTCCHeler) { gTDataContext = gTDC; gTDDCKeyObjects = gTDDCKey; gTApplication = gTApp; gTCustomCommandHelper = gTCCHeler; }
public frmPreferredCUs(IGTDataContext dataContext) { m_DataContext = dataContext; InitializeComponent(); m_oCUsHelper = new ManagePreferredCUsHelper(); GetDataForForm(); UpdateButtonStatus(); }
public customBufferQuery(IGTPoint point, double distance, short fno) { this.m_referencePoint = point; this.m_distance = distance * 3.28084; // Input is in meters, convert meters to feet -- 1 m = 3.28084 ft this.m_targetFno = fno; this.m_iGtApplication = GTClassFactory.Create <IGTApplication>(); this.m_iGtDataContext = m_iGtApplication.DataContext; }
public ccCopyAncillaries() { if (m_iGtApplication == null) { m_iGtApplication = GTClassFactory.Create <IGTApplication>(); } m_dataContext = m_iGtApplication.DataContext; }
public ccAbandonFeature() { if (m_iGtApplication == null) { m_iGtApplication = GTClassFactory.Create <IGTApplication>(); } m_DataContext = m_iGtApplication.DataContext; }
/// <summary> /// customBoundaryQuery /// </summary> /// <param name="Point"></param> /// <param name="PointFno"></param> /// <param name="BoundaryFno"></param> /// <param name="BoundryFid"></param> public customBoundaryQuery(IGTPoint Point, short PointFno, short BoundaryFno, int BoundryFid) { this.m_iGtpoint = Point; this.m_pointFno = PointFno; this.m_boundaryFno = BoundaryFno; this.m_boundaryFid = BoundryFid; this.m_iGtApplication = GTClassFactory.Create <IGTApplication>(); this.m_iGtDataContext = m_iGtApplication.DataContext; }
private Boolean SaveXmlToSP(string p_WrNum, string p_SrcPathFile, ref OncDocManage.OncDocManage p_DocMan) { Boolean tmpRetVal = false; Recordset tmpRs = null; string tmpQry = string.Empty; IGTDataContext tmpDC = gtApp.DataContext; OncDocManage.OncDocManage tmpDocMg = p_DocMan; try { tmpQry = "select param_name, param_value from gis_onc.sys_generalparameter " + "where subsystem_name = 'Doc_Management' and subsystem_component = 'GT_SharePoint'"; tmpRs = tmpDC.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); if (!(tmpRs.BOF && tmpRs.EOF)) { tmpRs.MoveFirst(); for (int i = 0; i < tmpRs.RecordCount; ++i) { switch (tmpRs.Fields[0].Value.ToString()) { case "JOBWO_REL_PATH": tmpDocMg.SPRelPath = tmpRs.Fields[1].Value.ToString(); break; case "ROOT_PATH": tmpDocMg.SPRootPath = tmpRs.Fields[1].Value.ToString(); break; case "SP_URL": tmpDocMg.SPSiteURL = tmpRs.Fields[1].Value.ToString(); break; } tmpRs.MoveNext(); } tmpDocMg.SrcFilePath = p_SrcPathFile; tmpDocMg.WrkOrd_Job = p_WrNum; tmpDocMg.SPFileType = "Construction Redlines"; tmpDocMg.SPFileDescription = "Saved on " + DateTime.Now.ToString("MM/dd/yyyy a\\t HH:mm"); if (!tmpDocMg.AddSPFile(true)) { tmpRetVal = false; MessageBox.Show("Error:The Construction Redline file was not saved to SharePoint.", "SaveXmlToSP - Error", MessageBoxButtons.OK); } tmpRetVal = true; } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "SaveXmlToSP - Error", MessageBoxButtons.OK); } return(tmpRetVal); }
/// <summary> /// Method to create validation log entry in table VALIDATION_LOG /// </summary> /// <param name="p_LogType"></param> /// <param name="p_LogCode"></param> /// <param name="p_LogMsg"></param> /// <param name="p_LogContext"></param> /// <param name="p_ErrorPriority"></param> /// <returns></returns> public bool LogEntry(string p_LogType, string p_LogCode, string p_LogMsg, string p_LogContext, string p_ErrorPriority) { IGTApplication tmpApp = GTClassFactory.Create <IGTApplication>(); IGTDataContext tmpDatCont = tmpApp.DataContext; // Build the data insert script. string tmpInsertStr = @"begin insert into VALIDATION_LOG columns(VALIDATION_IFACE_TYPE,VALIDATION_NAME,JOB_ID,ACTIVE_FID, ACTIVE_COMP_NAME,ACTIVE_FIELD_NAME, ACTIVE_FIELD_VALUE,RELATED_FID, RELATED_COMP_NAME, RELATED_FIELD_NAME, RELATED_FIELD_VALUE,LOG_CODE,LOG_MSG,LOG_CONTEXT,ERROR_PRIORITY,LOG_TYPE) values"; bool tmpReturn = true; // get the values list. string tmpValues = BuildValuesList(p_LogType, p_LogCode, p_LogMsg, p_LogContext, p_ErrorPriority, tmpDatCont); if (string.IsNullOrEmpty(tmpValues)) { //The buildValuesList function generated an error and a empty string was returned. tmpReturn = false; } else { try { // The buildValuesList function succeeded. // Complete the insert script. tmpInsertStr = string.Format("{0} {1};commit;end;", tmpInsertStr, tmpValues); // Execute the insert script tmpDatCont.Execute(tmpInsertStr, out int tmpRecUpdated, (int)CommandTypeEnum.adCmdText); } catch (Exception ex) { tmpReturn = false; // If the error is due to privileges (resulting in a "table or view does not exist"), then only write // the exception message to the event log. Otherwise, write the error to the command log. if (ex.Message.Contains("ORA-00942")) { // Log an error to the Applcation Error Event Log. if (EventLog.SourceExists("Application Error")) { EventLog.WriteEntry("Application Error", "Error in G/Technology Custom Command Logger - gtCommandLogger.logEntry: " + ex.Message); } } else { // This may risk infinite recursion, but since the error is not due to table access, // then merely logging the error message should not produce an exception and when this call returns, // then this "catch" should fall through and exit. this.LogEntry(null, null, ex.Message, null, null); } } } return(tmpReturn); }
public ValidationConditions(IGTKeyObject p_keyObject, IGTDataContext p_dataContext, string p_category, string p_CUType, bool p_isAggregateFeature, string p_ComponentName) { m_listBlanketUnitization = new List <int>(); m_oKeyObject = p_keyObject; m_odataContext = p_dataContext; m_category = p_category; m_cuType = p_CUType; m_isAggregateFeature = p_isAggregateFeature; m_ComponentName = p_ComponentName; }
public StreetLightImportUtility(IGTDataContext p_oGTDataContext, bool p_Islocatable , IGTTransactionManager p_gTTransactionManager, IGTApplication p_gTApplication) { this.m_oGTDataContext = p_oGTDataContext; this.m_Islocatable = p_Islocatable; this.m_gTTransactionManager = p_gTTransactionManager; this.gTOwnerKeyObject = null; this.m_gTApplication = p_gTApplication; this.m_dataAccess = new DataAccess(p_oGTDataContext, p_gTApplication); }
public static List <AssetHistory> GetAssetHistoryByFID(IGTDataContext _odc, int _fid, GTDiagnostics _odiag) { List <AssetHistory> assetlist = null; try { string sSQL = string.Empty; sSQL = "SELECT G3E_IDENTIFIER, G3E_FNO, G3E_FID, G3E_ANO, G3E_CNO, G3E_CID, CHANGE_OPERATION, STRUCTURE_ID_1, OGG_X_1, OGG_Y_1, OGG_Z_1, CHANGE_DATE, VALUE_OLD, VALUE_NEW FROM ASSET_HISTORY WHERE STRUCTURE_ID_1 = " + _fid + " ORDER BY G3E_FID, CHANGE_DATE ASC"; ADODB.Recordset oRS = null; oRS = ExecuteQuery(_odc, sSQL, _odiag); if (oRS == null) { return(null); } if (oRS.RecordCount == 0) { return(null); } if ((oRS.EOF) && (oRS.BOF)) { return(null); } oRS.MoveFirst(); assetlist = ProcessAssetHistoryRS(oRS, _odiag); if (assetlist == null) { return(null); } if (assetlist.Count == 0) { return(null); } } catch (Exception ex) { LogException(_odiag, "GetAllAssetHistory", ex); throw ex; } return(assetlist); }
/// <summary> /// Object initialization for the WorkPointOperations class /// </summary> /// <param name="AllCUComponents"> This is collection of Primary and Ancillary CUs component that are chabnged for which Workpoints oprtaiton is needed</param> /// <param name="ActiveKeyObject"> Active Object</param> /// <param name="DataContext"> Data Context</param> public WorkPointOperations(IGTComponents AllCUComponents, IGTKeyObject ActiveKeyObject, IGTDataContext DataContext, Dictionary <IGTKeyObject, IGTComponents> p_FeaturesCollection = null) { m_gtcommonFunctions = new CommonFunctions(); m_NewWorkpointFidList = new Dictionary <int, int>(); m_gtAllCUComponents = AllCUComponents; m_activeKeyObject = ActiveKeyObject; m_dataContext = DataContext; if (ActiveKeyObject != null) { m_gtActiveFno = ActiveKeyObject.FNO; } m_gTKeyObjects = p_FeaturesCollection; // m_calledFromCC = p_CalledFromCC; }
private DataTable GetDataTable(IGTDataContext oDC, Recordset oRS) { try { // Recordset oRS = oDC.OpenRecordset(sSQL, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); OleDbDataAdapter oDA = new System.Data.OleDb.OleDbDataAdapter(); DataTable oDT = new DataTable(); oDA.Fill(oDT, oRS); oDA.Dispose(); oRS.Close(); return(oDT); } catch (Exception oEx) { throw oEx; } }
/// <summary> /// To build Rule name. /// </summary> /// <param name="oGTApplication">Current Igtapplictaion Object</param> /// <param name="messArguments">Substitution parameters</param> public void BuildRuleName(IGTApplication oGTApplication, object[] messArguments) { try { if (oGTApplication != null) { m_App = oGTApplication; m_DataContext = oGTApplication.DataContext; GetNMMessage(messArguments); } } catch (Exception ex) { Rule_MSG = string.Format("{0}{1}Message: {2}", ex.Message, System.Environment.NewLine, Rule_MSG); MessageBox.Show(Rule_NM, "Gtechnology", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// simple function that executes an SQL query /// </summary> /// <param name="DataContext">IGTDataContext</param> /// <param name="SQL_String">String</param> /// <returns></returns> public static Recordset ExecuteQuery(IGTDataContext DataContext, String SQL_String) { Recordset oRS = null; int rEffected = -1; try { oRS = DataContext.Execute(SQL_String, out rEffected, (int)CommandTypeEnum.adCmdText, null); } catch (Exception e) { MessageBox.Show(gApp.ApplicationWindow, "ExecuteQuery: " + e.Message, "Import Attachments - Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(oRS); }
public static Recordset ExecuteQuery(IGTDataContext _dc, String sSql, GTDiagnostics _diag) { Recordset _rs = null; try { int rEffected = -1; _rs = _dc.Execute(sSql, out rEffected, (int)CommandTypeEnum.adCmdText, null); } catch (Exception ex) { if (_diag.IsEnabled(GTDiagCat.EE)) { _diag.LogException("CommandUtilities.ExecuteQuery", ex); } } return(_rs); }
/// <summary> /// Ends the process. /// </summary> public void Terminate() { dataContext = null; gtTransactionManager = null; UnsubscribeEvents(); customCommandHelper = null; if (featurePlacementService != null) { featurePlacementService.Dispose(); featurePlacementService = null; } if (featureExplorerService != null) { featureExplorerService.Clear(); featureExplorerService.Dispose(); featureExplorerService = null; } m_gtApp.EndWaitCursor(); }
/// <summary> /// Activates the install service process. Creates the new service line and sets up the listeners. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { if (gtTransactionManager != null) { serviceLine = null; dataContext = m_gtApp.DataContext; customCommandHelper = CustomCommandHelper; featurePlacementService = GTClassFactory.Create <IGTFeaturePlacementService>(customCommandHelper); featureExplorerService = GTClassFactory.Create <IGTFeatureExplorerService>(); featureExplorerVisible = featureExplorerService.Visible; SubscribeEvents(); placeServiceLine(); } }catch (Exception e) { } }
public void Activate() { m_gtApplication = GTClassFactory.Create <IGTApplication>(); m_gtdataContext = m_gtApplication.DataContext; m_strActiveJob = m_gtApplication.DataContext.ActiveJob; m_strSQL = "SELECT G3E_JOBTYPE FROM G3E_JOB WHERE G3E_IDENTIFIER='" + m_strActiveJob + "'"; m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Display Construction Redlines Command Started."); try { if (IsJobTypeNONWR(m_strSQL)) { m_constructionRedlines = new ConstructionRedlines(GetWRRedlines()); if (m_constructionRedlines.ShowDialog(m_gtApplication.ApplicationWindow) == DialogResult.Cancel) { ExitCommand(); return; } } else { MessageBox.Show(m_gtApplication.ApplicationWindow, "This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show("Error during execution of Display Construction Redlines custom command" + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (m_rsDesignArea != null) { if (m_rsDesignArea.State == 1) { m_rsDesignArea.Close(); m_rsDesignArea.ActiveConnection = null; } m_rsDesignArea = null; } } m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Display Construction Redlines completed."); }
/// <summary> /// Sets the GTechnology DataContext for the class. /// </summary> private void GetDataContext() { IGTApplication tmpApp = GTClassFactory.Create <IGTApplication>(); try { dataContext = tmpApp.DataContext; } catch (Exception e) { if (Interactive) { MessageBox.Show("Error: " + e.Message, "Error: SendReceiveMessageLogger.GetDataContext", MessageBoxButtons.OK); } { if (EventLog.SourceExists("Application Error")) { EventLog.WriteEntry("Application Error", "Error in G/Technology Custom Logger - SendReceiveMessageLogger.GetDataContext: " + e.Message); } } } }
private Boolean IsWRJob(ref string p_WR_NBR) { Boolean tmpRetVal = false; Recordset tmpRs = null; string tmpQry = string.Empty; IGTDataContext tmpDC = gtApp.DataContext; try { tmpQry = "select g3e_jobtype, wr_nbr from g3e_job " + "where g3e_identifier = '" + tmpDC.ActiveJob + "'"; tmpRs = tmpDC.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); if (!(tmpRs.BOF && tmpRs.EOF)) { tmpRs.MoveFirst(); if (tmpRs.Fields[0].Value == "NON-WR") { tmpRetVal = false; gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving Construction Redline file ended."); MessageBox.Show("Error: The active Job is a 'NON-WR' job. \n Please use a job associated to a Work Order.", "IsWRJob - Error", MessageBoxButtons.OK); } else { p_WR_NBR = tmpRs.Fields[1].Value.ToString(); tmpRetVal = true; } } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "IsWRJob - Error", MessageBoxButtons.OK); tmpRetVal = false; } return(tmpRetVal); }