Esempio n. 1
0
        public ReviewAssetHistoryForm(AssetHistoryModel assetHistoryModel, IGTTransactionManager oGTTransactionManager, IGTCustomCommandHelper GTCustomCommandHelper)
        {
            try
            {
                m_dataGridViewColumnSelector = null;
                m_assetHistoryModel          = assetHistoryModel;
                m_oGTTransactionManager      = oGTTransactionManager;
                m_GTCustomCommandHelper      = GTCustomCommandHelper;

                InitializeComponent();

                if (!assetHistoryModel.m_DataContext.IsRoleGranted("ADMINISTRATOR"))
                {
                    btnSaveView.Visible = false;
                }
                if (m_assetHistoryModel.m_FID != 0 && !m_assetHistoryModel.m_isStructure)
                {
                    txtFid.Text = Convert.ToString(m_assetHistoryModel.m_FID);
                }

                LoadDatagridView(null);

                LoadComboBox();

                cmbNamedView.SelectedIndex = -1;

                m_dataGridViewColumnSelector = new DataGridViewColumnSelector(dgHistory, m_assetHistoryModel);

                if (dgHistory.Rows.Count > 0)
                {
                    btnSaveView.Enabled = true;
                    btnExport.Enabled   = true;
                }
                else
                {
                    btnSaveView.Enabled = false;
                    btnExport.Enabled   = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error during execution of Review Asset History custom command." + Environment.NewLine + ex.Message,
                                "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Release all objects / all instances and dispose datagridview and the datatable.
        /// </summary>
        private void CloseForm()
        {
            try
            {
                dgvReviewHistory.Dispose();
                m_dataGridViewColumnSelector = null;
                if (m_assetHistoryModel.m_GridDataTable != null)
                {
                    m_assetHistoryModel.m_GridDataTable.Dispose();
                }
                m_assetHistoryModel.ExitCommand(m_oGTTransactionManager, m_GTCustomCommandHelper);
                m_assetHistoryModel = null;

                this.Close();
            }
            catch
            {
                throw;
            }
        }
Esempio n. 3
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            IGTDDCKeyObjects selectedDDDCKeyObjects = null;
            IList <int>      SelectedFeatureIDList  = new List <int>();

            assetHistoryModel       = new AssetHistoryModel();
            m_GTCustomCommandHelper = CustomCommandHelper;
            IGTDisplayService gTDisplayService;

            try
            {
                assetHistoryModel.m_Application = (IGTApplication)GTClassFactory.Create <IGTApplication>();
                assetHistoryModel.m_DataContext = assetHistoryModel.m_Application.DataContext;

                if (assetHistoryModel.m_Application.ActiveMapWindow != null)
                {
                    gTDisplayService       = assetHistoryModel.m_Application.ActiveMapWindow.DisplayService;
                    selectedDDDCKeyObjects = assetHistoryModel.m_Application.SelectedObjects.GetObjects();
                }
                //If selected set cntains features.
                if (selectedDDDCKeyObjects != null && selectedDDDCKeyObjects.Count > 0)
                {
                    #region
                    foreach (IGTDDCKeyObject ddcKeyObject in selectedDDDCKeyObjects)
                    {
                        if (!SelectedFeatureIDList.Contains(ddcKeyObject.FID))
                        {
                            SelectedFeatureIDList.Add(ddcKeyObject.FID);
                        }
                    }

                    if (SelectedFeatureIDList.Count == 1)
                    {
                        CreateKeyObjectOfSelectedDDC(selectedDDDCKeyObjects);
                    }
                    else
                    {
                        assetHistoryModel.m_WRID        = assetHistoryModel.m_DataContext.ActiveJob;
                        assetHistoryModel.m_isStructure = false;
                    }
                    #endregion
                }
                //If User selected the temporary geometry(Tool tip code)
                //else if (gTDisplayService.SelectedDisplayControlNode != null && gTDisplayService.SelectedDisplayControlNode.DisplayName != string.Empty
                //    && gTDisplayService.SelectedDisplayControlNode.LegendEntry != null && gTDisplayService.SelectedDisplayControlNode.LegendEntry.EntryType == GTech.GTLegendEntryTypeConstants.gtletTemporaryGeometry)
                //{
                //    strTempGeoToolTip = GetToolTipOfTemporaryGeometry(gTDisplayService, out strTempGeoDisplayPath, out strTempGeoDisplayName, strTempGeoToolTip);

                //    if (!string.IsNullOrEmpty(strTempGeoToolTip) && strTempGeoToolTip.ToUpper().StartsWith("FID"))
                //    {
                //        string[] tempArray = strTempGeoToolTip.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                //        CreateKeyObjectOfGivenFID(Convert.ToInt32(tempArray[1]));
                //    }
                //}
                //If user did not select feature /Temporary geometry the form defaults to qurying by WR.
                else
                {
                    assetHistoryModel.m_isStructure = false;
                    assetHistoryModel.m_FID         = 0;
                    assetHistoryModel.m_WRID        = assetHistoryModel.m_DataContext.ActiveJob;
                }


                //Load the history form.
                GetReplaceIDAno();
                reviewAssetHistoryForm = new ReviewAssetHistoryForm(assetHistoryModel, m_oGTTransactionManager, m_GTCustomCommandHelper);
                reviewAssetHistoryForm.StartPosition = FormStartPosition.CenterParent;
                reviewAssetHistoryForm.Show(assetHistoryModel.m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                if (reviewAssetHistoryForm != null)
                {
                    reviewAssetHistoryForm.Close(); reviewAssetHistoryForm.Dispose(); reviewAssetHistoryForm = null;
                }
                MessageBox.Show("Error during execution of Review Asset History custom command." + Environment.NewLine + ex.Message,
                                "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);

                assetHistoryModel.ExitCommand(m_oGTTransactionManager, m_GTCustomCommandHelper);
            }
            finally
            {
                assetHistoryModel.m_Application.EndWaitCursor();
            }
        }