Пример #1
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            // Get the active job. This will be used later to reset the job if it is changed by the plug-in module.
            m_StartingJob = m_Application.DataContext.ActiveJob;

            // Parse the comma-delimited argument string passed in by the monitor.
            if (!GetCommandArguments())
            {
                CustomCommandHelper.Complete();
            }

            // Reset queue table REQUEST_STATUS = 'NEW' if any records for the instance ID are set to = 'PROCESSING'.
            if (!ResetRequestStatus())
            {
                CustomCommandHelper.Complete();
            }

            // Set an application property named “UnattendedMode” as an indicator to other custom code that processing should not display messages and wait for user input.
            // Note that the value of this property is not important; the presence of the named property indicates unattended mode, and its absence indicates interactive mode.
            try
            {
                m_Application.Properties.Add("UnattendedMode", true);
            }
            catch
            {
                // ignore error if property is already set
            }

            // Process any pending requests
            if (!Process())
            {
                CustomCommandHelper.Complete();
            }
        }
Пример #2
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                customCommandHelper = CustomCommandHelper;
                if (transactionManager != null)
                {
                    transactionManager.Begin("Blanket Unitization");
                    selectedFeatures = gtApp.SelectedObjects.GetObjects();
                    bool   oneFeatureType = true;
                    short  fnoChecker;
                    string errorMessage = "";
                    if (selectedFeatures.Count > 1)
                    {
                        fnoChecker = selectedFeatures[0].FNO;
                        foreach (IGTDDCKeyObject feature in selectedFeatures)
                        {
                            if (fnoChecker != feature.FNO)
                            {
                                oneFeatureType = false;
                                errorMessage   = "Multiple feature types selected, please retry command after selecting features of the same type.";
                            }
                        }
                    }

                    if (oneFeatureType)
                    {
                        switch (selectedFeatures[0].FNO)
                        {
                        case g_Service_Line_FNO:
                        case g_Secondary_Box_FNO:
                            featureHandler();
                            break;

                        case g_Gaurd_Light_FNO:
                            guardLightHandler();
                            break;

                        default:
                            MessageBox.Show("Invalid feature selected, please select a service line, secondary box, or guard light.");
                            break;
                        }
                        customCommandHelper.Complete();
                    }
                    else
                    {
                        MessageBox.Show(errorMessage, "GTechnology");
                        customCommandHelper.Complete();
                    }
                }
            }catch (Exception e)
            {
                MessageBox.Show("Error in ccFieldActivity.Activate " + e.Message + ".");
                transactionManager.Rollback();
                customCommandHelper.Complete();
            }
        }
