Example #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="commandNumber">G3E_CUSTOMCOMMAND.G3E_CCNO. Used for logging.</param>
        /// <param name="commandName">G3E_CUSTOMCOMMAND.G3E_USERNAME. Used for logging.</param>
        /// <returns>Boolean indicating status</returns>
        public TraceHelper(int commandNumber, string commandName)
        {
            m_CommandNumber = commandNumber;
            m_CommandName   = commandName;

            // G/Tech is running not running in interactive mode, then skip message boxes.
            GUIMode guiMode = new GUIMode();

            m_InteractiveMode = guiMode.InteractiveMode;
        }
Example #2
0
        /// <summary>
        /// Event handler for the Request to Update Job Status completed event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e">UpdateStatusCompleteEventArgs</param>
        private void swbl_UpdateJobStatusProcessCompleted(object sender, UpdateStatusCompleteEventArgs e)
        {
            try
            {
                // Shared component should return either SUCCESS or FAILURE in the event argument (Status).
                // If SUCCESS, update the Job Status silently.  Notify the user only if FAILURE or other errors.

                GUIMode guiMode = new GUIMode();

                switch (e.Status.ToUpper())
                {
                case "SUCCESS":
                    // Nothing to do here.
                    break;

                case "FAILURE":
                    if (guiMode.InteractiveMode)
                    {
                        if (null != e.Error && !string.IsNullOrEmpty(e.Error.Message))
                        {
                            MessageBox.Show(string.Format("Request to update Job Status failed: {0}.", e.Error.Message), "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show("Request to update Job Status failed.  No additional information is available.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    break;

                default:
                    if (guiMode.InteractiveMode)
                    {
                        // Assume e.Error.Message is not reliably set in this case so not displaying it.
                        string msg = string.Format("{0}{1}{2}{3}", "Request to update Job Status returned an unexpected status value: ", e.Status, Environment.NewLine, "Status of writeback is unknown.");
                        MessageBox.Show(msg, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    break;
                }
            }
            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);
            }
        }
Example #3
0
        public void Execute()
        {
            short commonCompCNO = 1;
            short CUCompCNO     = 21;

            try
            {
                // If G/Tech is not running in interactive mode, then skip message boxes.
                GUIMode guiMode = new GUIMode();
                m_InteractiveMode = guiMode.InteractiveMode;

                IGTComponent commonComponent = m_components.GetComponent(commonCompCNO);

                if ((commonComponent != null) && (commonComponent.Recordset.RecordCount > 0))
                {
                    commonComponent.Recordset.MoveFirst();

                    if (commonComponent.Recordset.Fields["LENGTH_GRAPHIC_Q"].Value.GetType() != typeof(DBNull))
                    {
                        double graphicLengthMtr = Convert.ToDouble(commonComponent.Recordset.Fields["LENGTH_GRAPHIC_Q"].Value);

                        SetLengthAttributes(graphicLengthMtr, commonComponent);
                    }

                    if (commonComponent.Recordset.Fields["LENGTH_ACTUAL_Q"].Value.GetType() != typeof(DBNull))
                    {
                        CUAttributesLengthUpdate(commonComponent, CUCompCNO);
                    }
                }
            }
            catch (Exception exception)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show("Error occured in CopyLengthAttributes Functional interface : " + exception.Message, "G/Technology");
                }
            }
        }
Example #4
0
        public void Activate()
        {
            // If a job is active when the workspace is opened, then the ActiveJobChanged event is not fired.
            // To ensure the code in that event is called under these circunstances, detect when a job is
            // active when this command is called and call the same event handler that's called when
            // the active job is changed.
            IGTApplication app = GTClassFactory.Create <IGTApplication>();

            if (!string.IsNullOrEmpty(app.DataContext.ActiveJob))
            {
                // Job is active when command is called.
                GTActiveJobChangedEventArgs eventArgs = new GTActiveJobChangedEventArgs(app.DataContext.ActiveJob, app.DataContext.ConfigurationName);
                App_ActiveJobChanged(app, eventArgs);
            }

            IGTApplication App = GTClassFactory.Create <IGTApplication>();

            App.ActiveJobChanged += App_ActiveJobChanged;               //App_ActiveJobChanged method is called when App.ActiveJobChanged is triggered

            // Cache the GUI Mode as it doesn't have to be evaluated each time for this command.
            GUIMode guiMode = new GUIMode();

            this.InteractiveMode = guiMode.InteractiveMode;
        }
Example #5
0
        public void Execute()
        {
            try
            {
                // If G/Tech is not running in interactive mode, then skip Message Box displays
                GUIMode guiMode = new GUIMode();
                m_InteractiveMode = guiMode.InteractiveMode;

                m_ActiveFNO = Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value);
                m_ActiveFID = Convert.ToInt32(Components[ComponentName].Recordset.Fields["G3E_FID"].Value);

                bool isIsolationScenario = false;
                IsolationScenarios isolationScenarioType = IsolationScenarios.NULL;

                if (m_IsoScenarioFNOs.Contains(m_ActiveFNO))
                {
                    // Check if active feature is an Isolation Scenario feature.
                    if (CheckIsoScenarioFeature(m_gComps, m_ActiveFNO, ref isIsolationScenario, ref isolationScenarioType))
                    {
                        if (isIsolationScenario)
                        {
                            IGTKeyObject isoScenarioFeatureKO = DataContext.OpenFeature(m_ActiveFNO, m_ActiveFID);
                            ProcessIsoScenarioFeature(isoScenarioFeatureKO, isolationScenarioType);
                        }
                    }
                }
                else
                // Check if active feature is connected to feature that has Isolation Scenario
                {
                    Int32 node1 = Convert.ToInt32(Components.GetComponent(11).Recordset.Fields["NODE_1_ID"].Value);
                    Int32 node2 = Convert.ToInt32(Components.GetComponent(11).Recordset.Fields["NODE_2_ID"].Value);

                    string sql = "select conn.g3e_fno, conn.g3e_fid from connectivity_n conn " +
                                 "where (((conn.node_1_id = ? or conn.node_1_id = ?) and conn.node_1_id <> 0) or ((conn.node_2_id = ? or conn.node_2_id = ?) and conn.node_2_id <> 0)) " +
                                 "and conn.g3e_fno in (4,5,12,14,15,34,36,59,60,98,99)";

                    Recordset connRs = DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText,
                                                                 node1, node2, node1, node2);

                    if (connRs.RecordCount > 0)
                    {
                        connRs.MoveFirst();

                        IGTKeyObject isoScenarioKO  = null;
                        short        isoScenarioFNO = Convert.ToInt16(connRs.Fields["G3E_FNO"].Value);
                        Int32        isoScenarioFID = Convert.ToInt32(connRs.Fields["G3E_FID"].Value);

                        while (!connRs.EOF)
                        {
                            isoScenarioFNO = Convert.ToInt16(connRs.Fields["G3E_FNO"].Value);
                            isoScenarioFID = Convert.ToInt32(connRs.Fields["G3E_FID"].Value);

                            isoScenarioKO = DataContext.OpenFeature(isoScenarioFNO, isoScenarioFID);
                            // Check if active feature is an Isolation Scenario feature.
                            if (CheckIsoScenarioFeature(isoScenarioKO.Components, isoScenarioFNO, ref isIsolationScenario, ref isolationScenarioType))
                            {
                                if (isIsolationScenario)
                                {
                                    ProcessIsoScenarioFeature(isoScenarioKO, isolationScenarioType);
                                }
                            }
                            connRs.MoveNext();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GUIMode guiMode = new GUIMode();
                if (guiMode.InteractiveMode)
                {
                    MessageBox.Show("Error in Isolation Scenario FI:Execute - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
        public void Execute()
        {
            string city             = string.Empty;
            string county           = string.Empty;
            string zipCode          = string.Empty;
            string insideCityLimits = string.Empty;


            try
            {
                Recordset premiseAttributesRs = Components[ComponentName].Recordset;
                if (premiseAttributesRs != null && premiseAttributesRs.RecordCount > 0)
                {
                    premiseAttributesRs.MoveFirst();
                }

                while (!premiseAttributesRs.EOF)
                {
                    city             = Convert.ToString(premiseAttributesRs.Fields["CITY_C"].Value);
                    county           = Convert.ToString(premiseAttributesRs.Fields["COUNTY_C"].Value);
                    zipCode          = Convert.ToString(premiseAttributesRs.Fields["ZIP_C"].Value);
                    insideCityLimits = Convert.ToString(premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value);

                    if (Convert.ToInt16(premiseAttributesRs.Fields["G3E_CID"].Value) == 1)
                    {
                        if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(county) && string.IsNullOrEmpty(zipCode) && string.IsNullOrEmpty(insideCityLimits))
                        {
                            CopyValuesFromBoundaries(premiseAttributesRs);
                        }
                        if (!string.IsNullOrEmpty(city) || !string.IsNullOrEmpty(county) || !string.IsNullOrEmpty(zipCode) || !string.IsNullOrEmpty(insideCityLimits))
                        {
                            m_City       = city;
                            m_CountyCode = county;
                            m_ZipCode    = zipCode;
                            m_CityLimits = insideCityLimits;
                        }
                        premiseAttributesRs.MoveNext();
                    }

                    else
                    {
                        if (!string.IsNullOrEmpty(city) || !string.IsNullOrEmpty(county) || !string.IsNullOrEmpty(zipCode) || !string.IsNullOrEmpty(insideCityLimits))
                        {
                            m_City       = city;
                            m_CountyCode = county;
                            m_ZipCode    = zipCode;
                            m_CityLimits = insideCityLimits;
                        }

                        if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(county) && string.IsNullOrEmpty(zipCode) && string.IsNullOrEmpty(insideCityLimits))
                        {
                            premiseAttributesRs.Fields["CITY_C"].Value   = m_City;
                            premiseAttributesRs.Fields["COUNTY_C"].Value = m_CountyCode;
                            premiseAttributesRs.Fields["ZIP_C"].Value    = m_ZipCode;
                            premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = m_CityLimits;
                        }
                        premiseAttributesRs.MoveNext();
                    }
                }
            }
            catch (Exception ex)
            {
                GUIMode guiMode = new GUIMode();
                if (guiMode.InteractiveMode)
                {
                    MessageBox.Show("Error during execution of Set Premise Location By Boundary FI. " + ex.Message, "G/Technology");
                }
                else
                {
                    int    tmpRecModified = 0;
                    string tmpQry         = string.Empty;
                    tmpQry = "begin insert into gis_stg.interface_log " +
                             "(SUB_INTERFACE_NAME,INTERFACE_NAME,COMPONENT_NAME,CORRELATION_ID,LOG_DETAIL) " +
                             "values ('ccGISAutomationBroker','ccGISAutomationBroker','fiSetPremiseLocationByBoundary',0," +
                             "'Error during execution of Set Premise Location By Boundary FI. " + ex.Message +
                             "'); end;";

                    m_DataContext.Execute(tmpQry, out tmpRecModified, (int)CommandTypeEnum.adCmdText);
                }
            }
        }
Example #7
0
        // Return TRUE if attribute can be edited
        public bool IsAttributeEditable(int ANO)
        {
            bool bEditControl = true;

            try
            {
                // If the Component Name isn't passed in to this interface then skip processing.
                // This occurs when a field with a picklist is selected.
                if (m_ComponentName is null)
                {
                    return(bEditControl);
                }

                object propertyValue;

                // If G/Tech is not running in interactive mode, skip message boxes.
                GUIMode guiMode = new GUIMode();
                m_InteractiveMode = guiMode.InteractiveMode;

                // Skip processing if M_PROP_SKIP_AECEDITIFNOTPOSTED properties exists.
                // This flag is needed to let this attribute edit control
                // know that the passed in attribute is being set by an interface
                // such as a functional interface and that the processing
                // in this attribute edit control interface should be skipped.
                if (CheckIfPropertyExists(M_PROP_SKIP_AECEDITIFNOTPOSTED, out propertyValue))
                {
                    return(bEditControl);
                }

                Recordset componentRS = m_GTComponents[m_ComponentName].Recordset;

                if (componentRS.RecordCount > 0)
                {
                    if (!Convert.IsDBNull(componentRS.Fields["g3e_id"].Value))
                    {
                        int g3eID = Convert.ToInt32(componentRS.Fields["g3e_id"].Value);

                        // Only check if m_FieldCheck is populated.
                        // If m_FieldCheck is not populated then allow the attribute to be editable.
                        if (componentRS.Fields[m_FieldCheck].Value.ToString().Length > 0)
                        {
                            // Call the CheckIfPopulatedAndPosted database function to determine if a master record exists with the m_FieldCheck populated.
                            string sql = string.Format("select GISPKG_CCB_ESILOCATION.CheckIfPopulatedAndPosted('{0}','{1}',{2}) STATUS from dual", m_TableCheck, m_FieldCheck, g3eID);

                            int affectedRows = 0;

                            Recordset premiseRS = m_DataContext.Execute(sql, out affectedRows, (int)ADODB.CommandTypeEnum.adCmdText);

                            if (premiseRS.RecordCount > 0)
                            {
                                premiseRS.MoveFirst();
                                if (!Convert.IsDBNull(premiseRS.Fields["STATUS"].Value))
                                {
                                    int status = Convert.ToInt32(premiseRS.Fields["STATUS"].Value);
                                    // If CheckIfPopulatedAndPosted returns a zero then allow the attribute to be editable.
                                    // Otherwise, make the attribute read-only.
                                    if (status > 0)
                                    {
                                        bEditControl = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show("Error in aecEditIfNotPosted:IsAttributeEditable - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                bEditControl = false;
            }

            return(bEditControl);
        }
Example #8
0
        public void Execute()
        {
            Recordset componentRS = m_GTComponents[m_ComponentName].Recordset;
            string    esiLocation = string.Empty;

            // Need to capture the position of the recordset in order to set
            // the correct fields. The position will change since we need to
            // loop through the recordset to check for a duplicate.
            m_RecordPosition = (int)componentRS.AbsolutePosition;

            // Only validate if new ESI Location value is not null
            if (!Convert.IsDBNull(componentRS.Fields[FIELD_PREMISE_ESI_LOCATION].Value))
            {
                esiLocation = componentRS.Fields[FIELD_PREMISE_ESI_LOCATION].Value.ToString();
            }
            else
            {
                return;
            }

            object propertyValue;

            // If G/Tech is not running in interactive mode, then skip message boxes.
            GUIMode guiMode = new GUIMode();

            m_InteractiveMode = guiMode.InteractiveMode;

            int g3eFID = Convert.ToInt32(componentRS.Fields["G3E_FID"].Value);

            // Validate that the entered ESI Location on the current Premise record
            // does not exist on another Premise record for the active Service Point.
            if (ValidateDuplicateOnExistingFID(esiLocation, componentRS))
            {
                // Validate that the ESI Location is not being used by a
                // Premise record on a different Service Point.
                if (ValidateDuplicate(esiLocation, g3eFID))
                {
                    // Validate that the ESI Location exists in CC&B.
                    if (ExistsInCCB(esiLocation))
                    {
                        // Populate the Premise record with the values from CC&B.
                        if (!PopulatePremiseRecord(esiLocation, ref componentRS))
                        {
                            // On error, null the ESI Location
                            ClearESILocation(ref componentRS);
                        }
                    }
                    else
                    {
                        // On error, null the ESI Location
                        ClearESILocation(ref componentRS);
                    }
                }
                else
                {
                    // On error, null the ESI Location
                    ClearESILocation(ref componentRS);
                }
            }
            else
            {
                // On error, null the ESI Location
                ClearESILocation(ref componentRS);
            }
        }