Esempio n. 1
0
 /// <summary>
 /// Display click event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDisplay_Click(object sender, EventArgs e)
 {
     try
     {
         if (grdRedlineAttachments.SelectedRows.Count > 0)
         {
             // No need to copy the file locally.
             //sFileName = Path.GetTempPath() + Convert.ToString(grdRedlineAttachments.SelectedRows[0].Cells[0].Value);
             //File.Copy(Convert.ToString(grdRedlineAttachments.SelectedRows[0].Cells[2].Value) + Convert.ToString(grdRedlineAttachments.SelectedRows[0].Cells[0].Value), sFileName, true);
             DataGridViewRow row       = grdRedlineAttachments.SelectedRows[0];
             string          sFileName = row.Cells[2].Value.ToString() + row.Cells[0].Value.ToString();
             m_gtApplication.ActiveMapWindow.DisplayService.AppendRedlines("Construction Redlines", sFileName, 0, true, true, GTDisplayPositionConstants.gtdsdpFront);
             m_gtApplication.RefreshWindows();
             this.DialogResult = DialogResult.Cancel;
             this.Close();
             m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Display Construction Redlines completed.");
         }
         else
         {
             m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "No Redline is selected.");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
 public void MouseClick(Intergraph.GTechnology.API.IGTMapWindow MapWindow, Intergraph.GTechnology.API.IGTPoint UserPoint, int Button, int ShiftState, Intergraph.GTechnology.API.IGTDDCKeyObjects LocatedObjects, Intergraph.GTechnology.API.IGTPlacementTechniqueEventMode EventMode)
 {
     try
     {
         string ownerFeatureName = m_ActiveMapWindow.DetailID == 0 ? "Pad" : "Vault";
         if (0 == LocatedObjects.Count)
         {
             // If there are no linear objects in the collection, then there is nothing to use to create
             // the new geometry.  Beep to notify the user and display a message in the status bar.
             System.Console.Beep();
             m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "There is no existing " + ownerFeatureName + " symbol feature to Own the Primary switch gear which is to be placed adjacent to it.");
         }
         else
         {
             if (1 == LocatedObjects.Count && ((LocatedObjects[0].FNO == 108 && LocatedObjects[0].ComponentViewName == "V_PAD_S" && m_ActiveMapWindow.DetailID == 0) || (LocatedObjects[0].FNO == 117 && LocatedObjects[0].ComponentViewName == "V_VAULT_DP" && m_GTApplication.ActiveMapWindow.DetailID != 0)))
             {
                 // There is exactly 1 linear object in the collection, so use it to creat the new geometry.
                 this.PlacePrimarySwitchGear(LocatedObjects[0]);
                 MapWindow.HighlightedObjects.Clear();
             }
             else
             {
                 m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Please identify only " + ownerFeatureName + " symbol feature to Own the Primary switch gear which is to be placed adjacent to it.");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public bool CheckForAccountMatchErrorExecute()
        {
            try
            {
                if (m_Components["STREETLIGHT_N"].Recordset.EOF)
                {
                    m_Components["STREETLIGHT_N"].Recordset.MoveFirst();
                }
                //get street light fields from the street light account and the street light and compare.
                string    lightAccountID     = m_Components["STREETLIGHT_N"].Recordset.Fields["ACCOUNT_ID"].Value.ToString();
                string    lightLampType      = m_Components["STREETLIGHT_N"].Recordset.Fields["LAMP_TYPE_C"].Value.ToString();
                string    lightWattage       = m_Components["STREETLIGHT_N"].Recordset.Fields["WATT_Q"].Value.ToString();
                string    lightRateSchedule  = m_Components["STREETLIGHT_N"].Recordset.Fields["RATE_SCHEDULE_C"].Value.ToString();
                string    lightLuminareStyle = m_Components["STREETLIGHT_N"].Recordset.Fields["LUMIN_STYL_C"].Value.ToString();
                string    SQL                  = "select WATTAGE, LAMP_TYPE, RATE_SCHEDULE, LUMINARE_STYLE from STLT_ACCOUNT where ESI_LOCATION = ?";
                Recordset RS                   = m_DataContext.OpenRecordset(SQL, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, lightAccountID.ToUpper());
                string    accountWattage       = Convert.ToString(RS.Fields["WATTAGE"].Value);
                string    accountLampType      = Convert.ToString(RS.Fields["LAMP_TYPE"].Value);
                string    accountRateSchedule  = Convert.ToString(RS.Fields["RATE_SCHEDULE"].Value);
                string    accountLuminareStyle = Convert.ToString(RS.Fields["LUMINARE_STYLE"].Value);

                if (lightLampType.ToUpper().Trim() != accountLampType.ToUpper().Trim() || lightWattage.ToUpper().Trim() != accountWattage.ToUpper().Trim() || lightRateSchedule.ToUpper().Trim() != accountRateSchedule.ToUpper().Trim() || lightLuminareStyle.ToUpper().Trim() != accountLuminareStyle.ToUpper().Trim())
                {
                    app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "ACCOUNT # CONFLICT: Street Light attributes do not match the specified Street Light Account.");
                    return(true);                    //since the error message was displayed, we return a value of true to let the program know to stop running.
                }
                return(false);
            }
            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);
            }
        }
Esempio n. 4
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;
            }
        }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="edits"></param>
 public static void SaveData(System.Data.DataTable edits)
 {
     gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving edits…");
     //try
     {
         foreach (System.Data.DataRow row in edits.Rows)
         {
             transactionManager.Begin("Edit Feature");
             IGTKeyObject editedFeature     = gtDataContext.OpenFeature(FNO, Convert.ToInt32(row["G3E_FID"]));
             IGTComponent editedComponenent = editedFeature.Components.GetComponent(Convert.ToInt16(row["G3E_CNO"]));
             editedComponenent.Recordset.Filter = "G3E_CID = " + row["G3E_CID"].ToString();
             editedComponenent.Recordset.MoveFirst();
             foreach (Field field in editedComponenent.Recordset.Fields)
             {
                 if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adVarChar)
                 {
                     if (field.Value != row[field.Name].ToString())
                     {
                         field.Value = row[field.Name];
                     }
                 }
                 else if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adNumeric)
                 {
                     if (DBNull.Value.Equals(row[field.Name]) || field.Value != Convert.ToDecimal(row[field.Name]))
                     {
                         if (row[field.Name].Equals(null))
                         {
                             field.Value = null;
                         }
                         else
                         {
                             field.Value = row[field.Name];
                         }
                     }
                 }
                 else if (!DBNull.Value.Equals(field.Value) && field.Type == DataTypeEnum.adDBTimeStamp)
                 {
                     if (field.Value != Convert.ToDateTime(row[field.Name]))
                     {
                         field.Value = row[field.Name];
                     }
                 }
                 else if (DBNull.Value.Equals(field.Value) && !DBNull.Value.Equals(row[field.Name]))
                 {
                     field.Value = row[field.Name];
                 }
             }
             transactionManager.Commit();
             editedFeature = null;
             gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
         }
     }
     //catch (Exception error)
     //{
     //    transactionManager.Rollback();
     //    MessageBox.Show("Error in SaveData (" + error.Message + ")", "G/Technology");
     //}
 }