Пример #3
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            m_oGTCustomCommandHelper = CustomCommandHelper;
            try
            {
                if (ManualLandbaseReviewCtl == null)
                {
                    m_application           = (IGTApplication)GTClassFactory.Create <IGTApplication>();
                    ManualLandbaseReviewCtl = this;
                    Application.EnableVisualStyles();
                    ManualLandbaseReviewFrm = new ManualLandbaseReviewFrm(m_oGTCustomCommandHelper, m_oGTTransactionManager);
                    ManualLandbaseReviewFrm.Show(m_application.ApplicationWindow);
                }
                else
                {
                    MessageBox.Show("Command already running");
                }
            }
            catch (Exception ex)
            {
                ManualLandbaseReviewCtl = null;


                if (ManualLandbaseReviewFrm != null)
                {
                    ManualLandbaseReviewFrm.CloseForm();
                    ManualLandbaseReviewFrm.Close();
                }
                if (m_oGTCustomCommandHelper != null)
                {
                    m_oGTCustomCommandHelper.Complete();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();

                // Check if selected feature is a Transformer.
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                if (!(oGTDCKeys[0].FNO == ConstantsDT.FNO_OH_XFMR || oGTDCKeys[0].FNO == ConstantsDT.FNO_UG_XFMR))
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }

                frmStreetLightVoltageDrop.m_CustomCommandHelper = CustomCommandHelper;
                frmStreetLightVoltageDrop.m_TransactionManager  = m_TransactionManager;
                frmStreetLightVoltageDrop.StartPosition         = FormStartPosition.CenterScreen;
                frmStreetLightVoltageDrop.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Пример #5
0
        /// <summary>
        /// Method to Exit the command.
        /// </summary>
        private void ExitCommand()
        {
            try
            {
                try
                {
                    if (m_oGTApp.Application.Properties.Count > 0)
                    {
                        m_oGTApp.Application.Properties.Remove("StreetLightImportToolMSFID");
                    }
                }
                catch
                {
                }

                if (m_oGTCustomCommandHelper != null)
                {
                    m_oGTCustomCommandHelper.Complete();
                    m_oGTCustomCommandHelper = null;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                m_oGTCustomCommandHelper = null;
                m_oGTTransactionManager  = null;
            }
        }
 public void CompleteCC()
 {
     if (m_gTCustomCommandHelper != null)
     {
         m_gTCustomCommandHelper.Complete();
         m_gTCustomCommandHelper = null;
     }
 }
Пример #7
0
 /// <summary>
 /// Form closing event. Call the Complete method to end the command.
 /// </summary>
 private void cmdClose_Click(object sender, EventArgs e)
 {
     m_EmbeddedDT.Cleanup();
     m_EmbeddedDT.FormClosing    -= cmdClose_Click;
     m_EmbeddedDT.cmdClose.Click -= cmdClose_Click;
     m_EmbeddedDT.Close();
     m_CustomCommandHelper.Complete();
 }
Пример #8
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                if (m_Application.SelectedObjects.FeatureCount > 1)
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_MULTIPLE_FEATURES_SELECTED, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }
                else if (m_Application.SelectedObjects.FeatureCount == 1)
                {
                    // Only one feature in select set. Check if selected feature is a Duct Bank.
                    IGTDDCKeyObjects oGTDCKeys    = m_Application.SelectedObjects.GetObjects();
                    IGTDDCKeyObject  objKeyObject = GTClassFactory.Create <IGTDDCKeyObject>();
                    if (oGTDCKeys[0].FNO != ConstantsDT.FNO_UG_SECCOND && oGTDCKeys[0].FNO != ConstantsDT.FNO_UG_COND)
                    {
                        MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_INVALID_FEATURE_SELECTED, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        m_CustomCommandHelper.Complete();
                        return;
                    }
                }

                frmCablePullTension.m_CustomCommandHelper = CustomCommandHelper;
                frmCablePullTension.StartPosition         = FormStartPosition.CenterScreen;
                frmCablePullTension.Show(m_Application.ApplicationWindow);

                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, "IGTCustomCommandModeless_Activate:" + Environment.NewLine + "Error (" + ex.Source + ") - " + ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Пример #9
0
 /// <summary>
 /// Dispose all method before command exit
 /// </summary>
 private void CleanUp()
 {
     gtApp.SelectedObjectsChanged    -= GtApp_SelectedObjectsChanged;
     gtCustomCommandHelper.MouseMove -= gtCustomCommandHelper_MouseMove;
     if (gtCustomCommandHelper != null)
     {
         gtCustomCommandHelper.Complete();
     }
     gtCustomCommandHelper = null;
 }
Пример #10
0
        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;
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// ExisCmd is used to exit the Custom command from the Gtech
        /// </summary>
        private void ExitCmd()
        {
            try
            {
                GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Relocate Feature Command : Exiting...");

                if (m_gtApplication.Application.Properties.Count > 0)
                {
                    m_gtApplication.Application.Properties.Remove("RelocateFeatureCC");
                }


                if (m_GTCustomCommandHelper != null)
                {
                    m_GTCustomCommandHelper.Complete();
                    m_GTCustomCommandHelper = null;
                }

                m_gtApplication.Application.EndWaitCursor();
                m_gtApplication.Application.RefreshWindows();
            }
            catch (Exception ex)
            {
                if (m_gtApplication.Application.Properties.Count > 0)
                {
                    m_gtApplication.Application.Properties.Remove("RelocateFeatureCC");
                }
                if (m_GTCustomCommandHelper != null)
                {
                    m_GTCustomCommandHelper.Complete();
                    m_GTCustomCommandHelper = null;
                }

                m_GTCustomCommandHelper = null;
                m_gtApplication.Application.EndWaitCursor();
                m_gtApplication.Application.RefreshWindows();

                MessageBox.Show(ex.Message, "Relocate Feature", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
            }
        }
Пример #12
0
        internal void ExitCommand(IGTCustomCommandHelper m_GTCustomCommandHelper)
        {
            try
            {
                if (m_GTCustomCommandHelper != null)
                {
                    m_GTCustomCommandHelper.Complete();
                    m_GTCustomCommandHelper = null;
                }

                m_iGtApplication.Application.RefreshWindows();
            }
            catch
            {
                if (m_GTCustomCommandHelper != null)
                {
                    m_GTCustomCommandHelper.Complete();
                    m_GTCustomCommandHelper = null;
                }

                m_GTCustomCommandHelper = null;
                m_iGtApplication.Application.RefreshWindows();
            }
        }
Пример #13
0
        internal static void gLoadCompanyPlRs()
        {
            string tmpQry = "select vl_key, vl_value from VL_ATTACH_COMPANY where trc_code is not null";

            try
            {
                gCompanyPlRs = ExecuteQuery(gDataCont, tmpQry);
            }
            catch (Exception ex)
            {
                MessageBox.Show(gApp.ApplicationWindow, "gLoadCompanyPlRs: Error loading Attaching Company picklist. \n" + ex.Message,
                                "Import Attachments - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                gCcHelper.Complete();
            }
        }
Пример #14
0
 private void ExitCommand()
 {
     try
     {
         m_ooddcKeyObjects.Clear();
         m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
         UnsubscribeEvents();
         if (m_oGTCustomCommandHelper != null)
         {
             m_oGTCustomCommandHelper.Complete();
             m_oGTCustomCommandHelper = null;
         }
         m_iGtApplication.EndWaitCursor();
         m_iGtApplication.RefreshWindows();
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #15
0
        private void ExitCommand()
        {
            try
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }

                m_ooddcKeyObjects.Clear();

                m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");

                UnsubscribeEvents();

                if (m_oGTCustomCommandHelper != null)
                {
                    m_oGTCustomCommandHelper.Complete();
                    m_oGTCustomCommandHelper = null;
                }

                m_oGTApp.Application.EndWaitCursor();
                m_oGTApp.Application.RefreshWindows();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                m_oGTApp = null;
                m_oGTCustomCommandHelper = null;
                m_ooddcKeyObjects        = null;
                m_oGTTransactionManager  = null;
                m_ofeature         = null;
                m_oOwnedFeatures   = null;
                m_ocommonComponent = null;
                m_oCUComponent     = null;
            }
        }
Пример #16
0
 /// <summary>
 /// Method to Exit the command.
 /// </summary>
 private void ExitCommand()
 {
     try
     {
         m_oGTApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
         if (m_oEventsSubscribed)
         {
             UnsubscribeEvents();
         }
         if (m_oGTCustomCommandHelper != null)
         {
             m_oGTCustomCommandHelper.Complete();
             m_oGTCustomCommandHelper = null;
         }
     }
     catch
     {
         throw;
     }
     finally
     {
         if (m_oGTCustomCommandHelper != null)
         {
             m_oGTCustomCommandHelper = null;
         }
         if (m_oGTTransactionManager != null)
         {
             m_oGTTransactionManager = null;
         }
         if (m_oGTExplorerService != null)
         {
             m_oGTExplorerService.Dispose();
             m_oGTExplorerService = null;
         }
         if (m_oGTPlacementService != null)
         {
             m_oGTPlacementService.Dispose();
             m_oGTPlacementService = null;
         }
     }
 }
Пример #17
0
        public void guardLightHandler()
        {
            int          FID                 = selectedFeatures[0].FID;
            short        FNO                 = selectedFeatures[0].FNO;
            IGTKeyObject guardLight          = dataContext.OpenFeature(FNO, FID);
            IGTComponent guardLightComponent = guardLight.Components.GetComponent(g_Gaurd_Light_CNO);

            if (guardLightComponent.Recordset.Fields["LAMP_USE_C"].Value.ToString() == "G")
            {
                replaceOrRemoveDialog dialog = new replaceOrRemoveDialog(FNO);
                dialog.ShowDialog();
                IGTComponent cuAttributes = guardLight.Components.GetComponent(21);
                cuAttributes.Recordset.Fields["ACTIVITY_C"].Value = dialog.activityCode;
                dialog.Close();
            }
            else
            {
                MessageBox.Show("Invalid feature selected, please select a service line, secondary box, or guard light.");
                customCommandHelper.Complete();
            }
        }
 /// <summary>
 /// Dispose all method before command exit
 /// </summary>
 private void CleanUp()
 {
     gtCustomCommandHelper.MouseMove -= gtCustomCommandHelper_MouseMove;
     if (detectOverlappingAnalysis != null)
     {
         detectOverlappingAnalysis.Dispose();
     }
     detectOverlappingAnalysis = null;
     if (gtTransactionManager != null)
     {
         if (gtTransactionManager.TransactionInProgress)
         {
             gtTransactionManager.Rollback();
         }
     }
     gtTransactionManager = null;
     if (gtCustomCommandHelper != null)
     {
         gtCustomCommandHelper.Complete();
     }
     gtCustomCommandHelper = null;
 }
Пример #19
0
 static internal void ExitCommand()
 {
     try
     {
         m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
         m_oGTApp.Application.EndWaitCursor();
         if (m_oGTCustomCommandHelper != null)
         {
             m_oGTCustomCommandHelper.Complete();
             m_oGTCustomCommandHelper = null;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error in Review Vouchers command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         m_oGTCustomCommandHelper = null;
         m_oGTTransactionManager  = null;
     }
 }
Пример #20
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_Application.BeginWaitCursor();
                // Get feature number and feature identifier for feature in select set
                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                short fno = oGTDCKeys[0].FNO;
                int   fid = oGTDCKeys[0].FID;

                // Call execute method on UpdateTrace object to run trace and process results
                UpdateTrace updateTrace = new UpdateTrace(CUSTOM_COMMAND_NUMBER, CUSTOM_COMMAND_NAME);

                m_TransactionManager.Begin("Update Trace");

                if (updateTrace.Execute(fno, fid))
                {
                    m_TransactionManager.Commit();
                }
                else
                {
                    m_TransactionManager.Rollback();
                }

                updateTrace = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, "ccUpdateTrace.Activate: Error calling UpdateTrace - " + ex.Message,
                                "G /Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            m_Application.EndWaitCursor();

            CustomCommandHelper.Complete();
        }
Пример #21
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                IGTDDCKeyObjects gtDDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();
                gtDDCKeys = m_Application.SelectedObjects.GetObjects();
                List <int> FIDs = new List <int>();

                if (gtDDCKeys.Count > 0)
                {
                    foreach (IGTDDCKeyObject gtDDCKey in gtDDCKeys)
                    {
                        // Check if selected feature is a Pole.
                        if (gtDDCKey.FNO == ConstantsDT.FNO_POLE)
                        {
                            if (!FIDs.Contains(gtDDCKey.FID))
                            {
                                m_EmbeddedDT.SelectedFID = gtDDCKey.FID;
                                FIDs.Add(gtDDCKey.FID);
                            }
                        }
                        else
                        {
                            MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_GUY_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            CustomCommandHelper.Complete();
                            return;
                        }
                    }
                }

                FIDs.Clear();
                FIDs = null;

                m_EmbeddedDT.Application = m_Application;
                m_EmbeddedDT.Text        = ConstantsDT.COMMAND_NAME_GUYING;
                m_EmbeddedDT.CommandName = ConstantsDT.COMMAND_NAME_GUYING;
                m_EmbeddedDT.SelectedFNO = ConstantsDT.FNO_POLE;

                // Get the Guying Scenario
                string guyingScenarioNumber = string.Empty;
                bool   newGuyingScenario    = false;
                string hyperlinkFilePath    = string.Empty;
                if (!GetGuyingScenario(ref guyingScenarioNumber, ref newGuyingScenario, ref hyperlinkFilePath))
                {
                    CustomCommandHelper.Complete();
                    return;
                }

                if (newGuyingScenario)
                {
                    // Pass notification to Save command to increment G3E_JOB.GUY_SCENARIO_COUNT on successful save.
                    m_EmbeddedDT.NewGuyScenario   = true;
                    m_EmbeddedDT.GuyScenarioCount = Convert.ToInt16(guyingScenarioNumber);
                }
                else
                {
                    // Create Hyperlink component
                    m_EmbeddedDT.WrNumber         = m_Application.DataContext.ActiveJob;
                    m_EmbeddedDT.GuyScenarioCount = Convert.ToInt16(guyingScenarioNumber);

                    m_TransactionManager.Begin("New Hyperlink");
                    if (m_EmbeddedDT.AddHyperlinkComponent(hyperlinkFilePath))
                    {
                        m_TransactionManager.Commit();
                    }
                    else
                    {
                        m_TransactionManager.Rollback();
                    }

                    CustomCommandHelper.Complete();
                    return;
                }

                // Get the report data
                if (!GetReportData(guyingScenarioNumber))
                {
                    CustomCommandHelper.Complete();
                    return;
                }

                // Get the form Close events so we can call the Complete method for the command
                // when the form closes.
                m_EmbeddedDT.cmdClose.Click += cmdClose_Click;
                m_EmbeddedDT.FormClosing    += cmdClose_Click;

                m_EmbeddedDT.InitializeFormSize();

                m_EmbeddedDT.StartPosition = FormStartPosition.CenterScreen;
                m_EmbeddedDT.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Пример #22
0
        /// <summary>
        /// Command Click event
        /// </summary>
        /// <param name="sender">object sender</param>
        /// <param name="e">GTMouseEventArgs</param>
        /// <returns></returns>
        void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e)
        {
            try
            {
                m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpCrossHair;
                if (m_blPointSelected)
                {
                    //Get snap point
                    if (m_osrcGeometry != null)
                    {
                        m_snapPoint = GetSnapPoint(m_osrcGeometry, e.WorldPoint);
                    }
                    else
                    {
                        m_snapPoint = e.WorldPoint;
                    }
                    if (m_oGTApplication.SelectedObjects.FeatureCount > 0)
                    {
                        m_oGTTransactionManager.Begin("Copy Landbase Boundries");
                        m_oEditService.TargetMapWindow = m_oGTApplication.ActiveMapWindow;
                        m_oEditService.RemoveAllGeometries();
                        //Create Copy of feature
                        bool bCopyFeature = CopyFeature(m_sourceFNO, m_targetFNO);
                        if (bCopyFeature)
                        {
                            //Lets start moving the feature from snap point
                            m_oEditService.BeginMove(m_snapPoint);
                            m_blFirstPointSelected  = true;
                            m_blSecondPointSelected = false;
                            m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, m_sStatusBarMsg1);
                        }
                    }
                }
                if ((m_blFirstPointSelected) && (m_blSecondPointSelected))
                {
                    m_blFirstPointSelected = false;

                    //Get the Located object
                    m_locatedObjects = m_oGTApplication.ActiveMapWindow.LocateService.Locate(e.WorldPoint, 3, 1, GTSelectionTypeConstants.gtmwstSelectSingle);

                    //snap the destination to nearest vertex.
                    if (m_locatedObjects.Count > 0)
                    {
                        m_snapPoint = GetSnapPoint(m_locatedObjects[0].Geometry, e.WorldPoint);
                    }
                    else
                    {
                        m_snapPoint = e.WorldPoint;
                    }

                    //End move to snap point
                    m_oEditService.EndMove(m_snapPoint);

                    //Assign the copied geometry to target feature
                    foreach (int i in m_EditObjects.Keys)
                    {
                        m_otrgFeature.Components.GetComponent(Convert.ToInt16(m_EditObjects[i].ToString())).Geometry = m_oEditService.GetGeometry(i);
                    }
                    m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpNWArrow;
                    m_oEditService.RemoveAllGeometries();

                    m_oGTTransactionManager.Commit();
                    m_oGTTransactionManager.RefreshDatabaseChanges();

                    m_oGTCustomCommandHelper.Complete();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, m_sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpNWArrow;
                ExitCommand();
            }
            finally
            {
                if (m_blSecondPointSelected)
                {
                    ExitCommand();
                }
            }
        }
Пример #23
0
 private void frmSourceResults_FormClosing(object sender, FormClosingEventArgs e)
 {
     m_CustomCommandHelper.Complete();
 }
Пример #24
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                // Get the metadata for the command
                if (!m_frmSecondaryCalculator.GetMetadata())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                // Check if selected feature is a Transformer.
                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                if (oGTDCKeys[0].FNO != ConstantsDT.FNO_OH_XFMR && oGTDCKeys[0].FNO != ConstantsDT.FNO_UG_XFMR)
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }

                // If the selected Transformer is a 3 Phase then check for valid voltage.
                short xfmrFNO     = oGTDCKeys[0].FNO;
                int   xfmrFID     = oGTDCKeys[0].FID;
                short xfmrUnitCNO = 0;

                if (xfmrFNO == ConstantsDT.FNO_OH_XFMR)
                {
                    xfmrUnitCNO = ConstantsDT.CNO_OH_XFMR_UNIT;
                }
                else
                {
                    xfmrUnitCNO = ConstantsDT.CNO_UG_XFMR_UNIT;
                }

                IGTKeyObject  oGTKey        = m_Application.DataContext.OpenFeature(xfmrFNO, xfmrFID);
                IGTComponents oGTComponents = oGTKey.Components;
                Recordset     componentRS   = oGTComponents.GetComponent(xfmrUnitCNO).Recordset;
                Recordset     xfmrConfigChecker;
                if (xfmrFNO == ConstantsDT.FNO_OH_XFMR)
                {
                    xfmrConfigChecker = oGTComponents.GetComponent(ConstantsDT.CNO_OH_XFMR_BANK).Recordset;
                }
                else
                {
                    xfmrConfigChecker = oGTComponents.GetComponent(ConstantsDT.CNO_UG_XFMR_UNIT).Recordset;
                }
                short  phaseCount       = 0;
                string secondaryVoltage = string.Empty;

                if (componentRS.RecordCount > 0)
                {
                    secondaryVoltage = componentRS.Fields[ConstantsDT.FIELD_XFMRUNIT_VOLTAGE_SEC].Value.ToString();
                    if (!Convert.IsDBNull(componentRS.Fields[ConstantsDT.FIELD_XFMRUNIT_PHASE_QUANTITY].Value))
                    {
                        phaseCount = Convert.ToInt16(componentRS.Fields[ConstantsDT.FIELD_XFMRUNIT_PHASE_QUANTITY].Value);
                    }
                    if ((!Convert.IsDBNull(xfmrConfigChecker.Fields["CONFIG_PRI_C"].Value) && xfmrConfigChecker.Fields["CONFIG_PRI_C"].Value.ToString().Contains("OPEN")))
                    {
                        MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_CONFIGURATION, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        m_CustomCommandHelper.Complete();
                        return;
                    }
                }

                if (phaseCount == 3 && !m_frmSecondaryCalculator.m_ValidThreePhaseVoltages.Contains(secondaryVoltage))
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_3PH_VOLTAGE, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }

                // Check if Transformer is a Tie Transformer
                string sql = "select g3e_fid from " + ConstantsDT.TABLE_XFMR_OH_BANK + " where ((" + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " = ?) or " +
                             "(g3e_fid = ? and " + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " is not null)) and " + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " <> g3e_fid " +
                             "union " +
                             "select g3e_fid from " + ConstantsDT.TABLE_XFMR_UG_UNIT + " where ((" + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " = ?) or " +
                             "(g3e_fid = ? and " + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " is not null)) and " + ConstantsDT.FIELD_XFMR_TIE_XFMR_ID + " <> g3e_fid";

                int recordsAffected = 0;

                ADODB.Recordset rs = m_Application.DataContext.Execute(sql, out recordsAffected, (int)CommandTypeEnum.adCmdText, xfmrFID, xfmrFID, xfmrFID, xfmrFID);

                if (rs.RecordCount > 0)
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_TIE_XFMR_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }

                m_frmSecondaryCalculator.m_CustomCommandHelper = CustomCommandHelper;
                m_frmSecondaryCalculator.StartPosition         = FormStartPosition.CenterScreen;
                m_frmSecondaryCalculator.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Пример #25
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                short fno = 0;
                int   fid = 0;

                m_EmbeddedDT.cmdSaveReport.Enabled = false;

                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                if (oGTDCKeys.Count > 0)
                {
                    // Check if selected feature is a Conductor.
                    if (oGTDCKeys[0].FNO == ConstantsDT.FNO_OH_COND || oGTDCKeys[0].FNO == ConstantsDT.FNO_UG_COND ||
                        oGTDCKeys[0].FNO == ConstantsDT.FNO_OH_SECCOND || oGTDCKeys[0].FNO == ConstantsDT.FNO_UG_SECCOND)
                    {
                        fid = oGTDCKeys[0].FID;
                        fno = oGTDCKeys[0].FNO;
                        m_EmbeddedDT.cmdSaveReport.Enabled = true;
                    }
                    else
                    {
                        MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SAG_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        m_CustomCommandHelper.Complete();
                        return;
                    }
                }

                // Get the report data
                if (!GetReportData(fno, fid))
                {
                    CustomCommandHelper.Complete();
                    return;
                }

                // Get the form Close events so we can call the Complete method for the command
                // when the form closes.
                m_EmbeddedDT.cmdClose.Click += cmdClose_Click;
                m_EmbeddedDT.FormClosing    += cmdClose_Click;

                m_EmbeddedDT.Application = m_Application;
                m_EmbeddedDT.Text        = ConstantsDT.COMMAND_NAME_SAG_CLEARANCE;
                m_EmbeddedDT.CommandName = ConstantsDT.COMMAND_NAME_SAG_CLEARANCE;
                m_EmbeddedDT.SelectedFID = fid;
                m_EmbeddedDT.SelectedFNO = fno;

                m_EmbeddedDT.InitializeFormSize();

                m_EmbeddedDT.StartPosition = FormStartPosition.CenterScreen;
                m_EmbeddedDT.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Пример #26
0
        /// <summary>
        /// Command Click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e)
        {
            try
            {
                m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpNWArrow;
                if (m_blPointSelected)
                {
                    //Snap to the Selected Geomentry
                    m_firstPoint = GetSnapPoint(m_gSrcGeometry, e.WorldPoint);

                    m_blFirstPointSelected  = true;
                    m_blSecondPointSelected = false;
                    m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, sStatusBarMsg1);
                }
                if ((m_blFirstPointSelected) && (m_blSecondPointSelected))
                {
                    try
                    {
                        m_oEditService.EndMove(e.WorldPoint);
                        m_blFirstPointSelected = false;
                        m_oGTTransactionManager.Begin("Divide Landbase Boundries");

                        // Get the Located object and snap the destination to nearest vertex.
                        IGTDDCKeyObjects m_oLocatedObjects = m_oGTApplication.ActiveMapWindow.LocateService.Locate(e.WorldPoint, 3, 1, GTSelectionTypeConstants.gtmwstSelectSingle);
                        m_secondtPoint = GetSnapPoint(m_oLocatedObjects[0].Geometry, e.WorldPoint);

                        //Perform the break Polygon
                        IGTGeometry[] m_gTargetPolygons = m_gSrcGeometry.BreakPolygon(m_gLineGeom);

                        //Intialise two polygons
                        IGTKeyObject m_oFirstPolygon  = m_oGTApplication.DataContext.OpenFeature(m_sourceFNO, m_sourceFID);
                        IGTKeyObject m_oSecondPolygon = m_oGTApplication.DataContext.NewFeature(m_sourceFNO);

                        //Set the geometry with the newly created ones.
                        m_oFirstPolygon.Components.GetComponent(m_primaryGeoCNO).Geometry  = CreatePolygon(m_gTargetPolygons[0]);
                        m_oSecondPolygon.Components.GetComponent(m_primaryGeoCNO).Geometry = CreatePolygon(m_gTargetPolygons[1]);

                        //Fetch the required components
                        Recordset rsFirstFeature  = m_oFirstPolygon.Components.GetComponent(m_landbaseCNO).Recordset;
                        Recordset rsSecondFeature = m_oSecondPolygon.Components.GetComponent(m_landbaseCNO).Recordset;

                        //Assign required field values
                        rsSecondFeature.Fields["SOURCE"].Value       = rsFirstFeature.Fields["SOURCE"].Value;
                        rsSecondFeature.Fields["CREATED_BY"].Value   = m_oGTApplication.DataContext.DatabaseUserName;
                        rsSecondFeature.Fields["CREATED_DATE"].Value = System.DateTime.Today;
                        rsSecondFeature.Fields["STAGE"].Value        = "Accepted";

                        m_oGTTransactionManager.Commit();
                        m_oGTTransactionManager.RefreshDatabaseChanges();

                        m_oGTApplication.RefreshWindows();
                        m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Commit complete");
                        m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpNWArrow;
                        m_oGTCustomCommandHelper.Complete();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(sStatusBarMsg3, sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, sStatusBarMsg3);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                ExitCommand();
            }
            finally
            {
                if (m_blSecondPointSelected)
                {
                    m_gLineGeom    = null;
                    m_gSrcGeometry = null;
                    m_oEditService.RemoveAllGeometries();
                    m_oEditService = null;
                    ExitCommand();
                }
            }
        }