Example #1
0
 /// <summary>
 /// Kicks off the process to start ending our command process, and commits the transaction.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void saveClick(object sender, EventArgs e)
 {
     m_gtApp.BeginWaitCursor();
     gtTransactionManager.Commit();
     featureExplorerService.Visible = featureExplorerVisible;
     customCommandHelper.Complete();
     m_gtApp.EndWaitCursor();
 }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            stltNonLocatedCtx.MiscStructG3eFid = streetLightAcct.MiscStructFid;
            if (this.streetLights.Where <StreetLightNonLocated>(s => s.EntityState != EntityMode.Review).Count() > 0)
            {
                _gtTransactionManager.Begin("Saving Street Light(s)");
                try
                {
                    // ALM 2044 - Set the CU for the current street light.
                    // The same customer-owned CU will apply to all non-located lights for the active account.
                    // If there's not a customer-owned CU for this account, then allow the user to exit the save operation.
                    string CU = CommonUtil.CustomerOwnedSteetLightCU(this.streetLightAcct.LAMP_TYPE, this.streetLightAcct.Wattage, this.streetLightAcct.LUMINARE_STYLE);

                    if (string.IsNullOrEmpty(CU))
                    {
                        string msg = string.Format("A unique customer-owned CU was not found where Lamp Type = {0} and Wattage = {1} and Luminaire Style = {2}.{3}{3}Continue?", this.streetLightAcct.LAMP_TYPE, this.streetLightAcct.Wattage, this.streetLightAcct.LUMINARE_STYLE, Environment.NewLine);

                        if (DialogResult.No == MessageBox.Show(msg, "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                        {
                            return;
                        }
                    }
                    //Save the Street Light Boundary
                    _gtApp.BeginWaitCursor();
                    foreach (StreetLightNonLocated streetLight in this.streetLights.Where <StreetLightNonLocated>(s => s.EntityState != EntityMode.Review))
                    {
                        if (streetLight.EntityState == EntityMode.Add)
                        {
                            streetLight.LAMP_TYPE      = this.streetLightAcct.LAMP_TYPE;
                            streetLight.LUMINARE_STYLE = this.streetLightAcct.LUMINARE_STYLE;
                            streetLight.Wattage        = this.streetLightAcct.Wattage;
                            streetLight.ESI_LOCATION   = this.streetLightAcct.ESI_LOCATION;
                            streetLight.RATE_CODE      = this.streetLightAcct.RATE_CODE;
                            streetLight.RATE_SCHEDULE  = this.streetLightAcct.RATE_SCHEDULE;
                            streetLight.CU             = this.CU;
                        }
                        stltNonLocatedCtx.SaveStreetLight(streetLight);
                    }
                    _gtTransactionManager.Commit(true);
                    this.streetLights = stltNonLocatedCtx.GetStreetLightByAccountID(this.streetLightAcct.ESI_LOCATION);
                    dtGridViewNonLocated.DataSource = this.streetLights;
                    _gtApp.RefreshWindows();
                    _gtApp.EndWaitCursor();
                    MessageBox.Show("Pending changes committed successfully.", ManageNonLocatedTxt, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    if (_gtTransactionManager.TransactionInProgress)
                    {
                        _gtTransactionManager.Rollback();
                    }
                    _gtApp.EndWaitCursor();
                    MessageBox.Show("Error while Saving Street Light(s): " + ex.Message, ManageNonLocatedTxt, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Mouse double click event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void m_oGTCustomCommandHelper_DblClick(object sender, GTMouseEventArgs e)
        {
            try
            {
                m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                if (m_selectedObjects.Count == 0)
                {
                    MessageBox.Show("No target features were selected.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ExitCommand();
                    return;
                }
                if (m_ofrmCopyAncillaryCUs != null) // Initial feature has ACUs
                {
                    m_iGtApplication.BeginWaitCursor();
                    if (m_ofrmCopyAncillaryCUs.CanDeleteAllExistigAcus)
                    {
                        DeleteExistingACUs();
                    }
                    if (m_ofrmCopyAncillaryCUs.CuInformationList.Count > 0)
                    {
                        CopySourceACUsToTargetFeature();
                        if (CheckForCorrectionModeProperty())
                        {
                            RemoveCorrectionModeProperty();
                        }
                    }
                }
                else // Initial feature no ACUs and user selected to go ahead and delete ACUs from target
                {
                    DeleteExistingACUs();
                }
                m_oGTTransactionManager.Commit();
                m_oGTTransactionManager.RefreshDatabaseChanges();

                SynchronizeWP();
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                MessageBox.Show("Error during execution of Copy Ancillaries custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
            finally
            {
                m_iGtApplication.EndWaitCursor();
                ExitCommand();
            }
        }
Example #4
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();
            }
        }
 public bool DisplayBoundaryErrorExecute(Recordset RS)
 {
     if (m_Components[ComponentName].Recordset.EOF)
     {
         m_Components[ComponentName].Recordset.MoveFirst();
     }
     if (!(RS.RecordCount > 0) && jobManager.JobStatus.ToUpper() == "NON-WR") //if job status is non-wr, then value is reset and a slightly different error message is displayed.
     {
         app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "GRAPHIC EDIT REJECTED: Street Light is located outside the associated Street Light Account boundary.");
         //reset g3e_geometry field to value before change
         string fno = m_Components[m_ComponentName].Recordset.Fields["G3E_FNO"].Value.ToString();
         string fid = m_Components[m_ComponentName].Recordset.Fields["G3E_FID"].Value.ToString();
         gTransMgr.Begin("Resetting Geometry Value");
         string SQL = "update B$STREETLIGHT_T set G3E_GEOMETRY = ? where G3E_FNO = ? and G3E_FID = ?";
         m_DataContext.Execute(SQL, out int RecordsAffected, (int)ADODB.CommandTypeEnum.adCmdText, FieldValueBeforeChange, fno, fid);
         gTransMgr.Commit();
         return(true);
     }
     else if (!(RS.RecordCount > 0))
     {
         app.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "ACCOUNT # CONFLICT: Street Light is located outside the associated Street Light Account boundary.");
         return(true);
     }
     else
     {
         return(false);
     }
 }
        /// <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();
            }
        }
        /// <summary>
        /// Execute Procudure to Purge Expired Archived Landbase
        /// </summary>
        private void PurgeLandbase()
        {
            ADODB.Recordset rs          = null;
            string          sqlStmt     = "Begin LBM_UTL.PurgeExpiredArchivedLandbase; end;";
            string          mergeStatus = string.Empty;

            try
            {
                gtTransactionManager.Begin("Purge Expired Landbase");
                gtApp.BeginWaitCursor();
                rs = Execute(sqlStmt);
                gtTransactionManager.Commit();
            }
            catch (Exception ex)
            {
                gtTransactionManager.Rollback();
                throw ex;
            }
            finally
            {
                rs = null;
                gtTransactionManager.RefreshDatabaseChanges();
                gtApp.RefreshWindows();
                gtApp.EndWaitCursor();
            }
        }
Example #8
0
 public void Terminate()
 {
     transactionManager.Commit();
     transactionManager  = null;
     dataContext         = null;
     customCommandHelper = null;
 }
Example #9
0
        public void Activate()
        {
            string           featureState    = string.Empty;
            List <int>       fidList         = new List <int>();
            IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();

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

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

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

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

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

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

                m_iGtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Selected features were transitioned successfully.");
            }
            catch (Exception ex)
            {
                m_TransactionManager.Rollback();
                MessageBox.Show("Error during execution of Complete Feature custom command." + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_TransactionManager = null;
            }
        }
Example #10
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");
     //}
 }
        /// <summary>
        /// Method to delete StreetLight.
        /// </summary>
        /// <param name="streetLightAttributeRS">Recordset of StreetLight Attribute</param>
        /// <param name="locatable">Bool value whether StreetLight is Located to delete</param>
        /// <returns></returns>
        private void DeleteStreetLight(Recordset streetLightAttributeRS, bool locatable)
        {
            IGTKeyObjects relatedFeatures = GTClassFactory.Create <IGTKeyObjects>();
            IGTKeyObjects deleteFeatures  = GTClassFactory.Create <IGTKeyObjects>();
            IGTKeyObject  feature         = GTClassFactory.Create <IGTKeyObject>();

            try
            {
                StreetLightImportUtility importUtility = new StreetLightImportUtility(m_oGTDataContext);

                if (!m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Begin("Importing Street Light(s) using Import Tool");
                }

                if (locatable)
                {
                    streetLightAttributeRS.MoveFirst();

                    feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value));
                    deleteFeatures.Add(feature);

                    relatedFeatures = importUtility.GetRelatedFeatures(feature, 3);
                    if (relatedFeatures.Count > 0)
                    {
                        feature = CheckForMiscellaneousStructure(relatedFeatures, feature.FID);

                        if (feature != null)
                        {
                            deleteFeatures.Add(feature);
                        }
                    }
                }
                else
                {
                    streetLightAttributeRS.MoveFirst();
                    while (!streetLightAttributeRS.EOF)
                    {
                        feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value));
                        deleteFeatures.Add(feature);

                        streetLightAttributeRS.MoveNext();
                    }
                }
                importUtility.DeleteFeatures(deleteFeatures);

                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit(true);
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// Attach html file to the active job.
        /// </summary>
        /// <param name="strJobDoumentsPath">Document Path</param>
        /// <param name="gTDesignAreaKeyObject">Document Path</param>
        /// <param name="strContent">Content of the html document</param>
        /// <param name="strFileName">File name of the html document</param>
        private void AttachFile(string strJobDoumentsPath, IGTKeyObject gTDesignAreaKeyObject, string strContent, string strFileName, bool overRide)
        {
            try
            {
                if (!Directory.Exists(strJobDoumentsPath))
                {
                    Directory.CreateDirectory(strJobDoumentsPath);
                }
                File.WriteAllText(strJobDoumentsPath + "\\" + strFileName, strContent);
            }
            catch
            {
            }

            string strDescription = ActiveWR + "-" + Customer + "-" + "HTML DOCUMENT";

            if (overRide)
            {
                m_oGTTransactionManager.Begin("Supplemental Agreement Forms");
                m_model.DeleteExistingAttachment(strJobDoumentsPath + "\\" + strFileName);
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                }
            }

            m_oGTTransactionManager.Begin("Supplemental Agreement Forms");
            IGTKeyObject gTTempKeyObject = m_view.GTDataContext.OpenFeature(gTDesignAreaKeyObject.FNO, gTDesignAreaKeyObject.FID);
            Recordset    rs = gTTempKeyObject.Components.GetComponent(8130).Recordset;

            rs.AddNew("G3E_FID", gTTempKeyObject.FID);
            rs.Fields["HYPERLINK_T"].Value   = strJobDoumentsPath + "\\" + strFileName;
            rs.Fields["DESCRIPTION_T"].Value = strDescription;
            rs.Fields["TYPE_C"].Value        = "SUPPLEMENT";
            rs.Fields["G3E_FNO"].Value       = 8100;
            rs.Update();
            if (m_oGTTransactionManager.TransactionInProgress)
            {
                m_oGTTransactionManager.Commit();
            }

            MessageBox.Show("The Street Light Supplemental Agreement Form was generated and attached to the WR.", "G/Technology",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #13
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;
            }
        }