Esempio n. 6
0
        public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = null;
            ErrorMessageArray  = null;

            string errorPriority = Convert.ToString(Arguments.GetArgument(0));

            GTValidationLogger gTValidationLogger = null;

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = Convert.ToString(ActiveFeature.CNO),
                    ActiveFID           = ActiveFeature.FID,
                    ActiveFieldName     = "N/A",
                    ActiveFieldValue    = "N/A",
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = Convert.ToString(RelatedCNO),
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Voltage Agreement",
                    ValidationInterfaceType = "RGI"
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Voltage Agreement Entry", "N/A", "");
            }

            try
            {
                IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>();

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Started");

                SetAffectedRelatedNodeVoltages(errorPriority);

                if (m_lstErrorMessage.Count > 0)
                {
                    ErrorMessageArray  = m_lstErrorMessage.ToArray();
                    ErrorPriorityArray = m_lstErrorPriority.ToArray();
                }

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Completed");

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Voltage Agreement Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in Voltage Agreement Relationship Geometry Interface-Validate: " + ex.Message);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Method for Validate.
        /// </summary>
        private void ProcessValidate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            try
            {
                ErrorPriorityArray = null;
                ErrorMessageArray  = null;

                GTValidationLogger gTValidationLogger = null;

                if (new gtLogHelper().CheckIfLoggingIsEnabled())
                {
                    LogEntries logEntries = new LogEntries
                    {
                        ActiveComponentName = Convert.ToString(m_rgiBaseClass.ActiveFeature.CNO),
                        ActiveFID           = m_rgiBaseClass.ActiveFeature.FID,
                        ActiveFieldName     = "N/A",
                        ActiveFieldValue    = "N/A",
                        JobID = m_rgiBaseClass.DataContext.ActiveJob,
                        RelatedComponentName    = Convert.ToString(m_rgiBaseClass.RelatedCNO),
                        RelatedFID              = 0,
                        RelatedFieldName        = "N/A",
                        RelatedFieldValue       = "N/A",
                        ValidationInterfaceName = "Feeder Agreement",
                        ValidationInterfaceType = "RGI"
                    };
                    gTValidationLogger = new GTValidationLogger(logEntries);

                    gTValidationLogger.LogEntry("TIMING", "START", "Feeder Agreement Entry", "N/A", "");
                }

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

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Started");

                ProcessEstablish();


                if (m_lstErrorMessage.Count > 0)
                {
                    ErrorMessageArray  = m_lstErrorMessage.ToArray();
                    ErrorPriorityArray = m_lstErrorPriority.ToArray();
                }

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Completed");

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Feeder Agreement Exit", "N/A", "");
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 8
0
 private void ccTreeTrimRequestForm_Load(object sender, EventArgs e)
 {
     m_oOracleUserData               = GetRACFID();
     txtFrom.Text                    = m_oOracleUserData[0];
     dtpEstResponseDate.Value        = dtpTodayDate.Value.AddDays(5);
     dtpClearingReqDate.CustomFormat = " ";
     dtpClearingReqDate.Format       = DateTimePickerFormat.Custom;
     rbOvertimeChargesNo.Checked     = true;
     rbPropertyOwnersNo.Checked      = true;
     lblWRNumVal.Text                = m_oGTApp.DataContext.ActiveJob;
     m_oGTApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Select the Prime and Sub Account for the voucher using Voucher Account selection button");
 }
Esempio n. 9
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;
            }
        }
Esempio n. 10
0
 private void SetStatusBarText(string sDisplayText)
 {
     try
     {
         oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, " ");
         oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, sDisplayText);
     }
     catch (Exception ex)
     {
         CommandUtilities.LogException(oDiag, "SetStatusBarText", ex);
         throw ex;
     }
 }
Esempio n. 11
0
 public virtual void MouseMove(IGTMapWindow MapWindow, Intergraph.GTechnology.API.IGTPoint UserPoint, int ShiftState, Intergraph.GTechnology.API.IGTDDCKeyObjects LocatedObjects, Intergraph.GTechnology.API.IGTPlacementTechniqueEventMode EventMode)
 {
     if (!bSilent)
     {
         if (m_PTHelper != null)
         {
             m_PTHelper.MouseMove(UserPoint, ShiftState);
         }
         if (m_gtApplication != null)
         {
             m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Please click on related Primary Conductor feature.");
         }
     }
 }
Esempio n. 12
0
        /// <summary>
        /// When a feature is created with a SCADA Attributes component, this interface sets the Device ID attribute to the next available unique value
        /// </summary>
        public void Execute()
        {
            IGTApplication _gtApp = (IGTApplication)GTClassFactory.Create <IGTApplication>();

            _gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Device ID Attribute Update FI");

            IGTComponent comp = Components[ComponentName];

            try
            {
                if (comp != null)
                {
                    Recordset rs = null;
                    int       i  = 0;
                    comp.Recordset.MoveFirst();
                    rs = _gtApp.DataContext.Execute("SELECT " + m_seqName + ".NEXTVAL FROM DUAL", out i, (int)CommandTypeEnum.adCmdText);

                    if (rs != null && rs.RecordCount > 0)
                    {
                        comp.Recordset.Fields[m_fieldName].Value = Convert.ToString(rs.Fields[0].Value);
                        comp.Recordset.Update();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occured in fiSetAttributeBySequence FI " + ex.Message, Caption);
            }
            finally
            {
                // comp = null;
            }
        }
Esempio n. 13
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            IGTApplication app = GTClassFactory.Create <IGTApplication>();

            app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, string.Empty);
            this.Close();
        }
Esempio n. 14
0
        /// <summary>
        ///  Method is called when pad/vault  mounted switch gear placement is started
        /// </summary>
        /// <param name="PTHelper"></param>
        /// <param name="KeyObject"></param>
        /// <param name="KeyObjectCollection"></param>
        public void StartPlacement(IGTPlacementTechniqueHelper PTHelper, IGTKeyObject KeyObject, IGTKeyObjects KeyObjectCollection)
        {
            try
            {
                m_PTHelper            = PTHelper;
                m_KeyObject           = KeyObject;
                m_KeyObjectCollection = KeyObjectCollection;


                m_PTHelper.ConstructionAidsEnabled        = Intergraph.GTechnology.API.GTConstructionAidsEnabledConstants.gtptConstructionAidsNone;
                m_PTHelper.ConstructionAidDynamicsEnabled = false;
                m_PTHelper.StatusBarPromptsEnabled        = false;

                m_PTHelper.StartPlacement(m_KeyObject, m_KeyObjectCollection);

                m_GTApplication   = GTClassFactory.Create <IGTApplication>().Application;
                m_Arguments       = m_ActiveGraphicComponent.Arguments;
                m_ActiveMapWindow = m_GTApplication.ActiveMapWindow;
                string ownerFeatureName = m_ActiveMapWindow.DetailID == 0 ? "Pad" : "Vault";
                m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Click to select an existing " + ownerFeatureName + " feature to Own the Primary switch gear which is to be placed adjacent to it.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Caption);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Execute Procudure to Detect Polygon Edge Mismatch
        /// </summary>
        private void DetectPolygonEdgeMismatch()
        {
            Recordset rs          = null;
            string    sqlStmt     = "Begin LBM_UTL.DetectPolygonEdgeMismatch; end;";
            string    mergeStatus = string.Empty;

            try
            {
                gtApp.BeginWaitCursor();
                gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Detecting Polygon Edge Mismatch....");
                gtTransactionManager.Begin("Detect Polygon Edge Mismatch");
                rs = Execute(sqlStmt);
                gtTransactionManager.Commit();
            }
            catch (Exception ex)
            {
                gtTransactionManager.Rollback();
                throw ex;
            }
            finally
            {
                rs = null;
                gtTransactionManager.RefreshDatabaseChanges();
                gtApp.RefreshWindows();
                gtApp.EndWaitCursor();
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Execute Procudure to Purge Expired Archived Landbase
        /// </summary>
        private void DetectOverlapping(int g3eFno, bool selfOverlap)
        {
            ADODB.Recordset rs      = null;
            string          sqlStmt = "Begin LBM_UTL.DetectOverlappingPolygons({0},{1}); end;";

            try
            {
                gtApp.BeginWaitCursor();
                sqlStmt = string.Format(sqlStmt, g3eFno, selfOverlap);
                gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Detecting Overlapping Boundarys....");
                gtTransactionManager.Begin("Detect Overlapping Boundarys");
                rs = Execute(sqlStmt);
                gtTransactionManager.Commit();
                MessageBox.Show("Detecting Overlapping Boundarys Analysis is Completed", msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                gtTransactionManager.Rollback();
                throw ex;
            }
            finally
            {
                rs = null;
                gtTransactionManager.RefreshDatabaseChanges();
                gtApp.RefreshWindows();
                gtApp.EndWaitCursor();
            }
        }
Esempio n. 17
0
        //public void SynchronizeWorkPointForObsoleteCUs()
        //{
        //    IGTKeyObject oKeyObject = GTClassFactory.Create<IGTKeyObject>();

        //    try
        //    {
        //        foreach (KeyValuePair<int, Int16> item in m_WorkPointsKeyObjects)
        //        {
        //            oKeyObject = m_oApp.DataContext.OpenFeature(item.Value, item.Key);
        //            DeleteObsoleteCURecords(oKeyObject);
        //        }
        //    }
        //    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);
        //    }
        //}

        public void SynchronizeWorkPointsForDiscardedFeatures()
        {
            IGTKeyObjects oKeyObjects = GTClassFactory.Create <IGTKeyObjects>();
            IGTKeyObject  oKeyObject  = GTClassFactory.Create <IGTKeyObject>();

            try
            {
                foreach (KeyValuePair <int, Int16> item in m_WorkPointsKeyObjects)
                {
                    oKeyObject = m_oApp.DataContext.OpenFeature(item.Value, item.Key);

                    if (DiscardWorkPoint(oKeyObject))
                    {
                        oKeyObjects.Add(oKeyObject);
                    }
                    // DeleteObsoleteCURecords(oKeyObject);
                }

                if (oKeyObjects.Count > 0)
                {
                    ADODB.Recordset rsDiscardRecordSet = CreateInMemoryADORS(oKeyObjects);
                    m_oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Synchronizing Workpoints...");
                    m_jobManagement.DiscardFeatureEdits(rsDiscardRecordSet);
                }
            }
            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);
            }
        }
Esempio n. 18
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_oGTApp = GTClassFactory.Create <IGTApplication>();
                m_oGTCustomCommandHelper = CustomCommandHelper;
                if (m_oGTApp.DataContext.IsRoleGranted("PRIV_MGMT_STLT"))
                {
                    if (Validate())
                    {
                        string streetlightImportSheet = OpenFileDialog();
                        if (!String.IsNullOrEmpty(streetlightImportSheet))
                        {
                            m_oGTApp.BeginWaitCursor();
                            StreetLightImportWorkSheet importWorkSheet = new StreetLightImportWorkSheet();
                            importWorkSheet.InitializeExcel(streetlightImportSheet);
                            if (importWorkSheet.ExcelTable != null)
                            {
                                ImportSpreadsheetFormatValidation formatValidation = new ImportSpreadsheetFormatValidation(m_oGTApp.DataContext);
                                m_oGTApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Street Light Import Tool : Validating Spreadsheet Format");
                                if (formatValidation.ValidateSpreadsheetFormat(importWorkSheet.ExcelTable))
                                {
                                    ImportSpreadsheetRecordValidation recordValidation = new ImportSpreadsheetRecordValidation(m_oGTApp, m_oGTTransactionManager);
                                    DataTable excelDataTable = recordValidation.ValidateSpreadsheetRecord(importWorkSheet.ExcelTable);
                                    ValidateProcessing(streetlightImportSheet, importWorkSheet, excelDataTable, recordValidation);
                                }
                            }
                            m_oGTApp.EndWaitCursor();
                        }
                    }

                    ExitCommand();
                }
                else
                {
                    MessageBox.Show("User does not have PRIV_MGMT_STLT role.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);
                    ExitCommand();
                }
            }
            catch (Exception ex)
            {
                m_oGTApp.EndWaitCursor();
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                if (ex.GetType().Name == "DuplicateNameException")
                {
                    MessageBox.Show("WorkSheet contains duplicate column names.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("Error in StreetLight Import Tool command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                ExitCommand();
            }
        }
Esempio n. 19
0
        void IGTCustomCommandModal.Activate()
        {
            int    tmpDesAreaFid = 0;
            string WRNumber      = string.Empty;

            gtApp = GTClassFactory.Create <IGTApplication>();

            gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving Construction Redline file.");
            if (IsWRJob(ref WRNumber) == false)
            {
                return;
            }
            if (DoesDesignAreaExist(ref tmpDesAreaFid) == false)
            {
                return;
            }
            SaveXMLAddHyperlink(WRNumber, tmpDesAreaFid);
            gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving Construction Redline file ended.");
        }
Esempio n. 20
0
        /// <summary>
        /// Command to add hyperlink entry to feature
        /// </summary>
        /// <param name="p_selectedFNO"></param>
        /// <param name="p_selectedFID"></param>
        /// <param name="p_plotwindowPdfFilename"></param>
        /// <param name="p_description"></param>
        /// <param name="p_type"></param>
        private void AddHyperLinktoSelectedFeature(short p_selectedFNO, int p_selectedFID, string p_hyperLnk, string p_filename, string p_description, string p_type)
        {
            IGTKeyObject ddcSelectedKeyObj;
            Recordset    rsHypLnkComp  = null;
            IGTKeyObject tmpSelFeature = null;

            try
            {
                tmpSelFeature       = m_igtApplication.DataContext.OpenFeature(p_selectedFNO, p_selectedFID);
                rsHypLnkComp        = tmpSelFeature.Components["HYPERLINK_N"].Recordset;
                rsHypLnkComp.Filter = "HYPERLINK_T = '" + p_hyperLnk + "'";

                if (rsHypLnkComp.RecordCount == 0)
                {
                    tmpSelFeature = null;
                    m_igtTransactionManage.Begin("IN PROGRESS");
                    ddcSelectedKeyObj = m_igtApplication.DataContext.OpenFeature(p_selectedFNO, p_selectedFID);
                    ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.AddNew("G3E_FID", p_selectedFID);
                    ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["HYPERLINK_T"].Value   = p_hyperLnk;
                    ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["DESCRIPTION_T"].Value = p_description;
                    if (p_type.Length > ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize)
                    {
                        ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value =
                            p_type.Substring(0, ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize);
                    }
                    else
                    {
                        ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value = p_type;
                    }
                    ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Fields["FILENAME_T"].Value = p_filename;
                    ddcSelectedKeyObj.Components["HYPERLINK_N"].Recordset.Update("G3E_FNO", p_selectedFNO);
                    if (m_igtTransactionManage.TransactionInProgress)
                    {
                        m_igtTransactionManage.Commit();
                    }
                    m_igtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Site drawing has been attached to the selected " + p_selectedFID + " feature.");
                }
                else
                {
                    tmpSelFeature = null;
                }
            }
            catch (Exception)
            {
                if (m_igtTransactionManage.TransactionInProgress)
                {
                    m_igtTransactionManage.Rollback();
                }
                throw;
            }
            finally
            {
                ddcSelectedKeyObj = null;
            }
        }
Esempio n. 21
0
 public void Activate()
 {
     m_gtApplication = GTClassFactory.Create <IGTApplication>();
     m_gtdataContext = m_gtApplication.DataContext;
     m_strActiveJob  = m_gtApplication.DataContext.ActiveJob;
     m_strSQL        = "SELECT G3E_JOBTYPE FROM G3E_JOB WHERE G3E_IDENTIFIER='" + m_strActiveJob + "'";
     m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Display Construction Redlines Command Started.");
     try
     {
         if (IsJobTypeNONWR(m_strSQL))
         {
             m_constructionRedlines = new ConstructionRedlines(GetWRRedlines());
             if (m_constructionRedlines.ShowDialog(m_gtApplication.ApplicationWindow) == DialogResult.Cancel)
             {
                 ExitCommand();
                 return;
             }
         }
         else
         {
             MessageBox.Show(m_gtApplication.ApplicationWindow, "This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error during execution of Display Construction Redlines custom command" + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     finally
     {
         if (m_rsDesignArea != null)
         {
             if (m_rsDesignArea.State == 1)
             {
                 m_rsDesignArea.Close();
                 m_rsDesignArea.ActiveConnection = null;
             }
             m_rsDesignArea = null;
         }
     }
     m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Display Construction Redlines completed.");
 }
Esempio n. 22
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;
         }
     }
 }
Esempio n. 23
0
 private void ExitCommand()
 {
     try
     {
         m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
         m_gtApplication.EndWaitCursor();
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 24
0
 /// <summary>
 /// Custom command mouse move event
 /// </summary>
 /// <param name="sender">object sender</param>
 /// <param name="e">GTMouseEventArgs</param>
 /// <returns></returns>
 void m_oGTCustomCommandHelper_MouseMove(object sender, GTMouseEventArgs e)
 {
     m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpCrossHair;
     if ((m_blFirstPointSelected))
     {
         m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, m_sStatusBarMsg2);
         //move the selected feature
         m_oEditService.Move(e.WorldPoint);
         m_blSecondPointSelected = true;
         m_blPointSelected       = false;
         m_locatedObjects        = m_oGTApplication.ActiveMapWindow.LocateService.Locate(e.WorldPoint, 3, 1, GTSelectionTypeConstants.gtmwstSelectSingle);
     }
     else
     {
         m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, m_sStatusBarMsg1);
         if (!m_blPointSelected)
         {
             m_blFirstPointSelected = false;
             m_blPointSelected      = true;
         }
     }
 }
Esempio n. 25
0
        private Boolean IsWRJob(ref string p_WR_NBR)
        {
            Boolean        tmpRetVal = false;
            Recordset      tmpRs     = null;
            string         tmpQry    = string.Empty;
            IGTDataContext tmpDC     = gtApp.DataContext;

            try
            {
                tmpQry = "select g3e_jobtype, wr_nbr from g3e_job " +
                         "where g3e_identifier = '" + tmpDC.ActiveJob + "'";
                tmpRs = tmpDC.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic,
                                            LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText);
                if (!(tmpRs.BOF && tmpRs.EOF))
                {
                    tmpRs.MoveFirst();
                    if (tmpRs.Fields[0].Value == "NON-WR")
                    {
                        tmpRetVal = false;
                        gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Saving Construction Redline file ended.");
                        MessageBox.Show("Error: The active Job is a 'NON-WR' job. \n Please use a job associated to a Work Order.",
                                        "IsWRJob - Error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        p_WR_NBR  = tmpRs.Fields[1].Value.ToString();
                        tmpRetVal = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "IsWRJob - Error", MessageBoxButtons.OK);
                tmpRetVal = false;
            }
            return(tmpRetVal);
        }
Esempio n. 26
0
        /// <summary>
        /// Attaches a file to the WR in SharePoint and creates the Hyperlink on the Design Area feature for the WR.
        /// </summary>
        /// <param name="WR">WR to attach file</param>
        /// <param name="fileName">Full pathname of file to attach.</param>
        /// <param name="attachmentType">Classification of file to attach (e.g. "As-Built Redlines", "Construction Redlines", etc.).</param>
        /// <returns></returns>
        public bool AttachDocument(string WR, string fileName, string attachmentType)
        {
            try
            {
                bool retVal = false;

                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Uploading archived prints to the document repository.");

                // Add the document to Sharepoint via the ONC Document Manager interface
                OncDocManage.OncDocManage oncDocManager = new OncDocManage.OncDocManage();

                // These three are set in a given interface because the OncDocManage class is designed
                // such that it can be used by systems other than G/Tech.
                oncDocManager.SPSiteURL  = SysGeneralParameter(SUBSYSTEMNAME, SUBSYSTEMCOMPONENT, "SP_URL");
                oncDocManager.SPRelPath  = SysGeneralParameter(SUBSYSTEMNAME, SUBSYSTEMCOMPONENT, "JOBWO_REL_PATH");
                oncDocManager.SPRootPath = SysGeneralParameter(SUBSYSTEMNAME, SUBSYSTEMCOMPONENT, "ROOT_PATH");

                oncDocManager.SrcFilePath       = fileName;
                oncDocManager.SPFileName        = fileName.Substring(fileName.LastIndexOf("\\") + 1);
                oncDocManager.SPFileType        = attachmentType;
                oncDocManager.SPFileDescription = string.Format("Archival Print - {0}", attachmentType);
                oncDocManager.WrkOrd_Job        = WR;

                // If the document is successfully uploaded, then create the hyperlink record on the Design Area
                if (oncDocManager.AddSPFile(true))
                {
                    retVal = AddDesignAreaHyperlink(oncDocManager.RetFileURL, attachmentType, oncDocManager.RetFileName, oncDocManager.SPFileDescription);
                }
                else
                {
                    string msg = string.Format("Error attempting to add a file to the document repository:  {0}", oncDocManager.RetErrMessage);
                    throw new Exception(msg);
                }

                return(retVal);
            }
            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);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Intialize variables and check selected feature is valid.
        /// </summary>
        /// <param name="CustomCommandHelper"></param>
        /// <returns></returns>
        public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_oGTApplication         = GTClassFactory.Create <IGTApplication>();
                m_oGTCustomCommandHelper = CustomCommandHelper;
                m_oGTApplication.BeginWaitCursor();
                if (m_oGTApplication.SelectedObjects.FeatureCount > 0)
                {
                    //Get Source feature FNO,FID
                    m_sourceFNO = m_oGTApplication.SelectedObjects.GetObjects()[0].FNO;
                    m_sourceFID = m_oGTApplication.SelectedObjects.GetObjects()[0].FID;

                    //Get Primary graphic CNO and Type
                    m_primaryGeoCNO = GetPrimaryGeographicCNO(m_sourceFNO);
                    m_componentType = GetComponentType(m_primaryGeoCNO);

                    //if selected feature is not valid then show the error message
                    if ((m_componentType != 8) || (!ValidateSelectedFeature(m_sourceFNO)))
                    {
                        MessageBox.Show(m_sValidationMsg, m_sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        ExitCommand();
                    }
                    else
                    {
                        SubscribeEvents();
                        //Get target feature FNO
                        m_targetFNO    = GetTargetFeature(m_sourceFNO);
                        m_osrcGeometry = m_oGTApplication.SelectedObjects.GetObjects()[0].Geometry;
                        m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, m_sStatusBarMsg1);
                        m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpCrossHair;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, m_sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                ExitCommand();
            }
        }
Esempio n. 28
0
        public bool IsAttributeEditable(int ANO)
        {
            if (string.IsNullOrEmpty(m_sComponentName))
            {
                m_sComponentName = m_configuredComponentName;
            }

            string    sFieldName         = string.Empty;
            string    sql                = string.Empty;
            string    sJobAttributeValue = string.Empty;
            bool      bdefaultAttributeControlSetting = true;
            int       sFNO               = 0;
            string    sReadOnly          = string.Empty;
            bool      bCompareMatchFound = false;
            bool      bEditControl       = true;
            Recordset rs = null;
            string    sCompNameForFNO = m_sComponentName;

            try
            {
                IGTApplication oApp = GTClassFactory.Create <IGTApplication>();

                string jobAttributeValue        = oApp.DataContext.ActiveJob;
                bool   mainComponentRecordEmpty = false;

                //First store the default setting of g3e_readonly value of tab attribute configured against the ANO (g3e_Ano of the field which triggered this interface)
                //Store the default setting of g3e_readonly for the enabling and disabling of the tab attribute in case of no action scenarios

                //The m_sComponentName may not have a recordset at the time of the initialization of the tabs, so look for a component that has the record that may
                // not be necessarily m_sComponentName

                if (m_componentCollection != null)
                {
                    if (m_componentCollection[m_sComponentName].Recordset.RecordCount == 0)
                    {
                        mainComponentRecordEmpty = true;
                        for (int i = 0; i < m_componentCollection.Count; i++)
                        {
                            if (m_componentCollection[i].Recordset.RecordCount > 0)
                            {
                                sCompNameForFNO = m_componentCollection[i].Name;
                                m_componentCollection[sCompNameForFNO].Recordset.MoveFirst();
                                break;
                            }
                        }
                    }
                }
                if (m_componentCollection != null && m_componentCollection[sCompNameForFNO].Recordset != null)
                {
                    sFNO = m_componentCollection[sCompNameForFNO].Recordset.Fields["G3E_FNO"].Value.GetType() == typeof(DBNull) ? 0 : Convert.ToInt32(m_componentCollection[sCompNameForFNO].Recordset.Fields["G3E_FNO"].Value);
                }
                sql = "select distinct(g3e_readonly) from G3E_DIALOGATTRIBUTES_OPTABLE a, g3e_dialogs_optable b where a.g3E_ano = " + ANO + " and a.g3E_dtno = b.g3e_dtno and b.g3e_type <> 'Review' and b.g3e_type <> 'G3E_JOBENVIRONMENT' and b.g3E_fno = " + sFNO;
                rs  = DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, new object[1]);

                if (rs != null)
                {
                    if (!(rs.EOF && rs.BOF))
                    {
                        rs.MoveFirst();
                        sReadOnly = Convert.ToString(rs.Fields["g3e_readonly"].Value);
                    }
                }

                bdefaultAttributeControlSetting = sReadOnly == "1" ? false : true;
                bEditControl = bdefaultAttributeControlSetting;


                if (string.IsNullOrEmpty(oApp.DataContext.ActiveJob)) //Return without any action if no active job exists
                {
                    return(bEditControl);
                }

                if (mainComponentRecordEmpty)
                {
                    return(bEditControl);
                }
                //Know the field name of Job Attribute configured in the argument to control access to the tab attribute
                rs        = oApp.DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE");
                rs.Filter = "G3E_ANO = " + m_sjobANO + " AND G3E_NAME = 'G3E_JOB'";
                string sPickListTable       = string.Empty;
                string sKeyField            = string.Empty;
                string sValueField          = string.Empty;
                string sComparedJobKeyField = string.Empty;

                if (rs != null)
                {
                    if (!(rs.EOF && rs.BOF))
                    {
                        rs.MoveFirst();
                        sFieldName     = Convert.ToString(rs.Fields["G3E_FIELD"].Value);
                        sPickListTable = Convert.ToString(rs.Fields["G3E_PICKLISTTABLE"].Value);
                        sKeyField      = Convert.ToString(rs.Fields["G3E_KEYFIELD"].Value);
                        sValueField    = Convert.ToString(rs.Fields["G3E_VALUEFIELD"].Value);
                    }
                    else
                    {
                        oApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Error - The configured job attribute that controls access does not specify a valid configuration...");
                        return(bEditControl);
                    }
                }

                //   Recordset rsTemp = null;

                //Store value of the job attribute configured in the interface argument
                if (!string.IsNullOrEmpty(sFieldName))
                {
                    sql = "select " + sFieldName + " from g3e_job where G3E_IDENTIFIER = '" + DataContext.ActiveJob + "'";
                    rs  = DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, new object[1]);
                    if (rs != null)
                    {
                        if (!(rs.EOF && rs.BOF))
                        {
                            rs.MoveFirst();
                            sJobAttributeValue = Convert.ToString(rs.Fields[0].Value);
                        }
                    }
                }

                if (m_sCompareValue.Contains("#"))
                {
                    string sLocalANO       = m_sCompareValue.Remove(0, 1);
                    string sLocalFieldName = string.Empty;

                    rs = DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE");

                    rs.Filter = "g3e_ano = " + sLocalANO;

                    if (rs != null)
                    {
                        if (!(rs.EOF && rs.BOF))
                        {
                            rs.MoveFirst();
                            sLocalFieldName = Convert.ToString(rs.Fields["G3E_FIELD"].Value);
                            if (m_componentCollection[ComponentName].Recordset != null && m_componentCollection[ComponentName].Recordset.RecordCount > 0)
                            {
                                try
                                {
                                    m_sCompareValue = Convert.ToString(m_componentCollection[ComponentName].Recordset.Fields[sLocalFieldName].Value);
                                }
                                catch (Exception)
                                {
                                    throw new Exception("The " + sLocalFieldName + " is not a valid field on the component" + ComponentName);
                                }

                                bCompareMatchFound = m_sCompareValue.Equals(sJobAttributeValue) == true ? true : false;
                            }
                        }
                    }
                }

                else
                {
                    if (m_sCompareValue.Contains(","))
                    {
                        string[] sApp = m_sCompareValue.Split(',');
                        if (sApp.ToList <string>().Find(p => p.Equals(sJobAttributeValue)) != null)
                        {
                            bCompareMatchFound = true;
                        }
                        else
                        {
                            bCompareMatchFound = false;
                        }
                    }
                    else
                    {
                        bCompareMatchFound = m_sCompareValue.Equals(sJobAttributeValue) == true ? true : false;
                    }
                }

                if (m_iRestrictOnMatch == 1)
                {
                    if (bCompareMatchFound)
                    {
                        bEditControl = false;
                    }
                }
                else
                {
                    if (!bCompareMatchFound)
                    {
                        bEditControl = false;
                    }
                }

                return(bEditControl);
            }
            catch (Exception ex)
            {
                throw new Exception("There is an error in \"Restrict By Job Attribute\" Attribute Edit Control Interface \n" + ex.Message);
            }
        }
Esempio n. 29
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;
            }
        }
Esempio n. 30
0
        public void Activate()
        {
            IGTPlotWindow           igtPlotWindow           = null;
            IGTExportService        igtExportService        = null;
            IGTPDFPrinterProperties igtPDFPrinterProperties = null;

            OncDocManage.OncDocManage tmpOncDocMgr = new OncDocManage.OncDocManage();


            try
            {
                m_igtApplication        = GTClassFactory.Create <IGTApplication>();
                igtPlotWindow           = m_igtApplication.ActivePlotWindow;
                igtExportService        = GTClassFactory.Create <IGTExportService>();
                igtPDFPrinterProperties = GTClassFactory.Create <IGTPDFPrinterProperties>();
                m_igtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Attach Site Drawing to selected feature started");

                if (Validate())
                {
                    m_plotwindowPdfFilename = m_plotwindowPath + igtPlotWindow.Caption + ".pdf";
                    m_igtApplication.BeginWaitCursor();

                    setPDFPrinterProps(ref igtPDFPrinterProperties);

                    igtExportService.SaveAsPDF(m_plotwindowPdfFilename, igtPDFPrinterProperties, igtPlotWindow, false);
                    igtExportService        = null;
                    igtPDFPrinterProperties = null;
                    igtPlotWindow           = null;
                    //m_igtApplication.EndWaitCursor();
                    if (File.Exists(m_plotwindowPdfFilename))
                    {
                        if (GetGeneralParams(ref tmpOncDocMgr))
                        {
                            m_igtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Adding the Site Drawing PDF file to SharePoint.");
                            tmpOncDocMgr.SrcFilePath = m_plotwindowPdfFilename;
                            tmpOncDocMgr.SPFileName  = m_plotwindowPdfFilename.Substring(m_plotwindowPdfFilename.LastIndexOf("\\") + 1);
                            tmpOncDocMgr.SPFileType  = "Site Drawings";
                            tmpOncDocMgr.WrkOrd_Job  = m_igtApplication.DataContext.ActiveJob;

                            if (tmpOncDocMgr.AddSPFile(true))
                            {
                                //add to hyperlink to selected object
                                //AddHyperLinktoSelectedFeature(m_selectedFNO, m_selectedFID, m_plotwindowPdfFilename, "Plotwindow " + m_igtApplication.ActivePlotWindow.Caption + " pdf", "SITE");
                                AddHyperLinktoSelectedFeature(m_selectedFNO, m_selectedFID,
                                                              tmpOncDocMgr.RetFileURL, tmpOncDocMgr.RetFileName,
                                                              "Plotwindow " + m_igtApplication.ActivePlotWindow.Caption + " pdf", tmpOncDocMgr.SPFileType);
                            }
                            else
                            {
                                MessageBox.Show("Error during while trying to add the file to SharePoint. Error: " + tmpOncDocMgr.RetErrMessage, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(m_igtApplication.ApplicationWindow, "Ad hoc plots may only be attached to a Permit or Easement feature.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                m_igtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Attach Site Drawing Command has ended.");
                m_igtApplication.EndWaitCursor();
            }
            catch (Exception ex)
            {
                m_igtApplication.EndWaitCursor();
                MessageBox.Show("Error during execution of Attach Site Drawing custom command" + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                m_igtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Attach Site Drawing Command has ended with errors.");
            }
        }