Example #1
0
        public void Activate()
        {
            string           featureState    = string.Empty;
            List <int>       fidList         = new List <int>();
            IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();

            try
            {
                IGTDDCKeyObjects ddcKeyObjects = m_iGtApp.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }

                foreach (IGTDDCKeyObject selectedObject in selectedObjects)
                {
                    featureState = GetFeatureState(selectedObject);

                    if (string.IsNullOrEmpty(featureState) || !m_featureStatesList.Contains(featureState))
                    {
                        MessageBox.Show("One or more features are in an invalid feature state for this operation.", "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (!m_TransactionManager.TransactionInProgress)
                {
                    m_TransactionManager.Begin("updating feature state...");
                }
                int current    = 1;
                int totalCount = selectedObjects.Count;

                foreach (IGTDDCKeyObject selectedObject in selectedObjects)
                {
                    m_iGtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Transitioning " + current + " out of " + totalCount + " features.");
                    SetFeatureState(selectedObject);
                    current++;
                }

                m_TransactionManager.Commit();
                m_TransactionManager.RefreshDatabaseChanges();

                m_iGtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Selected features were transitioned successfully.");
            }
            catch (Exception ex)
            {
                m_TransactionManager.Rollback();
                MessageBox.Show("Error during execution of Complete Feature custom command." + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_TransactionManager = null;
            }
        }
Example #2
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            IGTDDCKeyObjects ddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
            List <int>       fidList       = new List <int>();

            try
            {
                m_oGTApp = GTClassFactory.Create <IGTApplication>();
                m_oGTCustomCommandHelper = CustomCommandHelper;

                m_ooddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>();

                ddcKeyObjects = m_oGTApp.Application.SelectedObjects.GetObjects();

                foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        m_ooddcKeyObjects.Add(ddcKeyObject);
                    }
                }

                m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Initializing RemoveFeature...");
                m_oGTApp.Application.BeginWaitCursor();

                SetJobAttributes();

                if (Validate())
                {
                    RemoveFeature();

                    if (!m_ostatusExit)
                    {
                        SynchronizeWP();
                    }

                    if (m_oCorrectionsModeIndex != -1)
                    {
                        m_oGTApp.Application.Properties.Remove("CorrectionsMode");
                        string mapCaption = m_oGTApp.Application.ActiveMapWindow.Caption.Replace("CORRECTIONS MODE - ", "");
                        m_oGTApp.Application.ActiveMapWindow.Caption = mapCaption;
                    }
                }

                if (!m_ostatusExit)
                {
                    ExitCommand();
                }
            }
            catch (Exception ex)
            {
                m_oGTTransactionManager.Rollback();
                MessageBox.Show("Error in Remove Feature command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ExitCommand();
            }
        }
Example #3
0
        /// <summary>
        /// Mouse click event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e)
        {
            IGTLocateService selectedFeaturesService;
            IGTDDCKeyObjects selectedFeatures;

            try
            {
                if (e.Button == 1)
                {
                    selectedFeaturesService = m_iGtApplication.ActiveMapWindow.LocateService;
                    selectedFeatures        = selectedFeaturesService.Locate(e.WorldPoint, -1, 0, GTSelectionTypeConstants.gtmwstSelectAll);
                    IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                    List <int>       fidList         = new List <int>();
                    foreach (IGTDDCKeyObject ddcKeyObject in selectedFeatures)
                    {
                        if (!fidList.Contains(ddcKeyObject.FID))
                        {
                            fidList.Add(ddcKeyObject.FID);
                            selectedObjects.Add(ddcKeyObject);
                        }
                    }
                    if (selectedObjects == null || selectedObjects.Count == 0)
                    {
                        return;
                    }
                    if ((selectedObjects[0].FNO == m_originalObject.FNO) && (selectedObjects[0].FID != m_originalObject.FID))  // Restrict selection to features of the same class as the original feature and make sure same feature instance is not selected
                    {
                        m_invalidFeatureMessage = false;
                        if (!m_selectedObjects.Any(o => o.FID == selectedObjects[0].FID))
                        {
                            m_selectedObjects.Add(selectedObjects[0]);
                            m_iGtApplication.ActiveMapWindow.HighlightedObjects.AddSingle(selectedObjects[0]);
                        }
                    }
                    else
                    {
                        m_invalidFeatureMessage = true;
                        m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Invalid feature selected.Selected features are not of same class as source feature or selected feature itself is source feature.");
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                ExitCommand();
                MessageBox.Show("Error during execution of Copy Ancillaries custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
Example #4
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                #region Perform validations
                m_oGTCustomCommandHelper = CustomCommandHelper;
                m_oGTTransactionManager.Begin(" begin Repeat reconductoring...");
                if (CheckIfNonWrJob())
                {
                    ExitCommand();
                    MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                List <int>       fidList         = new List <int>();
                m_ooddcKeyObjects = m_iGtApplication.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in m_ooddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }
                m_originalObject = selectedObjects[0];

                if (!CheckIfConductorFeature())
                {
                    ExitCommand();
                    MessageBox.Show("This command only applies to conductors.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!ValidateFeatureState())
                {
                    ExitCommand();
                    MessageBox.Show("Select a PPX conductor span from which to copy reconductoring information.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                #endregion
                SubscribeEvents();
                CheckFeatureAndGetCno();
                ReadCUsWithActivity();
            }
            catch (Exception ex)
            {
                ExitCommand();
                MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        public void Activate()
        {
            string featureState = string.Empty;
            string jobStatus    = string.Empty;

            try
            {
                IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                List <int>       fidList         = new List <int>();
                IGTDDCKeyObjects ddcKeyObjects   = m_iGtApplication.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }
                foreach (IGTDDCKeyObject selectedObject in selectedObjects)
                {
                    if (!ValidateFeatureState(selectedObject))
                    {
                        if (!m_AssetHistoryCheckpassed)
                        {
                            MessageBox.Show("This command cannot be used on unposted features.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                            return;
                        }

                        MessageBox.Show("One or more features are in an invalid feature state for this operation.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (!CheckIfCuAttributesExists(selectedObject))
                    {
                        MessageBox.Show("This command applies only to features with CUs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    if (!CheckIfInstallAndActiveWrAreDifferent(selectedObject))
                    {
                        MessageBox.Show("The same feature may not be installed and abandoned in the same WR.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                if (CheckIfNonWrJob(out jobStatus))
                {
                    MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }



                // Validations have been completed. Update feature state.
                if (!m_TransactionManager.TransactionInProgress)
                {
                    m_TransactionManager.Begin("updating feature state...");
                }

                int current    = 1;
                int totalCount = selectedObjects.Count;
                foreach (IGTDDCKeyObject selectedObject in selectedObjects)
                {
                    m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Transtioning " + current + " out of " + totalCount + " features.");
                    SetFeatureStateBasedOnJobStatus(selectedObject, jobStatus);
                    SetActivity(selectedObject);
                    current++;
                }
                m_TransactionManager.Commit();

                // Sync work point in a new transaction

                m_TransactionManager.Begin("WP Synchronization...");

                foreach (IGTDDCKeyObject selectedObject in selectedObjects)
                {
                    ProcessWPSync(selectedObject);
                }
                m_TransactionManager.Commit();
                m_TransactionManager.RefreshDatabaseChanges();

                m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Selected features were transitioned successfully.");
            }
            catch (Exception ex)
            {
                m_TransactionManager.Rollback();
                MessageBox.Show("Error during execution of Abandon Feature custom command." + Environment.NewLine + "Transition failed for selected features." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_TransactionManager = null;
            }
        }
Example #6
0
        void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e)
        {
            IGTLocateService selectedFeaturesService;
            IGTDDCKeyObjects selectedFeatures;

            try
            {
                m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                m_iGtApplication.BeginWaitCursor();
                m_invalidFeatureMessage = false;
                if (e.Button == 1)
                {
                    selectedFeaturesService = m_iGtApplication.ActiveMapWindow.LocateService;
                    selectedFeatures        = selectedFeaturesService.Locate(e.WorldPoint, -1, 0, GTSelectionTypeConstants.gtmwstSelectAll);
                    IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                    List <int>       fidList         = new List <int>();
                    foreach (IGTDDCKeyObject ddcKeyObject in selectedFeatures)
                    {
                        if (!fidList.Contains(ddcKeyObject.FID))
                        {
                            fidList.Add(ddcKeyObject.FID);
                            selectedObjects.Add(ddcKeyObject);
                        }
                    }
                    if (selectedObjects == null || selectedObjects.Count == 0)
                    {
                        return;
                    }
                    m_selectedObject = selectedObjects[0];

                    if (m_selectedObject.FNO != m_originalObject.FNO || m_selectedObject.FID == m_originalObject.FID)  // Restrict selection to features of the same class as the original feature
                    {
                        m_invalidFeatureMessage = true;
                        m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Invalid feature selected.Selected feature(s) are not of same class as source feature or selected feature itself is source feature.");
                        return;
                    }

                    m_iGtApplication.ActiveMapWindow.HighlightedObjects.AddSingle(m_selectedObject);

                    if (m_oGTTransactionManager != null && !m_oGTTransactionManager.TransactionInProgress)
                    {
                        m_oGTTransactionManager.Begin(" begin Repeat reconductoring...");
                    }
                    if (ProcessChangeOutsToTargetFeature())
                    {
                        m_oGTTransactionManager.Commit();
                        m_oGTTransactionManager.RefreshDatabaseChanges();

                        // Synchronize Work points - ALM-1838-JIRA-2514
                        SynchronizeWP(m_dataContext.OpenFeature(m_originalObject.FNO, m_originalObject.FID));
                        SynchronizeWP(m_dataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID));

                        m_iGtApplication.EndWaitCursor();
                        m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Identify next span to changeout wires; double-click to exit.");
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                ExitCommand();
                MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_iGtApplication.EndWaitCursor();
            }
        }
Example #7
0
        public void Activate()
        {
            string jobStatus         = string.Empty;
            bool   dummyCuCodeExists = false;

            oHelper = new Helper();
            oHelper.m_dataContext = m_dataContext;
            oIsolationScenario    = new IsolationScenario(m_dataContext);

            try
            {
                #region Perform validations
                if (CheckIfNonWrJob())
                {
                    MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                List <int>       fidList         = new List <int>();
                IGTDDCKeyObjects ddcKeyObjects   = m_iGtApplication.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }
                m_selectedObject = selectedObjects[0];
                oHelper.m_fid    = m_selectedObject.FID;
                oHelper.m_fno    = m_selectedObject.FNO;
                if (!CheckIfFeatureIsReplaceable())
                {
                    MessageBox.Show("Replace Feature is not configured to operate on the selected feature class.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!CheckIfValidCuAttributesExists(out dummyCuCodeExists))
                {
                    MessageBox.Show("This command applies only to features with CUs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (dummyCuCodeExists)
                {
                    MessageBox.Show("This command cannot operate on dummy CUs (i.e.- CU codes beginning with ZZ).", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!ValidateFeatureState())
                {
                    MessageBox.Show("One or more features are in an invalid feature state for this operation.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!GetOffsetValuesFromGeneralParameters())
                {
                    MessageBox.Show("General parameters JobMgmt_ReplaceOffsetX or JobMgmt_ReplaceOffsetY  is not configured correctly.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!CheckIfPointFeature())
                {
                    MessageBox.Show("Command is restricted to only work for point features.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!CheckIfInstallAndActiveWrAreDifferent())
                {
                    MessageBox.Show("The same feature may not be installed and replaced in the same WR.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                #endregion

                frmSelectReplacementStatus oReplacementStatusForm = new frmSelectReplacementStatus();
                if (oReplacementStatusForm.ShowDialog(m_iGtApplication.ApplicationWindow) == DialogResult.Cancel)
                {
                    return;
                }
                else
                {
                    this.m_replaceAction = oReplacementStatusForm.ReplacementStatus;
                    m_iGtApplication.BeginWaitCursor();
                    m_oIsolationScenario = oIsolationScenario.CheckIsoScenarioFeature(m_selectedObject.FNO, m_selectedObject.FID);
                    ProcessReplacement();
                    m_TransactionManager.RefreshDatabaseChanges();
                }
            }
            catch (Exception ex)
            {
                m_iGtApplication.EndWaitCursor();
                m_TransactionManager.Rollback();

                MessageBox.Show("Error during execution of Replace Feature custom command." + Environment.NewLine + "Replace failed for selected feature." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_TransactionManager = null;
                m_iGtApplication.EndWaitCursor();
            }
        }
Example #8
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                #region Perform validations
                m_oGTCustomCommandHelper = CustomCommandHelper;
                if (CheckIfNonWrJob())
                {
                    MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                List <int>       fidList         = new List <int>();
                m_ooddcKeyObjects = m_iGtApplication.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in m_ooddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }
                m_originalObject = selectedObjects[0];

                if (!CheckIfACUAttributesExists())
                {
                    MessageBox.Show("This command applies only to features with Ancillary CUs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    ExitCommand();
                    return;
                }
                #endregion

                m_oGTTransactionManager.Begin("begin Copy Ancillaries...");
                SubscribeEvents();
                DataTable acuDataTable = GetData();
                if (acuDataTable.Rows.Count != 0)
                {
                    m_ofrmCopyAncillaryCUs = new frmCopyAncillaryCUs(m_originalObject, acuDataTable);
                    if (m_ofrmCopyAncillaryCUs.ShowDialog(m_iGtApplication.ApplicationWindow) == DialogResult.Cancel)
                    {
                        ExitCommand();
                        return;
                    }
                }
                else
                {
                    if (MessageBox.Show("Selected feature has no Ancillary CUs. Continue and only delete Ancillary CUs from targeted features?",
                                        "G/Technology", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
                    {
                        ExitCommand();
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                ExitCommand();
                MessageBox.Show("Error during execution of Copy Ancillaries custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }