Ejemplo n.º 1
0
        // Call the GISPKG_CCB_ESILOCATION.ValidateESILocation stored procedure to validate
        // if the ESI Location is being used by a Premise record on a different Service Point.
        private bool ValidateDuplicate(string esiLocation, int g3eFID)
        {
            bool returnValue = true;

            try
            {
                ADODB.Command cmd = new ADODB.Command();

                cmd.CommandText = "{call GISPKG_CCB_ESILOCATION.ValidateESILocation(?,?,?,?,?)}";
                cmd.CommandType = CommandTypeEnum.adCmdText;

                ADODB.Parameter param = cmd.CreateParameter("ESILocation", DataTypeEnum.adVarChar, ParameterDirectionEnum.adParamInput, 10, esiLocation);
                cmd.Parameters.Append(param);
                param = cmd.CreateParameter("G3EFID", DataTypeEnum.adBigInt, ParameterDirectionEnum.adParamInput, 10, g3eFID);
                cmd.Parameters.Append(param);
                param = cmd.CreateParameter("ExistingFID", DataTypeEnum.adBigInt, ParameterDirectionEnum.adParamOutput, 10);
                cmd.Parameters.Append(param);
                param = cmd.CreateParameter("JobID", DataTypeEnum.adVarChar, ParameterDirectionEnum.adParamOutput, 30);
                cmd.Parameters.Append(param);
                param = cmd.CreateParameter("Status", DataTypeEnum.adSingle, ParameterDirectionEnum.adParamOutput, 1);
                cmd.Parameters.Append(param);

                int recordsAffected = 0;

                Recordset spRS = m_DataContext.ExecuteCommand(cmd, out recordsAffected);

                if (!Convert.ToBoolean(cmd.Parameters["Status"].Value))
                {
                    string job = string.Empty;

                    if (cmd.Parameters["JobID"].Value.ToString().Length > 0)
                    {
                        job = " in Job " + cmd.Parameters["JobID"].Value;
                    }
                    if (m_InteractiveMode)
                    {
                        MessageBox.Show(ERROR_DUPLICATE_ESILOCATION + cmd.Parameters["ExistingFID"].Value + job, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    returnValue = false;
                }
            }
            catch (Exception ex)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show("Error in fiESILocationUpdate:ValidateDuplicate - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                returnValue = false;
            }

            return(returnValue);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Method to execute sql query and return the result record set
 /// </summary>
 /// <param name="sqlString"></param>
 /// <returns></returns>
 private void ExecuteCommand(string sqlString)
 {
     try
     {
         int           outRecords = 0;
         ADODB.Command command    = new ADODB.Command();
         command.CommandText = sqlString;
         m_rsDesignArea      = m_gtdataContext.ExecuteCommand(command, out outRecords);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Method to execute sql query and return the result record set
 /// </summary>
 /// <param name="sqlString"></param>
 /// <returns></returns>
 private Recordset GetRecordSet(string sqlString)
 {
     try
     {
         int     outRecords = 0;
         Command command    = new ADODB.Command();
         command.CommandText = sqlString;
         Recordset results = m_DataContext.ExecuteCommand(command, out outRecords);
         return(results);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 private int ExecuteCommand(string sql)
 {
     ADODB.Recordset results = null;
     try
     {
         int           outRecords = 0;
         ADODB.Command command    = new ADODB.Command();
         command.CommandText = sql;
         results             = m_gTDataContext.ExecuteCommand(command, out outRecords);
         return(outRecords);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Returns recordset for the input query
 /// </summary>
 /// <param name="sqlString">sql query</param>
 /// <returns>result recordset</returns>
 private Recordset GetRecordSet(string sqlString)
 {
     try
     {
         int     outRecords = 0;
         Command command    = new Command
         {
             CommandText = sqlString
         };
         Recordset resultRs = DataContext.ExecuteCommand(command, out outRecords);
         return(resultRs);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Call DB Stored Procedure to generate Polygon Geometries for Detail Foorprint component
        /// </summary>
        /// <param name="g3eFid"></param>
        /// <param name="detailID"></param>
        /// <param name="xCoord"></param>
        /// <param name="yCoord"></param>
        /// <param name="mhType"></param>
        private void PlaceManholeFootprint(int g3eFid, int detailID, double xCoord, double yCoord, string mhType)
        {
            ADODB.Command cmd        = null;
            int           outRecords = 0;
            string        sqlString  = string.Format("Begin FootPrintDetailPlacement.AddManholeDetailFootprint({0},{1},'{2}',{3},{4}); End;", g3eFid, detailID, mhType, xCoord, yCoord);

            try
            {
                cmd             = new ADODB.Command();
                cmd.CommandText = sqlString;
                ADODB.Recordset results = _dataContext.ExecuteCommand(cmd, out outRecords);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        public void Execute()
        {
            short     fNo = 0;
            Recordset connectivityComponentRs = null;
            string    feederId       = string.Empty;
            string    subStationCode = string.Empty;

            try
            {
                IGTComponent component = Components.GetComponent(11);
                connectivityComponentRs = component.Recordset;
                if (connectivityComponentRs.RecordCount > 0)
                {
                    connectivityComponentRs.MoveFirst();
                    fNo = Convert.ToInt16(connectivityComponentRs.Fields["G3E_FNO"].Value);
                }
                if (fNo == 16)                  // If affected feature is substation breaker then do nothing
                {
                    return;
                }
                feederId = Convert.ToString(connectivityComponentRs.Fields["FEEDER_1_ID"].Value);
                ADODB.Command command    = null;
                int           outRecords = 0;
                string        sqlString  = string.Format("select distinct ssta_c SSCODE from CONNECTIVITY_N where g3e_fno = 16 and feeder_1_id = '{0}' ", feederId);

                command             = new ADODB.Command();
                command.CommandText = sqlString;
                ADODB.Recordset results = DataContext.ExecuteCommand(command, out outRecords);
                if (results.RecordCount > 0)
                {
                    results.MoveFirst();
                    subStationCode = Convert.ToString(results.Fields["SSCODE"].Value);
                }

                connectivityComponentRs.Fields["SSTA_C"].Value = subStationCode;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error during Set Substation Code execution. " + ex.Message, "G/Technology");
            }
        }