Example #14
0
        /// <summary>
        /// Method to exceute the TreeTrimRequestEstimate command.
        /// </summary>
        private void TreeTrimRequestEstimate()
        {
            Recordset               wpRecordset = null;
            ccTreeTrimRequestForm   ccTreeTrimRequestForm;
            VoucherEstimatesUtility estimatesUtility = null;

            try
            {
                estimatesUtility = new VoucherEstimatesUtility(m_oGTApp);

                wpRecordset = estimatesUtility.GetWorkpointRsContainedByTreeTrimming(m_oGTTreeTrimmingfeature);

                if (wpRecordset != null && wpRecordset.RecordCount > 0)
                {
                    ccTreeTrimRequestForm = new ccTreeTrimRequestForm(estimatesUtility.GetWorkPtAccountRecordset(wpRecordset), m_oGTApp, m_oGTTreeTrimmingfeature);
                    ccTreeTrimRequestForm.ShowDialog(m_oGTApp.ApplicationWindow);
                    if (ccTreeTrimRequestForm.ProcessDone && ccTreeTrimRequestForm.CommandExit)
                    {
                        ProcessVoucherEstimates oProcessEstimate = new ProcessVoucherEstimates();
                        oProcessEstimate.UpdateVoucherAttributes(m_oGTTreeTrimmingfeature, ccTreeTrimRequestForm.VoucherAccountVal);

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

                        oProcessEstimate.ProcessEmail(ccTreeTrimRequestForm.RecipientName, ccTreeTrimRequestForm.RecipientEmail, ccTreeTrimRequestForm.VegMngSheetTemplate, ccTreeTrimRequestForm.PlotPDFName, m_oGTApp.DataContext.ActiveJob);

                        ExitCommand();
                    }
                    else
                    {
                        m_oGTExplorerService_CancelClick(null, EventArgs.Empty);
                        ExitCommand();
                    }
                }
                else
                {
                    m_oStatusBarMessage = "No Work Points were found within the polygon; draw a new polygon";
                    m_oGTExplorerService_CancelClick(null, EventArgs.Empty);
                    m_oGTTransactionManager.Begin("TreeTrimRequestEstimate");
                    m_oGTTreeTrimmingfeature = m_oGTApp.DataContext.NewFeature(190);
                    m_oGTPlacementService.StartFeature(m_oGTTreeTrimmingfeature);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (wpRecordset != null)
                {
                    wpRecordset = null;
                }
            }
        }
Example #15
0
        /// <summary>
        /// Create new street light feature.
        /// </summary>
        /// <returns></returns>
        private IGTKeyObject NewStreetLight()
        {
            IGTKeyObject gtStreetLightKObject;

            try
            {
                m_gTTransactionManager.Begin("Importing Street Light(s) using Import Tool");
                gtStreetLightKObject = m_oGTDataContext.NewFeature(56);
                UpdateStreetLightComponents(gtStreetLightKObject);
                EstablishOwnership(gtStreetLightKObject);
                if (m_gTTransactionManager.TransactionInProgress)
                {
                    m_gTTransactionManager.Commit(true);
                }
            }
            catch
            {
                throw;
            }

            return(gtStreetLightKObject);
        }
Example #16
0
        /// <summary>
        /// Method to Export the given plot window to PDF
        /// </summary>
        /// <param name="pw"></param>
        private void ExportToPDF(IGTPlotWindow pw)
        {
            IGTExportService        svcExport  = null;
            IGTPDFPrinterProperties printProps = null;

            try
            {
                // Construct printer properties
                PageOrientationType orientation =
                    (pw.NamedPlot.PaperWidth > pw.NamedPlot.PaperHeight)
                    ? PageOrientationType.Portrait : PageOrientationType.Landscape;

                printProps             = GTClassFactory.Create <IGTPDFPrinterProperties>();
                printProps.PageWidth   = pw.NamedPlot.PaperWidth;
                printProps.PageHeight  = pw.NamedPlot.PaperHeight;
                printProps.Orientation = orientation;
                printProps.PageSize    = PageSizeValue.Auto;
                printProps.Resolution  = ResolutionValue.DPI600;

                // Perform export
                svcExport = GTClassFactory.Create <IGTExportService>();
                svcExport.PDFLayersEnabled = false;
                svcExport.SaveAsPDF(m_strDoumentsPath, printProps, pw, true);

                m_oGTTransactionManager.Begin("Attach Street Light Supplemental Agreement Plot");

                IGTKeyObject gTTempKeyObject = m_gTDataContext.OpenFeature(m_gTDesignAreaKeyObject.FNO, m_gTDesignAreaKeyObject.FID);
                Recordset    rs = gTTempKeyObject.Components.GetComponent(8130).Recordset;

                rs.AddNew("G3E_FID", gTTempKeyObject.FID);
                rs.Fields["HYPERLINK_T"].Value   = m_strDoumentsPath;
                rs.Fields["DESCRIPTION_T"].Value = "Street Supplemental Plot";
                rs.Fields["TYPE_C"].Value        = "SUPPLEPLOT";
                rs.Fields["G3E_FNO"].Value       = 8100;
                rs.Update();
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                svcExport  = null;
                printProps = null;
                pw         = null;
            }
        }
Example #17
0
        void m_oGTCustomCommandHelper_Click(object sender, GTMouseEventArgs e)
        {
            try
            {
                if (e.Button == 1)
                {
                    foreach (Recordset rs in m_oRSList)
                    {
                        UpdateActivity(rs, "R", false);
                    }
                }
                else if (e.Button == 2)
                {
                    foreach (Recordset rs in m_oRSList)
                    {
                        UpdateActivity(rs, "S", false);
                    }
                }

                // Commit the transaction to reflect the WR_EDITED when set by the trigger
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit();
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }

                //  Begin a new transaction to process WP synchronization
                m_oGTTransactionManager.Begin(" WP synchronization...");

                SynchronizeWP();

                ExitCommand();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #18
0
        private void UpdatePoles()
        {
            transactionManager.Begin("Update Poles in LIP");
            string    poleQuery = "SELECT * FROM POLE_N INNER JOIN NJUNS_TICKET_N WHERE POLE_N.G3E_FID = NJUNS_TICKET_N.G3E_FID WHERE POLE_N.LTT_STATUS = ?";
            Recordset LIPPoles  = gtDataContext.OpenRecordset(poleQuery, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic, -1, "LIP");

            if (!LIPPoles.BOF && !LIPPoles.EOF)
            {
                LIPPoles.MoveFirst();
                while (!LIPPoles.EOF)
                {
                    DeleteFeature(Convert.ToInt16(LIPPoles.Fields["G3E_FNO"].Value), Convert.ToInt32(LIPPoles.Fields["G3E_FID"].Value));
                    LIPPoles.MoveNext();
                }
            }
            transactionManager.Commit();
        }
Example #19
0
        private Boolean AddHyperlink(int p_DesignAreaFid, OncDocManage.OncDocManage p_DocMan)
        {
            Boolean      tmpRetVal = false;
            IGTKeyObject tmpKeyObj = null;
            string       SpDocType = "Construction Redlines";

            try
            {
                TransManager.Begin("Add Hyperlink to Design Area");

                tmpKeyObj = gtApp.DataContext.OpenFeature(8100, p_DesignAreaFid);
                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.AddNew("G3E_FID", p_DesignAreaFid);
                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["HYPERLINK_T"].Value   = p_DocMan.RetFileURL;
                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["DESCRIPTION_T"].Value = p_DocMan.SPFileDescription;
                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["FILENAME_T"].Value    = p_DocMan.RetFileName;

                if (SpDocType.Length > tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize)
                {
                    tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value =
                        SpDocType.Substring(0, tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize);
                }
                else
                {
                    tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value = SpDocType;
                }

                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["G3E_FNO"].Value = 8100;
                tmpKeyObj.Components["JOB_HYPERLINK_N"].Recordset.Update();
                if (TransManager.TransactionInProgress)
                {
                    TransManager.Commit();
                }

                tmpRetVal = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "AddHyperlink - Error", MessageBoxButtons.OK);
                tmpRetVal = false;
            }
            return(tmpRetVal);
        }
Example #20
0
        /// <summary>
        /// Merge Selected landbase Boundaries
        /// </summary>
        /// <param name="g3eFno_trg"></param>
        /// <param name="g3eFid_trg"></param>
        /// <param name="g3eFno_src"></param>
        /// <param name="g3eFid_src"></param>
        private void MergeLandbaseBoundary(int g3eFno_trg, int g3eFid_trg, int g3eFno_src, int g3eFid_src)
        {
            ADODB.Recordset rs          = null;
            string          sqlStmt     = "Begin LBM_UTL.MergeLandbaseBoundaries({0},{1},{2},{3}); end;";
            string          mergeStatus = string.Empty;

            try
            {
                gtTransactionManager.Begin("Merging Landbase Boundries");
                rs = Execute(string.Format(sqlStmt, g3eFno_trg, g3eFid_trg, g3eFno_src, g3eFid_src));
                gtTransactionManager.Commit();
            }
            catch (Exception ex)
            {
                gtTransactionManager.Rollback();
                throw ex;
            }
            finally
            {
                rs = null;
            }
            gtTransactionManager.RefreshDatabaseChanges();
        }
Example #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_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();
        }
Example #22
0
        /// <summary>
        /// Calls methods to validate and process the transaction.
        /// </summary>
        /// <returns>Boolean indicating status</returns>
        private bool ProcessTransaction()
        {
            bool returnValue = false;

            try
            {
                // Validate the transaction
                ValidateDEIS validateDEIS = new ValidateDEIS(m_Application.DataContext);
                if (!validateDEIS.ValidateTransaction())
                {
                    // Merge status and message, so status can be set to 'COMPLETE'. This is needed for WARNINGs.
                    TransactionDEIS.TransactionMessage = TransactionDEIS.TransactionStatus + " - " + TransactionDEIS.TransactionMessage;
                    TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_COMPLETE;
                    return(false);
                }

                // If validation passes then call processing method
                m_TransactionManager.Begin("Process DEIS Transaction");
                ProcessDEIS processDEIS = new ProcessDEIS(m_Application.DataContext);

                if (!processDEIS.Process())
                {
                    // Merge status and message, so status can be set to 'COMPLETE'. This is needed for WARNINGs.
                    TransactionDEIS.TransactionMessage = TransactionDEIS.TransactionStatus + " - " + TransactionDEIS.TransactionMessage;
                    TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_COMPLETE;
                    m_TransactionManager.Rollback();
                    return(false);
                }

                m_TransactionManager.Commit();

                // If success or warning then post job edits.
                string message = string.Empty;
                if (!PostJobEdits(out message))
                {
                    // Merge status and message, so status can be set to 'COMPLETE'. This is needed for WARNINGs.
                    TransactionDEIS.TransactionMessage = TransactionDEIS.TransactionStatus + " - " + TransactionDEIS.TransactionMessage;
                    TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_COMPLETE;
                    return(false);
                }

                if (TransactionDEIS.TransactionMessage.Length > 0)
                {
                    // Merge status and message, so status can be set to 'COMPLETE'. This is needed for WARNINGs.
                    TransactionDEIS.TransactionMessage = TransactionDEIS.TransactionStatus + " - " + TransactionDEIS.TransactionMessage;
                }
                else
                {
                    TransactionDEIS.TransactionMessage = TransactionDEIS.TRANS_STATUS_SUCCESS;
                }

                TransactionDEIS.TransactionStatus = TransactionDEIS.TRANS_STATUS_COMPLETE;
            }
            catch (Exception ex)
            {
                if (m_TransactionManager.TransactionInProgress)
                {
                    m_TransactionManager.Rollback();
                }
                TransactionDEIS.TransactionStatus  = TransactionDEIS.TRANS_STATUS_FAILED;
                TransactionDEIS.TransactionMessage = "Error processing transaction: " + ex.Message;
                returnValue = false;
            }

            return(returnValue);
        }
