public void GetAssociatedVirtualPoints(int selectedFeatureFID, ref Dictionary <int, short> dicAssociatedVirtual) { 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, selectedFeatureFID); if (virtualRS != null && virtualRS.RecordCount > 0) { virtualRS.MoveFirst(); while (!virtualRS.EOF) { if (m_IsoScenarioselectedFeatureFNOs.Contains(Convert.ToInt16(virtualRS.Fields["G3E_FNO"].Value))) { dicAssociatedVirtual.Add(Convert.ToInt32(virtualRS.Fields["G3E_FID"].Value), Convert.ToInt16(virtualRS.Fields["G3E_FNO"].Value)); } virtualRS.MoveNext(); } } virtualRS.Close(); virtualRS = null; } catch { throw; } }
/// <summary> /// Get values from SYS_GENERALPARAMETER parameter table /// </summary> /// <returns></returns> private bool GetOffsetValuesFromGeneralParameters() { try { string sql = "select param_name, param_value from sys_generalparameter where subsystem_name = ? order by ID ASC"; Recordset offSetValuesRs = m_dataContext.OpenRecordset(sql, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, (int)CommandTypeEnum.adCmdText, "REPLACEOFFSET"); //Recordset offSetValuesRs = m_dataContext.MetadataRecordset("SYS_GENERALPARAMETER", "subsystem_name like 'JobMgmt_ReplaceOff%'", "ID ASC"); if (offSetValuesRs != null && offSetValuesRs.RecordCount > 0) { offSetValuesRs.MoveFirst(); while (!offSetValuesRs.EOF) { if (m_offSetX == 0) { m_offSetX = Convert.ToInt32(offSetValuesRs.Fields["param_value"].Value); } else { m_offSetY = Convert.ToInt32(offSetValuesRs.Fields["param_value"].Value); } offSetValuesRs.MoveNext(); } } return(m_offSetX != 0 && m_offSetY != 0); } catch (Exception) { throw; } }
/// <summary> /// Queries the GTech database Application Config table /// for the correct url for EdgeFrontier's sendEmail system. /// If the EFURL property is populated it will use the provided URL. /// </summary> /// <returns>Returns 'true' if successfull and 'false' if it fails.</returns> private bool queryForURL() { bool tmpReturn = true; string tmpUrl = string.Empty; Recordset tmpRs = null; string tmpQry = "select PARAM_VALUE from SYS_GENERALPARAMETER where SUBSYSTEM_NAME = 'SEND_EMAIL'" + " AND PARAM_NAME = 'EF_URL'"; try { // Query the ONCR_APP_PARAMETER table to get the url of the EdgeFrontier SendEmail system. if (EFUrl == string.Empty) { tmpRs = GTDataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); tmpRs.MoveFirst(); tmpUrl = tmpRs.Fields[0].Value.ToString(); EFUrl = tmpUrl; } } catch (Exception e) { if (GTInteractive == true) { MessageBox.Show("SendEmail:" + e.Message, "SendEmail.queryForURL Error", MessageBoxButtons.OK); tmpReturn = false; } else { logToDB("SendEmail.queryForURL Error:" + e.Message); } } return(tmpReturn); }
/// <summary> /// Get RateSchedule value. /// </summary> /// <param name="strRateSchedule"></param> /// <param name="strESILocation"></param> /// <returns></returns> private string GetRateSchedule(string strRateSchedule, string strESILocation) { string sql = null; Recordset rsValidate = null; try { sql = "select RATE_SCHEDULE from STLT_ACCOUNT where ESI_LOCATION in ?"; rsValidate = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, strESILocation); if (rsValidate.RecordCount > 0) { rsValidate.MoveFirst(); if (!rsValidate.EOF && !rsValidate.BOF) { strRateSchedule = Convert.ToString(rsValidate.Fields[0].Value); } } } catch { throw; } finally { rsValidate.Close(); rsValidate = null; } return(strRateSchedule); }
/// <summary> /// Gets the string value for FieldName from the active job. /// </summary> /// <param name="FieldName">Field in G3E_JOB</param> /// <returns>string field value</returns> private string strJobFieldValue(string FieldName) { if (string.IsNullOrEmpty(ActiveJob)) { throw new Exception(string.Format("Job must be active to retrieve the value for {0}.", FieldName)); } string sql = string.Format("select {0} from g3e_job where g3e_identifier=?", FieldName); Recordset rs = dc.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, dc.ActiveJob); if (null != rs && rs.RecordCount == 1) { string tmp = string.Empty; if (System.DBNull.Value != rs.Fields[0].Value) { tmp = rs.Fields[0].Value.ToString(); } rs.Close(); return(tmp); } else { if (null != rs) { rs.Close(); rs = null; } throw new Exception(string.Format("Unable to retrieve distinct value for {0} for the active job.", FieldName)); } }
/// <summary> /// Determine name of the Street Light supplemental plot attachment which is specified as a custom general parameter /// </summary> /// <returns></returns> private void GetPlotAttachmentName() { Recordset rs = null; try { rs = m_gTDataContext.OpenRecordset("select PARAM_VALUE from SYS_GENERALPARAMETER where PARAM_NAME=:1", CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, "StltSplmnt_AttachName"); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); m_strPlotAttachmentName = rs.Fields[0].Value.ToString(); } } catch { throw; } finally { rs.Close(); rs = null; } }
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 == 40 || feature.FNO == 80)) { exist = true; break; } } } else { foreach (IGTKeyObject relFeature in m_IsolationScenarioFeature.RelatedFeaturesNode1) { if (feature.FID != relFeature.FID && (feature.FNO == 40 || feature.FNO == 80)) { exist = true; break; } } } if (exist) { break; } virtualRS.MoveNext(); } } } catch { throw; } return(feature); }
/// <summary> /// Gets the command parameters from the SYS_GENERALPARAMETER table for this command. /// </summary> /// <returns></returns> internal static Boolean gGetSysGenPrams() { Recordset tmpRS = null; string tmpQry = string.Empty; Boolean tmpRetVal = false; try { tmpQry = "select param_name, param_value from gis_onc.SYS_GENERALPARAMETER " + "where SUBSYSTEM_NAME = 'AttachFeatureDocumentCC'"; tmpRS = gDatacont.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 "SPRelPath": gSPDocBaseRelPath = tmpRS.Fields[1].Value.ToString(); break; case "FILE_TYPES": gSPFileTypeLst = tmpRS.Fields[1].Value.ToString(); break; case "FILE_EXTENSIONS": gOpenFileFilterLst = tmpRS.Fields[1].Value.ToString(); break; case "FEATURE_FILE_LOC": gSPDocFeatureDocLoc = tmpRS.Fields[1].Value.ToString(); break; } tmpRS.MoveNext(); } } tmpRetVal = true; } catch (Exception ex) { MessageBox.Show("Error in gGetSPFileTypeList: " + ex.Message, "Attach Feature Hyperlink Document - csGlobals", MessageBoxButtons.OK, MessageBoxIcon.Error); tmpRetVal = false; } return(tmpRetVal); }
/// <summary> /// Method to build the recordset. /// </summary> /// <param name="p_strSql">SQL Query</param> /// <returns></returns> public Recordset GetRecordset(string p_strSql) { Recordset recordset = null; try { recordset = m_oGTDataContext.OpenRecordset(p_strSql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); } catch { throw; } return(recordset); }
public bool FormationExist(string FID, string FNO) { string tmpQry = ""; Recordset tmpRs = null; bool bFlag = false; try { tmpQry = "SELECT G3E_FID FROM CONTAIN_N WHERE G3E_OWNERFID=" + FID + " AND G3E_OWNERFNO=" + FNO; tmpRs = m_oDataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, ( int)CommandTypeEnum.adCmdText); if (tmpRs.RecordCount > 0) { bFlag = true; } } catch (Exception e) { MessageBox.Show("SQL: " + tmpQry + " " + e.Message, "FormationExist - Error", MessageBoxButtons.OK); } return(bFlag); }
/// <summary> /// Method to get the Component Number of the Unit Component whose standard/static attributes will be populated /// </summary> /// <param name="sCUCode"></param> /// <param name="iCUCID"></param> /// <param name="m_iCompUnitCNO"></param> /// <param name="m_oDataContext"></param> /// <returns></returns> private int GetUnitComponentCNO(string sCUCode, int iCUCID, int m_iCompUnitCNO, IGTDataContext m_oDataContext) { int sUnitComponentCNO = 0; ADODB.Recordset oRS = null; string sSQL = string.Empty; IGTKeyObject oKeyObject; ///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' //Query for the ANOs and their values from the m_sCUStaticAttributeTable table. //For each record returned in that query, set the ANO value. ///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' oKeyObject = m_oApp.DataContext.OpenFeature(Convert.ToInt16(m_oComponents[m_componentName].Recordset.Fields["G3e_FNO"].Value), Convert.ToInt32(m_oComponents[m_componentName].Recordset.Fields["G3e_FID"].Value)); sSQL = @" select distinct a.g3e_cno from CULIB_ATTRIBUTE s,G3E_ATTRIBUTEINFO_OPTABLE a, CULIB_UNITATTRIBUTE b where s.g3e_fno=? and b.cu_id=? and a.g3e_ano=s.g3e_ano and s.category_C = b.category_c and s.ATTRIBUTE_ID = b.ATTRIBUTE_ID order by a.g3e_cno"; oRS = m_oDataContext.OpenRecordset(sSQL, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, oKeyObject.FNO, sCUCode); if (oRS != null && oRS.RecordCount > 0) { sUnitComponentCNO = Convert.ToInt32(oRS.Fields["g3e_cno"].Value); } return(sUnitComponentCNO); }
/// <summary> /// Retieves the nextval from the GIS_STG.INTERFACE_LOG_SEQ sequence /// to be used as the entryId /// </summary> /// <returns>Returns 0 if the method fails or /// a number to be uses as the entryId</returns> private long GetNextIdVal() { long tmpReturn = 0; string tmpQry = string.Empty; Recordset tmpRs = null; try { tmpQry = "select GIS_STG.INTERFACE_LOG_SEQ.nextval " + (char)34 + "NEXTVAL" + (char)34 + " from dual"; tmpRs = dataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText); tmpRs.MoveFirst(); tmpReturn = Convert.ToInt64(tmpRs.Fields[0].Value); } catch (Exception e) { tmpReturn = 0; if (Interactive) { MessageBox.Show("Error: " + e.Message, "Error: SendReceiveMessageLogger.GetNextIdVal", MessageBoxButtons.OK); } else { if (EventLog.SourceExists("Application Error")) { EventLog.WriteEntry("Application Error", "Error in G/Technology Custom Logger - SendReceiveMessageLogger.GetNextIdVal: " + e.Message); } } } return(tmpReturn); }
public void Execute() { try { string sSql = "select sysdate from dual"; ADODB.Recordset rs = m_GTDataContext.OpenRecordset(sSql, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1); if (m_gComps[m_gCompName].Recordset != null) { if (!(m_gComps[m_gCompName].Recordset.EOF && m_gComps[m_gCompName].Recordset.BOF)) { if (rs != null) { if (!(rs.EOF && rs.BOF)) { rs.MoveFirst(); m_gComps[m_gCompName].Recordset.Fields[m_gFieldName].Value = rs.Fields[0].Value; } } } } } catch (Exception ex) { MessageBox.Show("There is an error in \"Set System Date On Create\" Funtional Interface \n" + ex.Message, "G/Technology"); } }
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); }
/// <summary> /// Gets and sets the attribute defaults for the passed in feature /// </summary> /// <param name="gtKeyObject">Feature key object to apply defaults.</param> /// <returns>Boolean indicating status</returns> public bool SetAttributeDefaults(IGTKeyObject gtKeyObject, out string message) { bool returnValue = false; try { message = ""; Recordset componentRS = null; string sql = "select tabattr.g3e_cno, tabattr.g3e_field, tabattr.g3e_default " + "from g3e_dialogattributes_optable tabattr, g3e_dialogs_optable dialog " + "where dialog.g3e_fno = ? and tabattr.g3e_dtno = dialog.g3e_dtno " + "and dialog.g3e_type = 'Placement' and tabattr.g3e_default is not null " + "order by tabattr.g3e_cno"; Recordset attrDefaultsRS = DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, gtKeyObject.FNO); if (attrDefaultsRS.RecordCount > 0) { short cno; string field; string defaultValue; attrDefaultsRS.MoveFirst(); while (!attrDefaultsRS.EOF) { cno = Convert.ToInt16(attrDefaultsRS.Fields["G3E_CNO"].Value); field = attrDefaultsRS.Fields["G3E_FIELD"].Value.ToString(); defaultValue = attrDefaultsRS.Fields["G3E_DEFAULT"].Value.ToString(); componentRS = gtKeyObject.Components.GetComponent(cno).Recordset; componentRS.Fields[field].Value = defaultValue; attrDefaultsRS.MoveNext(); } } returnValue = true; } catch (Exception ex) { message = ex.Message; returnValue = false; } return(returnValue); }
private bool ReplacewithSameCU(string strCucode, string strCategory) { ADODB.Recordset rs = null; string[] sArrCategories = null; string sSql = ""; try { if (!string.IsNullOrEmpty(strCategory)) { sArrCategories = strCategory.Split(','); } sSql = "select count(*) from CULIB_UNIT where CU_ID ='" + strCucode + "' and category_c in ("; for (int i = 0; i < sArrCategories.Length; i++) { if (i != sArrCategories.Length - 1) { sSql = sSql + "'" + sArrCategories[i] + "'" + ","; } else { sSql = sSql + "'" + sArrCategories[i] + "'" + ")"; } } rs = m_oDataContext.OpenRecordset(sSql, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, (int)0); rs.MoveFirst(); if (Convert.ToString(rs.Fields[0].Value).Equals("0")) { return(false); } } catch { throw; } finally { rs.Close(); rs = null; } return(true); }
/// <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); }
private string GetFeatureNameByFNO() { ADODB.Recordset oRS = null; System.String sSQL = string.Empty; sSQL = "select g3e_username from G3E_FEATURES_OPTABLE where g3e_fno=?"; oRS = m_oDataContext.OpenRecordset(sSQL, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, (System.Int32)ADODB.CommandTypeEnum.adCmdText, m_iFNO); return(oRS.Fields["g3e_username"].Value.ToString()); }
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); }
private bool IsTemplateExist() { Recordset rs = null; string strPlotTemplateName = ""; IGTNamedPlots gTNamedPlots = null; try { rs = m_gTDataContext.OpenRecordset("select PARAM_VALUE from SYS_GENERALPARAMETER where PARAM_NAME=:1", CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, strParamName); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); strPlotTemplateName = Convert.ToString(rs.Fields[0].Value); if (!string.IsNullOrEmpty(strPlotTemplateName)) { gTNamedPlots = gTApplication.NamedPlots; if (gTNamedPlots != null && gTNamedPlots.Count > 0) { foreach (IGTNamedPlot npt in gTNamedPlots) { if (npt.Name == strPlotTemplateName) { gTNamedPlot = npt; return(true); } } } } } } catch { throw; } finally { rs.Close(); rs = null; } return(false); }
/// <summary> /// Get Workpoint Number. /// </summary> /// <returns></returns> internal int GetWorkPointNumber() { int WPnumber = 0; string sql = ""; Recordset tempRs = null; try { sql = "select max(wp_nbr) from WORKPOINT_N where wr_nbr=:1"; tempRs = gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, gTDataContext.ActiveJob); if (tempRs.RecordCount > 0) { tempRs.MoveFirst(); if (!string.IsNullOrEmpty(Convert.ToString(tempRs.Fields[0].Value))) { WPnumber = Convert.ToInt32(tempRs.Fields[0].Value) + 1; } else { WPnumber = 1; } } else { WPnumber = 1; } } catch { throw; } finally { if (tempRs != null) { tempRs.Close(); tempRs = null; } } return(WPnumber); }
/// <summary> /// Verify MASTER AGREEMENT is there or not. /// </summary> /// <returns></returns> public bool IsMSLAExist() { string sql = ""; Recordset rsValidate = null; try { sql = "select DESCRIPTION,MSLA_DATE from STLT_DESC_VL where DESCRIPTION_ID=?"; rsValidate = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, m_descriptionId); if (rsValidate.RecordCount > 0) { rsValidate.MoveFirst(); if (!rsValidate.EOF && !rsValidate.BOF) { if (!string.IsNullOrEmpty(Convert.ToString(rsValidate.Fields["MSLA_DATE"].Value))) { m_AgreementDate = Convert.ToDateTime(rsValidate.Fields["MSLA_DATE"].Value); Customer = Convert.ToString(rsValidate.Fields["DESCRIPTION"].Value); } else { m_AgreementDate = null; Customer = Convert.ToString(rsValidate.Fields["DESCRIPTION"].Value); return(false); } } } } catch { throw; } finally { rsValidate.Close(); rsValidate = null; } return(true); }
private string GetParameter(string p_sParameterName, string p_sSubSystemName, string p_sSubsystemComponent, bool p_bErrorIfNotExist) { //Retrieves the parameter value from the recordset. //Throws exception if parameter not found. ADODB.Recordset oRS = null; Exception oEx = null; System.String sRetVal = string.Empty; try { oRS = m_oDataContext.OpenRecordset("select * from " + M_SIWGENERALPARAMATERTABLE + " where PARAM_NAME=? and SUBSYSTEM_COMPONENT = ? and SUBSYSTEM_NAME =?", ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, (System.Int32)ADODB.CommandTypeEnum.adCmdText, p_sParameterName, p_sSubSystemName, p_sSubsystemComponent); } catch (Exception ex) { if (!(oRS == null)) { if ((int)ADODB.ObjectStateEnum.adStateOpen == oRS.State) { oRS.Close(); } } throw (ex); } if (oRS.BOF && oRS.EOF) { oRS.Close(); if (p_bErrorIfNotExist) { oEx = new Exception("Entry not found in " + M_SIWGENERALPARAMATERTABLE + " where PARAM_NAME = \'" + System.Convert.ToString(p_sParameterName) + "\'"); throw (oEx); } } else { sRetVal = oRS.Fields["PARAM_VALUE"].Value.ToString(); oRS.Close(); } return(sRetVal); }
private void ExpandMacroWithinForm(string p_MUID) { ADODB.Recordset RS = m_oDataContext.OpenRecordset("select culib_macrounit.cu_id, mu_id, cu_qty, cu_desc from culib_macrounit, culib_unit where mu_id = ? and culib_macrounit.cu_id = culib_unit. cu_id", ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, p_MUID); // DataTable dt = ((DataTable)grdSelected.DataSource); if (RS != null) { if (RS.RecordCount > 0) { RS.MoveFirst(); while (RS.EOF == false) { dt1.Rows.Add(RS.Fields["cu_qty"].Value, "ACU", RS.Fields["cu_id"].Value, RS.Fields["mu_id"].Value, RS.Fields["cu_desc"].Value); RS.MoveNext(); } } dt1.AcceptChanges(); } }
private bool IsCorrectionJob() { bool bReturn = false; try { ADODB.Recordset rs = m_odataContext.OpenRecordset("select G3E_JOBTYPE from g3e_job where g3e_identifier = ?", ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, m_odataContext.ActiveJob); rs.MoveFirst(); if (Convert.ToString(rs.Fields["G3E_JOBTYPE"].Value).Equals("NON-WR")) { bReturn = true; } } catch (Exception ex) { throw ex; } return(bReturn); }
/// <summary> /// Method to get X and Y offset for the WP creation /// </summary> /// <param name="p_offsetX"></param> /// <param name="p_offsetY"></param> private void GetWorkPointOffset(ref int p_offsetX, ref int p_offsetY) { ADODB.Recordset rs = m_dataContext.OpenRecordset("Select PARAM_VALUE from SYS_GENERALPARAMETER where PARAM_NAME = 'WP_OFFSET_X' AND SUBSYSTEM_NAME = 'WorkPointCreation'", CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, new object[1]); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); p_offsetX = Convert.ToInt32(rs.Fields[0].Value); } } rs = m_dataContext.OpenRecordset("Select PARAM_VALUE from SYS_GENERALPARAMETER where PARAM_NAME = 'WP_OFFSET_Y' AND SUBSYSTEM_NAME = 'WorkPointCreation'", CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, (int)ADODB.CommandTypeEnum.adCmdText, new object[1]); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); p_offsetY = Convert.ToInt32(rs.Fields[0].Value); } } }
private string GetJobType() { string sReturn = string.Empty; ADODB.Recordset rs = m_dataContext.OpenRecordset("select G3E_JOBSTATUS from g3e_job where G3E_IDENTIFIER = ?", CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, (int)(ADODB.CommandTypeEnum.adCmdText), m_dataContext.ActiveJob); if (rs != null) { if (rs.RecordCount > 0) { rs.MoveFirst(); sReturn = Convert.ToString(rs.Fields["G3E_JOBSTATUS"].Value); } } return(sReturn); }
private void UpdatePoles() { transactionManager.Begin("Update Poles in LIP"); string poleQuery = "SELECT * FROM POLE_N INNER JOIN NJUNS_TICKET_N WHERE POLE_N.G3E_FID = NJUNS_TICKET_N.G3E_FID WHERE POLE_N.LTT_STATUS = ?"; Recordset LIPPoles = gtDataContext.OpenRecordset(poleQuery, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1, "LIP"); if (!LIPPoles.BOF && !LIPPoles.EOF) { LIPPoles.MoveFirst(); while (!LIPPoles.EOF) { DeleteFeature(Convert.ToInt16(LIPPoles.Fields["G3E_FNO"].Value), Convert.ToInt32(LIPPoles.Fields["G3E_FID"].Value)); LIPPoles.MoveNext(); } } transactionManager.Commit(); }
/// <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); }
public void loadServiceLineData() { IGTComponent lineAttributes = serviceLine.Components.GetComponent(5401); IGTComponent lineCommonAttributes = serviceLine.Components.GetComponent(1); IGTComponent lineCUAttributes = serviceLine.Components.GetComponent(21); IGTComponent lineElectricalAttributes = serviceLine.Components.GetComponent(11); string CUQuery = "SELECT PARAM_VALUE FROM SYS_GENERALPARAMETER WHERE SUBSYSTEM_NAME = ? AND PARAM_NAME = ? AND SUBSYSTEM_COMPONENT = ?"; Recordset defaultValues = dataContext.OpenRecordset(CUQuery, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, -1, "SERVICE_LINE_INSTALL", "CU", "CU_DEFAULT"); if (defaultValues.BOF && defaultValues.EOF) { customCommandHelper.Complete(); } else { if (lineAttributes.Recordset.RecordCount > 0) { lineAttributes.Recordset.MoveFirst(); lineAttributes.Recordset.Fields["PLACEMENT_TYPE_C"].Value = "ASSOCIATED"; } if (lineCommonAttributes.Recordset.RecordCount > 0) { lineCommonAttributes.Recordset.MoveFirst(); lineCommonAttributes.Recordset.Fields["FEATURE_STATE_C"].Value = "PPI"; } if (lineCUAttributes.Recordset.RecordCount > 0) { lineCUAttributes.Recordset.MoveFirst(); lineCUAttributes.Recordset.Fields["CU_C"].Value = defaultValues.Fields["PARAM_VALUE"].Value; lineCUAttributes.Recordset.Fields["WR_ID"].Value = dataContext.ActiveJob; lineCUAttributes.Recordset.Fields["ACTIVITY_C"].Value = "I"; lineCUAttributes.Recordset.Fields["VINTAGE_YR"].Value = DateTime.Today.Year; lineCUAttributes.Recordset.Fields["UNIT_CNO"].Value = 5401; lineCUAttributes.Recordset.Fields["UNIT_CID"].Value = 1; if (lineElectricalAttributes.Recordset.RecordCount > 0) { lineElectricalAttributes.Recordset.MoveFirst(); lineCUAttributes.Recordset.Fields["QTY_LENGTH_Q"].Value = lineElectricalAttributes.Recordset.Fields["LENGTH_GRAPHIC_Q"].Value; } } } }