コード例 #1
0
ファイル: ManageNonLocatedSTLT.cs プロジェクト: git786hub/DLL
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEditStreetLight_Click(object sender, EventArgs e)
 {
     _gtKeyEditObj = null;
     if (dtGridViewNonLocated.SelectedRows.Count > 0)
     {
         try
         {
             var obj = (StreetLightNonLocated)dtGridViewNonLocated.SelectedRows[0].DataBoundItem;
             if (obj != null)
             {
                 btnEditStreetLight.Enabled = false;
                 btnStructure.Enabled       = false;
                 btnSave.Enabled            = false;
                 if (obj.EntityState != EntityMode.Add)
                 {
                     _gtTransactionManager.Begin("Edit Street Light " + obj.G3eFid);
                     _gtKeyEditObj = _gtApp.DataContext.OpenFeature(obj.G3efno, obj.G3eFid);
                     _gtFeatureExplorerSrvc.ExploreFeature(_gtKeyEditObj, "Edit");
                     _gtFeatureExplorerSrvc.Visible = true;
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error while editing feature " + ex.Message);
             _gtTransactionManager.Rollback();
         }
     }
 }
コード例 #2
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                #region Perform validations
                m_oGTCustomCommandHelper = CustomCommandHelper;
                m_oGTTransactionManager.Begin(" begin Repeat reconductoring...");
                if (CheckIfNonWrJob())
                {
                    ExitCommand();
                    MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>();
                List <int>       fidList         = new List <int>();
                m_ooddcKeyObjects = m_iGtApplication.SelectedObjects.GetObjects();
                foreach (IGTDDCKeyObject ddcKeyObject in m_ooddcKeyObjects)
                {
                    if (!fidList.Contains(ddcKeyObject.FID))
                    {
                        fidList.Add(ddcKeyObject.FID);
                        selectedObjects.Add(ddcKeyObject);
                    }
                }
                m_originalObject = selectedObjects[0];

                if (!CheckIfConductorFeature())
                {
                    ExitCommand();
                    MessageBox.Show("This command only applies to conductors.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (!ValidateFeatureState())
                {
                    ExitCommand();
                    MessageBox.Show("Select a PPX conductor span from which to copy reconductoring information.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                #endregion
                SubscribeEvents();
                CheckFeatureAndGetCno();
                ReadCUsWithActivity();
            }
            catch (Exception ex)
            {
                ExitCommand();
                MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_oGTApp = GTClassFactory.Create <IGTApplication>();
                m_oGTCustomCommandHelper = CustomCommandHelper;

                if (Validate())
                {
                    if (m_oGTExplorerService == null)
                    {
                        m_oGTExplorerService = GTClassFactory.Create <IGTFeatureExplorerService>(m_oGTCustomCommandHelper);
                    }

                    m_oGTExplorerService.Slide(true);

                    if (m_oGTPlacementService == null)
                    {
                        m_oGTPlacementService = GTClassFactory.Create <IGTFeaturePlacementService>(m_oGTCustomCommandHelper);
                    }

                    if (!m_oGTTransactionManager.TransactionInProgress)
                    {
                        m_oGTTransactionManager.Begin("Tree Trimming Request Estimate");
                    }

                    m_oStatusBarMessage = "Draw a polygon encompassing all affected Work Points";

                    SubscribeEvents();

                    m_oGTTreeTrimmingfeature = m_oGTApp.DataContext.NewFeature(190);
                    m_oGTPlacementService.StartFeature(m_oGTTreeTrimmingfeature);
                }
                else
                {
                    ExitCommand();
                }
            }
            catch (Exception ex)
            {
                m_oGTExplorerService_CancelClick(null, EventArgs.Empty);
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                MessageBox.Show("Error in TreeTrim Request Estimate command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ExitCommand();
            }
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
        /// <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();
            }
        }
コード例 #6
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();
            }
        }
コード例 #7
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();
            }
        }
コード例 #8
0
ファイル: ccRequestESILocation.cs プロジェクト: git786hub/DLL
 /// <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");
     //}
 }
コード例 #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;
            }
        }