Example #23
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();
                }
            }
        }
Example #24
0
        public void Activate()
        {
            string featureState = string.Empty;
            string jobStatus    = string.Empty;

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

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

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

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

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



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

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

                // Sync work point in a new transaction

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

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

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

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

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

                    m_iGtApplication.ActiveMapWindow.HighlightedObjects.AddSingle(m_selectedObject);

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

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

                        m_iGtApplication.EndWaitCursor();
                        m_iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Identify next span to changeout wires; double-click to exit.");
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                ExitCommand();
                MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                m_iGtApplication.EndWaitCursor();
            }
        }
Example #26
0
        /// <summary>
        /// Updates a Component for a given feature. The Data from the component is passed into the Function as a DataGridViewRow
        /// </summary>
        /// <param name="row">DataGridViewRow</param>
        /// <param name="feature">IGTKeyObject</param>
        /// <param name="fid">int</param>
        /// <param name="fno">short</param>
        /// <param name="wirelineOrEquipment">string</param>
        /// <returns></returns>
        internal static Boolean updateComponent(DataGridViewRow row,
                                                int fid, short fno, int cid,
                                                string p_CompCd,
                                                string p_Maint1,
                                                string p_Maint2,
                                                string wirelineOrEquipment)
        {
            IGTKeyObject feature   = null;
            Boolean      tmpRetVal = true;

            try
            {
                tmpRetVal = true;
                // Begin the transaction
                gTransMgr.Begin("Update Feature");
                // Open the structure feature.
                feature = gDataCont.OpenFeature(fno, fid);
                // get to the correct attachment component and find the correct attachment record.
                feature.Components[wirelineOrEquipment].Recordset.Filter = "G3E_CID = " + cid;
                feature.Components[wirelineOrEquipment].Recordset.MoveFirst();

                // update the record.
                if (wirelineOrEquipment.Equals("ATTACH_WIRELINE_N"))
                {
                    object[] tmpCols = { "G3E_FID",            "G3E_FNO",             "W_ATTACH_COMPANY",
                                         "W_MAINTAINER_1",     "W_MAINTAINER_2",      "W_PERMIT_NUMBER",
                                         "W_ATTACH_HEIGHT_FT", "W_ATTACHMENT_STATUS",
                                         "W_ATTACH_SOURCE_C",  "W_MESSENGER_C",       "W_ATTACH_TYPE", "W_ATTACH_POSITION" };
                    object[] tmpVals = { fid,                                             fno, p_CompCd, p_Maint1, p_Maint2,
                                         row.Cells["Permit Number"].Value,
                                         row.Cells["Attachment Height"].Value,
                                         row.Cells["Attachment Status"].Value.ToString(),
                                         row.Cells["Attachment Source"].Value.ToString(),
                                         row.Cells["Messenger"].Value.ToString(),
                                         row.Cells["Attachment Type"].Value.ToString(),
                                         row.Cells["Attachment Position"].Value.ToString() };

                    feature.Components[wirelineOrEquipment].Recordset.Update(tmpCols, tmpVals);

                    if (row.Cells["Initial String Tension (lbs)"].Value == null ||
                        row.Cells["Initial String Tension (lbs)"].Value.ToString().Equals("") ||
                        row.Cells["Initial String Tension (lbs)"].Value.ToString().Equals(" "))
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["W_INIT_STR_TENSION"].Value = DBNull.Value;
                    }
                    else
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["W_INIT_STR_TENSION"].Value =
                            Convert.ToInt16(row.Cells["Initial String Tension (lbs)"].Value.ToString());
                    }

                    if (row.Cells["Outside Diameter (inches)"].Value.ToString() == null ||
                        row.Cells["Outside Diameter (inches)"].Value.ToString().Trim() == "")
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["W_OUTSIDE_DIAM"].Value = DBNull.Value;
                    }
                    else
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["W_OUTSIDE_DIAM"].Value =
                            Convert.ToInt16(row.Cells["Outside Diameter (inches)"].Value.ToString());
                    }
                }
                else
                {
                    feature.Components[wirelineOrEquipment].Recordset.MoveFirst();
                    object[] tmpCols = { "G3E_FID", "G3E_FNO", "E_ATTACH_COMPANY", "E_MAINTAINER_1", "E_MAINTAINER_2", "E_PERMIT_NUMBER", "E_ATTACH_HEIGHT_FT", "E_ATTACHMENT_STATUS", "E_ATTACH_SOURCE_C", "E_ATTACH_TYPE_C", "E_ATTACH_POSITION_C", "E_BRACKET_ARM" };
                    object[] tmpVals = { fid,                                               fno, p_CompCd, p_Maint1, p_Maint2, row.Cells["Permit Number"].Value.ToString(),
                                         row.Cells["Attachment Height"].Value.ToString(),
                                         row.Cells["Attachment Status"].Value.ToString(),
                                         row.Cells["Attachment Source"].Value.ToString(),
                                         row.Cells["Attachment Type"].Value.ToString(),
                                         row.Cells["Attachment Position"].Value.ToString(),
                                         row.Cells["Bracket"].Value.ToString() };

                    feature.Components[wirelineOrEquipment].Recordset.Update(tmpCols, tmpVals);
                    if (row.Cells["Weight (lbs/ft)"].Value.ToString().Equals("") || row.Cells["Weight (lbs/ft)"].Value.ToString().Equals(" ") || row.Cells["Weight (lbs/ft)"].Value == null)
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["E_WEIGHT"].Value = DBNull.Value;
                    }
                    else
                    {
                        feature.Components[wirelineOrEquipment].Recordset.Fields["E_WEIGHT"].Value =
                            Convert.ToInt16(row.Cells["Weight (lbs/ft)"].Value.ToString());
                    }
                }
                // commit the transaction.
                gTransMgr.Commit();
                row.Cells["Process Status"].Value = "Existing Attachment - Updated";
            }
            catch (Exception e)
            {
                tmpRetVal = false;
                gTransMgr.Rollback();
                row.Cells["Process Status"].Value = "Error while updating Attachment: " + e;
                // MessageBox.Show(gApp.ApplicationWindow, "updateComponent:" + e.Message, "Import Attachments - Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            return(tmpRetVal);
        }