コード例 #10
0
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                customCommandHelper = CustomCommandHelper;
                if (transactionManager != null)
                {
                    transactionManager.Begin("Blanket Unitization");
                    selectedFeatures = gtApp.SelectedObjects.GetObjects();
                    bool   oneFeatureType = true;
                    short  fnoChecker;
                    string errorMessage = "";
                    if (selectedFeatures.Count > 1)
                    {
                        fnoChecker = selectedFeatures[0].FNO;
                        foreach (IGTDDCKeyObject feature in selectedFeatures)
                        {
                            if (fnoChecker != feature.FNO)
                            {
                                oneFeatureType = false;
                                errorMessage   = "Multiple feature types selected, please retry command after selecting features of the same type.";
                            }
                        }
                    }

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

                        case g_Gaurd_Light_FNO:
                            guardLightHandler();
                            break;

                        default:
                            MessageBox.Show("Invalid feature selected, please select a service line, secondary box, or guard light.");
                            break;
                        }
                        customCommandHelper.Complete();
                    }
                    else
                    {
                        MessageBox.Show(errorMessage, "GTechnology");
                        customCommandHelper.Complete();
                    }
                }
            }catch (Exception e)
            {
                MessageBox.Show("Error in ccFieldActivity.Activate " + e.Message + ".");
                transactionManager.Rollback();
                customCommandHelper.Complete();
            }
        }
コード例 #11
0
        /// <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;
            }
        }
コード例 #12
0
        /// <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);
        }
コード例 #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;
            }
        }
コード例 #14
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);
        }
コード例 #15
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;
            }
        }
コード例 #16
0
ファイル: ccRemoveFeature.cs プロジェクト: git786hub/DLL
        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;
            }
        }
コード例 #17
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();
        }
コード例 #18
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);
        }
コード例 #19
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();
        }
コード例 #20
0
ファイル: ccUpdateTrace.cs プロジェクト: git786hub/DLL
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_Application.BeginWaitCursor();
                // Get feature number and feature identifier for feature in select set
                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                short fno = oGTDCKeys[0].FNO;
                int   fid = oGTDCKeys[0].FID;

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

                m_TransactionManager.Begin("Update Trace");

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

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

            CustomCommandHelper.Complete();
        }
コード例 #21
0
        private void btnAttach_Click(object sender, EventArgs e)
        {
            OncDocManage.OncDocManage SpDocMan = new OncDocManage.OncDocManage();
            Recordset tmpRs  = null;
            string    tmpQry = string.Empty;

            try
            {
                //File validation
                if (string.IsNullOrEmpty(txtFile.Text) || !File.Exists(txtFile.Text))
                {
                    MessageBox.Show(m_igtApplication.ApplicationWindow, "Valid file is not selected.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    UpdateStatus("Attach Job Document process started.");
                    DialogResult dialogResult = MessageBox.Show(m_igtApplication.ApplicationWindow, m_commonMessages.AttachDialog, "G/Technology", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (dialogResult == DialogResult.OK)
                    {
                        IGTKeyObject m_designAreaObj;
                        #region Adding Hyperlink
                        try
                        {
                            try
                            {
                                UpdateStatus("Adding the file to SharePoint");
                                m_igtApplication.BeginWaitCursor();
                                // add file to sharepoint.
                                // get the WR_NBR
                                tmpQry = "Select j.WR_NBR from DESIGNAREA_P da, g3e_job j " +
                                         "where da.JOB_ID = j.G3E_IDENTIFIER and da.g3e_fid = " + m_designAreaFID.ToString();
                                tmpRs = m_igtApplication.DataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic,
                                                                                   LockTypeEnum.adLockReadOnly,
                                                                                   (int)CommandTypeEnum.adCmdText);
                                if (!(tmpRs.BOF && tmpRs.EOF))
                                {
                                    tmpRs.MoveFirst();
                                    SpDocMan.WrkOrd_Job = tmpRs.Fields[0].Value.ToString();
                                    tmpRs = null;
                                }
                                else
                                {
                                    MessageBox.Show(m_igtApplication.ApplicationWindow, "The WR number was not found in the Job table.", "Attach Job Document - Error ", MessageBoxButtons.OK);
                                    if (tmpRs != null)
                                    {
                                        tmpRs = null;
                                    }
                                    return;
                                }

                                // Get the Document Management metadata parameters.
                                tmpQry = "select param_name, param_value from SYS_GENERALPARAMETER " +
                                         "where subsystem_name = 'Doc_Management'";
                                tmpRs = m_igtApplication.DataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenStatic,
                                                                                   LockTypeEnum.adLockReadOnly,
                                                                                   (int)CommandTypeEnum.adCmdText);
                                // Set the OncDocManage class properties
                                if (!(tmpRs.BOF && tmpRs.EOF))
                                {
                                    tmpRs.MoveFirst();
                                    for (int i = 0; i < tmpRs.RecordCount; ++i)
                                    {
                                        if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "ROOT_PATH")
                                        {
                                            SpDocMan.SPRootPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                                        }
                                        if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "SP_URL")
                                        {
                                            SpDocMan.SPSiteURL = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                                        }
                                        if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "JOBWO_REL_PATH")
                                        {
                                            SpDocMan.SPRelPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString();
                                        }
                                        tmpRs.MoveNext();
                                    }
                                }
                                SpDocMan.SPFileDescription = txtDescription.Text;
                                SpDocMan.SrcFilePath       = txtFile.Text;
                                SpDocMan.SPFileType        = cmbType.Text;
                                // Add the file to SharePoint.
                                if (!SpDocMan.AddSPFile(true))
                                {
                                    System.ArgumentException SPExcept = new System.ArgumentException("File was not saved in SharePoint.");
                                }
                            }
                            catch (Exception ex)
                            {
                                m_igtApplication.EndWaitCursor();
                                MessageBox.Show(m_igtApplication.ApplicationWindow, "Unable to copy the file to SharePoint. Error: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                            // Add the hyperlink to the Design Area feature.
                            UpdateStatus("Adding the Hyperlink to the Design Area.");
                            // Begin the GTech transaction.
                            m_igtranscation.Begin("IN PROGRESS");
                            // open the Design Area feature.
                            m_designAreaObj = m_igtApplication.DataContext.OpenFeature(8100, m_designAreaFID);
                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.AddNew("G3E_FID", m_designAreaFID);
                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["HYPERLINK_T"].Value   = SpDocMan.RetFileURL;
                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["DESCRIPTION_T"].Value = txtDescription.Text;
                            // Add a new hyperlink component instance
                            if (cmbType.Text.Length > m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize)
                            {
                                m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value =
                                    cmbType.Text.Substring(0, m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].DefinedSize);
                            }
                            else
                            {
                                m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["TYPE_C"].Value = cmbType.Text;
                            }

                            // Add the file name to the hyperlink table.
                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["FILENAME_T"].Value = SpDocMan.RetFileName;

                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Fields["G3E_FNO"].Value = 8100;
                            m_designAreaObj.Components["JOB_HYPERLINK_N"].Recordset.Update();
                            // end the GTech transaction.
                            if (m_igtranscation.TransactionInProgress)
                            {
                                m_igtranscation.Commit();
                            }
                            MessageBox.Show(m_igtApplication.ApplicationWindow, "Attach Job Document Completed sucessfully.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            UpdateStatus("Attach Job Document Completed sucessfully.");
                            this.Close();
                        }
                        catch (Exception ex)
                        {
                            // if the GTec transaction fails, rollback the edit and exit the command.
                            tmpQry = ex.Message;
                            if (m_igtranscation.TransactionInProgress)
                            {
                                m_igtranscation.Rollback();
                            }
                            m_igtApplication.EndWaitCursor();
                            throw;
                        }
                        finally
                        {
                            m_designAreaObj = null;
                        }
                        m_igtApplication.EndWaitCursor();
                        #endregion Adding Hyperlink
                    }
                }
            }
            catch (Exception)
            {
                m_igtApplication.EndWaitCursor();
                throw;
            }
        }
コード例 #22
0
ファイル: csGlobals.cs プロジェクト: git786hub/DLL
        /// <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);
        }
コード例 #23
0
ファイル: ccAbandonFeature.cs プロジェクト: git786hub/DLL
        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;
            }
        }
コード例 #24
0
ファイル: PostJob.cs プロジェクト: git786hub/DLL
        /// <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);
            }
        }
コード例 #25
0
 public void placeServiceLine()
 {
     gtTransactionManager.Begin("Service Line Placement");
     serviceLine = dataContext.NewFeature(g_Service_Line_FNO);
     featurePlacementService.StartFeature(serviceLine);
 }
コード例 #26
0
ファイル: EmbeddedDT.cs プロジェクト: git786hub/DLL
        // 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);
                }
            }
        }
コード例 #27
0
ファイル: GISAuto_DEIS.cs プロジェクト: git786hub/DLL
        /// <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);
        }
コード例 #28
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;
                }
            }
        }
コード例 #29
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();
                }
            }
        }
コード例 #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;
            }
        }