Example #27
0
        /// <summary>
        /// Entry point for the Custom Command Modal interface.
        /// </summary>
        public void Activate()
        {
            try
            {
                // Check for out of synch WPs and exit if they are not synchronized
                SharedWriteBackLibrary swbl = new SharedWriteBackLibrary();
                if (!swbl.ValidateWorkPoints())
                {
                    return;
                }

                TransactionManager.Begin("Post Job");

                // PendingEditsExist builds this recordset and we can use it again in
                // ValidateNetworkDrawings to keep from querying for it again there.
                Recordset pendingEdits = null;

                // If there are no pending edits, then nothing else to do here.
                // PendingEditsExist will close/null the recordset object if there are no pending edits.
                if (!PendingEditsExist(ref pendingEdits))
                {
                    MessageBox.Show("There are no pending edits in the active job.  Exiting command.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                // Validate pending job edits
                if (!ResolveJobValidationErrors())
                {
                    return;
                }

                // Perform Job Validations.  Return if any fail.
                if (!JobAttributesAreValid)
                {
                    return;
                }

                // Check for existing conflicts
                if (ConflictsExist())
                {
                    return;
                }



                // Allow user to validate the pertinent network drawings attached to the active job.
                // ValidateNetworkDrawings will close/null the recordset object when finished with it.
                if (!ValidateNetworkDrawings(ref pendingEdits))
                {
                    return;
                }

                TransactionManager.Commit(true);

                // Post edits for active job
                if (!PostJobEdits())
                {
                    return;
                }

                // Since nothing else is updated in this command from here to the end,
                // a transaction here should not be necessary; however, leaving it just in case.
                TransactionManager.Begin("Post Job");

                // If indicated, then invoke a Writeback
                // ALM 1566 - Requests removal of the check for the write back flag.
                //            Future design change will check for this in a different way
                //            but leaving the clause in the conditional statement for clarity
                //            until that change is implemented.
                JobManager jobManager = new JobManager();

                if (nonWR != jobManager.JobType /*&& jobManager.WriteBackNeeded*/)
                {
                    DoWriteBack(swbl);
                }

                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Commit(true);
                }
            }
            catch (Exception ex)
            {
                if (TransactionManager.TransactionInProgress)
                {
                    TransactionManager.Rollback();
                }

                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }
        }
Example #28
0
        // Save the report to a shared location and hyperlink the report to the selected FID
        // Run validation for Guying
        private void cmdSaveReport_Click(object sender, EventArgs e)
        {
            // Perform validation for Guying
            if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING)
            {
                if (!ValidateGuyingResults())
                {
                    return;
                }
                else
                {
                    foreach (int fid in m_SelectedFIDs)
                    {
                        WriteGuyingResults(fid);
                    }
                }
            }

            string reportFilename = string.Empty;

            if (ExportReport(ref reportFilename))
            {
                try
                {
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ConstantsDT.MESSAGE_REPORT_SAVING);
                    m_Application.BeginWaitCursor();

                    Recordset tmpRs = null;

                    String  tmpQry       = String.Empty;
                    Boolean bSpFileAdded = false;


                    tmpQry = "select param_name, param_value from sys_generalparameter " +
                             "where SUBSYSTEM_NAME = ?";
                    tmpRs = m_Application.DataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic,
                                                                    LockTypeEnum.adLockReadOnly,
                                                                    (int)CommandTypeEnum.adCmdText,
                                                                    "Doc_Management");
                    if (!(tmpRs.BOF && tmpRs.EOF))
                    {
                        tmpRs.MoveFirst();
                        tmpRs.MoveLast();
                        tmpRs.MoveFirst();
                        OncDocManage.OncDocManage rptToSave = new OncDocManage.OncDocManage();
                        while (!tmpRs.EOF)
                        {
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "JOBWO_REL_PATH")
                            {
                                rptToSave.SPRelPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "SP_URL")
                            {
                                rptToSave.SPSiteURL = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "ROOT_PATH")
                            {
                                rptToSave.SPRootPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                            }
                            tmpRs.MoveNext();
                        }
                        rptToSave.SrcFilePath = reportFilename;
                        rptToSave.WrkOrd_Job  = m_Application.DataContext.ActiveJob;
                        rptToSave.SPFileName  = reportFilename.Substring(reportFilename.LastIndexOf("\\") + 1);
                        if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING)
                        {
                            rptToSave.SPFileType = "Guying Program";
                        }
                        else if (m_CommandName == ConstantsDT.COMMAND_NAME_SAG_CLEARANCE)
                        {
                            rptToSave.SPFileType = "Sag Clearance";
                        }
                        else
                        {
                            rptToSave.SPFileType = "";
                        }
                        bSpFileAdded = rptToSave.AddSPFile(true);
                        if (bSpFileAdded == false)
                        {
                            string msg = string.Format("{0}: Error adding {1} to SharePoint.{2}{2}{3}", ConstantsDT.ERROR_REPORT_SAVING, rptToSave.SPFileName, System.Environment.NewLine, rptToSave.RetErrMessage);
                            MessageBox.Show(m_Application.ApplicationWindow, msg, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        tmpRs = null;

                        m_TransactionManager.Begin("New Hyperlink");

                        if (AddHyperlinkComponent(rptToSave.RetFileURL))
                        {
                            if (m_CommandName == ConstantsDT.COMMAND_NAME_GUYING && m_NewGuyScenario)
                            {
                                string sql             = "update g3e_job set guy_scenario_count = ? where g3e_identifier = ?";
                                int    recordsAffected = 0;
                                m_Application.DataContext.Execute(sql, out recordsAffected, (int)CommandTypeEnum.adCmdText, m_GuyScenarioCount, m_Application.DataContext.ActiveJob);
                                m_Application.DataContext.Execute("commit", out recordsAffected, (int)CommandTypeEnum.adCmdText);
                            }

                            m_TransactionManager.Commit();
                        }
                        else
                        {
                            m_TransactionManager.Rollback();
                        }
                    }
                    else
                    {
                        if (m_TransactionManager.TransactionInProgress)
                        {
                            m_TransactionManager.Rollback();
                        }
                        MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " +
                                        "Error finding General Parameters JOBWO_REL_PATH or 'SP_URL",
                                        ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    m_Application.EndWaitCursor();
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                }
                catch (Exception ex)
                {
                    m_Application.EndWaitCursor();
                    m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #29
0
        public void Activate()
        {
            string                  sql            = "SELECT G3E_FID FROM WORKPOINT_N WHERE WR_NBR=:1 AND G3E_FNO=191";
            Recordset               rsValidate     = null;
            int                     jFid           = 0;
            short                   jFno           = 0;
            IGTKeyObject            jKeyObject     = null;
            IGTJobManagementService oJobManagement = GTClassFactory.Create <IGTJobManagementService>();

            oJobManagement.DataContext = m_ogtApplication.DataContext;

            try
            {
                if (ValidateCommand())
                {
                    ADODB.Recordset rsPendingEdits = oJobManagement.FindPendingEdits();
                    if (rsPendingEdits != null && rsPendingEdits.RecordCount > 0)
                    {
                        oJobManagement.DiscardJob(); //ALM 1321 - Automatically discard job at the start and assume that there are no unposted data
                        m_oGTTransactionManager.RefreshDatabaseChanges();
                        m_ogtApplication.RefreshWindows();
                    }

                    rsValidate = m_ogtApplication.DataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly,
                                                                            (int)ADODB.CommandTypeEnum.adCmdText, new object[] { m_ogtApplication.DataContext.ActiveJob });

                    if (rsValidate == null || rsValidate.RecordCount == 0)
                    {
                        return;
                    }

                    m_oGTTransactionManager.Begin("Revert Job");

                    commonRevertAPI rFeature = new commonRevertAPI(m_ogtApplication);
                    rsValidate.MoveFirst();
                    while (!rsValidate.EOF)
                    {
                        jFno = 191;
                        jFid = Convert.ToInt32(rsValidate.Fields["G3E_FID"].Value);

                        jKeyObject = m_ogtApplication.DataContext.OpenFeature(jFno, jFid);

                        rFeature.m_FromJob = "JOB";
                        rFeature.RevertWPFeature(jKeyObject);


                        rsValidate.MoveNext();
                    }

                    if (rFeature.m_uProcessedCUs)
                    {
                        MessageBox.Show("Check remaining Work Points to make manual corrections.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning,
                                        MessageBoxDefaultButton.Button1);
                    }

                    if (m_oGTTransactionManager.TransactionInProgress)
                    {
                        m_oGTTransactionManager.Commit();
                        m_oGTTransactionManager.RefreshDatabaseChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);

                m_oGTTransactionManager.Rollback();
            }
            finally
            {
                if (rsValidate != null)
                {
                    if (rsValidate.State == 1)
                    {
                        rsValidate.Close();
                        rsValidate.ActiveConnection = null;
                    }
                    rsValidate = null;
                }
            }
        }
Example #30
0
        /// <summary>
        /// Method to process the replacement
        /// </summary>
        private void ProcessReplacement()
        {
            try
            {
                DetermineNewFeatureState();
                IdentifyActivity();

                try
                {
                    CreateNewFeature();
                }
                catch (Exception)
                {
                    throw;
                }

                try
                {
                    m_TransactionManager.Begin("Process Old Feature Modification in Replace feature");
                    ModifyExistingFeature();
                    m_TransactionManager.Commit();

                    m_TransactionManager.Begin("WP Synchronization...");
                    IGTKeyObject feature = m_iGtApplication.DataContext.OpenFeature(m_selectedObject.FNO, m_selectedObject.FID);
                    SynchronizeWP(feature);

                    if (m_oIsolationScenario)
                    {
                        oIsolationScenario.UpdateIsolationPointConnectivity(m_selectedObject.FNO, m_selectedObject.FID, oFeatureCreator.m_newFeature);
                    }

                    m_TransactionManager.Commit();
                }
                catch (Exception)
                {
                    m_TransactionManager.Rollback();
                    throw;
                }

                oFeatureCreator.m_modifiedActivityOldFeature = m_modifiedActivityOldFeature;

                try
                {
                    m_TransactionManager.Begin("Process Reowning in Replace feature");
                    if (CheckIfOwnerFeatureAndGetOwnedFeatures())
                    {
                        ReOwnToNewFeatureAndSetActivity();
                    }
                    if (oHelper.CheckForCorrectionModeProperty())
                    {
                        oHelper.RemoveCorrectionModeProperty();
                    }
                    m_TransactionManager.Commit();
                    m_TransactionManager.RefreshDatabaseChanges();

                    if (m_childFeatureInfoList != null)
                    {
                        foreach (ChildFeatureInfo info in m_childFeatureInfoList)
                        {
                            m_TransactionManager.Begin("Process Synchronize WorkPoints in Replace Feature");
                            SynchronizeWP(m_dataContext.OpenFeature(info.GtKeyObject.FNO, info.GtKeyObject.FID));
                            m_TransactionManager.Commit();
                        }
                    }
                }
                catch (Exception)
                {
                    m_TransactionManager.Rollback();
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }