Esempio n. 1
0
        /// <summary>
        /// Set Right Node Values
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativePoint"></param>
        /// <param name="m_gtLineGeometry"></param>
        /// <returns></returns>
        private IGTPoint GetRightOriginPoint(IGTComponents m_gtComponents, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry)
        {
            try
            {
                IGTPoint m_gtRightOriginPoint = null;
                //set the node value  for Bypass point placed at Right
                if ((m_rlnode1 != 0) && (m_rlnode1 == m_rpnode2))
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = m_rlnode1;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, -xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }

                return(m_gtRightOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Get Left Origin Point
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativePoint"></param>
        /// <param name="m_gtLineGeometry"></param>
        /// <returns></returns>
        private IGTPoint GetLeftOriginPoint(IGTKeyObject m_KeyObject, IGTComponents m_gtComponents, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry, IGTKeyObjects m_gtRelativeLines)
        {
            try
            {
                //Get Left Origin Point
                IGTPoint m_gtLeftOriginPoint = null;
                IGTRelationshipService m_gtRelationshipService = GTClassFactory.Create <IGTRelationshipService>();
                m_gtRelationshipService.DataContext = m_gtApplication.DataContext;
                if (m_rlnode2 != 0)
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, xOffset, 0);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();

                    //establish the relationship
                    m_gtRelationshipService.ActiveFeature = m_KeyObject;
                    m_gtRelationshipService.SilentEstablish(iRNO, m_gtRelativeLines[0], GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, -xOffset, 0);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                m_gtRelationshipService = null;
                return(m_gtLeftOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Get Left Origin Point
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativePoint"></param>
        /// <param name="m_gtLineGeometry"></param>
        /// <returns></returns>
        private IGTPoint GetLeftOriginPoint(IGTComponents m_gtComponents, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry, IGTKeyObjects m_gtRelativeLines)
        {
            try
            {
                //Get Left Origin Point
                IGTPoint m_gtLeftOriginPoint = null;
                IGTRelationshipService m_gtRelationshipService = GTClassFactory.Create <IGTRelationshipService>();

                if ((m_gtRelativePoint.FNO == transformerUGFNO) || (m_gtRelativePoint.FNO == AutotransfomerFNO))
                {
                    //establish the connectivity for Relative point with Linear feature
                    EstablishRelationship(m_gtRelativePoint, m_gtRelativeLines);
                }
                else
                {
                    //set the node value for Bypass point placed at top
                    if (m_KeyObjectCollection[1] != null)
                    {
                        m_gtRelationshipService.DataContext   = m_gtApplication.DataContext;
                        m_gtRelationshipService.ActiveFeature = m_KeyObjectCollection[1];
                        m_gtRelationshipService.SilentDelete(iRNO);
                        IGTComponent m_gtBypassComp = m_KeyObjectCollection[1].Components.GetComponent(ConnectivityCNO);
                        m_gtBypassComp.Recordset.Fields["NODE_1_ID"].Value = 0;
                        m_gtBypassComp.Recordset.Fields["NODE_2_ID"].Value = 0;
                        m_gtBypassComp.Recordset.Update();
                    }
                }

                //set the node value  for Bypass point placed at Left
                if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1))
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode2;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, -xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = m_rlnode1;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                m_gtRelationshipService = null;
                return(m_gtLeftOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the values to pre-populate on the report.
        /// </summary>
        /// <param name="fno">G3E_FNO of the selected conductor</param>
        /// <param name="fid">G3E_FID of the selected conductor</param>
        /// <returns>Boolean indicating status</returns>
        private bool GetReportData(short fno, int fid)
        {
            bool returnValue = false;

            try
            {
                string cu       = string.Empty;
                string location = string.Empty;

                if (fid != 0)
                {
                    IGTKeyObject  oGTKey        = m_Application.DataContext.OpenFeature(fno, fid);
                    IGTComponents oGTComponents = oGTKey.Components;
                    Recordset     componentRS   = oGTComponents.GetComponent(ConstantsDT.CNO_COMPUNIT).Recordset;

                    if (componentRS.RecordCount > 0)
                    {
                        cu = componentRS.Fields[ConstantsDT.FIELD_COMPUNIT_CU].Value.ToString();
                    }

                    componentRS = oGTComponents.GetComponent(ConstantsDT.CNO_COMMON).Recordset;

                    if (componentRS.RecordCount > 0)
                    {
                        location = componentRS.Fields[ConstantsDT.FIELD_COMMON_LOCATION].Value.ToString();
                    }
                }

                m_EmbeddedDT.ReportName = ConstantsDT.COMMAND_NAME_SAG_CLEARANCE + " " + m_Application.DataContext.ActiveJob + "-" + fid + ".pdf";

                List <KeyValuePair <string, string> > reportValues = new List <KeyValuePair <string, string> >();

                // Add report values
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_PROJECT, CommonDT.WrDescription));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_LOCATION, location));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_DESIGNER, Environment.UserName));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_DATE, DateTime.Now.ToShortDateString()));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_CONDUCTOR, cu));

                m_EmbeddedDT.ReportValues = reportValues;

                returnValue = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_RETRIEVING_REPORT_DATA + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            return(returnValue);
        }
Esempio n. 5
0
        private void SetStructureID()
        {
            string        sOldFeatureStructureID = string.Empty;
            IGTComponents oldFeatureComponents   = m_dataContext.OpenFeature(m_oldFeature.FNO, m_oldFeature.FID).Components;

            if (oldFeatureComponents.GetComponent(1).Recordset != null)
            {
                if (oldFeatureComponents.GetComponent(1).Recordset.RecordCount > 0)
                {
                    oldFeatureComponents.GetComponent(1).Recordset.MoveFirst();
                    sOldFeatureStructureID = Convert.ToString(oldFeatureComponents.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value);
                    m_newFeature.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value = sOldFeatureStructureID;
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///  Method to check if the feature is an Isolation Scenario feature.
        /// </summary>
        /// <param name="gtComps">IGTComponents used to check for specific attribute values</param>
        /// <param name="fno">Feature number to check</param>
        /// <param name="isIsolationScenario">Indicates if feature takes part in an Isolation Scenario</param>
        /// <param name="isolationScenarioType">Type of Isolation Scenario. Set if isIsolationScenario is true</param>
        /// <returns>Boolean indicating method execution status</returns>
        private bool CheckIsoScenarioFeature(IGTComponents gtComps, short fno, ref bool isIsolationScenario, ref IsolationScenarios isolationScenarioType)
        {
            try
            {
                string feedType = string.Empty;
                if (fno == 59 && gtComps.GetComponent(5901).Recordset != null && gtComps.GetComponent(5901).Recordset.RecordCount > 0)
                {
                    gtComps.GetComponent(5901).Recordset.MoveFirst();
                    feedType = Convert.ToString(gtComps.GetComponent(5901).Recordset.Fields["FEED_TYPE"].Value);
                }
                else if (fno == 60 && gtComps.GetComponent(6002).Recordset != null && gtComps.GetComponent(6002).Recordset.RecordCount > 0)
                {
                    gtComps.GetComponent(6002).Recordset.MoveFirst();
                    feedType = Convert.ToString(gtComps.GetComponent(6002).Recordset.Fields["FEED_TYPE"].Value);
                }

                //ISODUAL
                if (fno == 34) //Autotransformer
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISODUAL;
                }
                //ISOSINGLE
                else if (fno == 4 || fno == 12 || fno == 59 || (fno == 60 && feedType.ToUpper() == "RADIAL"))
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISOSINGLE;
                }
                //ISOSINGLE NETWORK FEATURES
                else if (fno == 99 || fno == 98)
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISOSINGLE;
                }
                //ELBOW
                else if (fno == 5 || (fno == 60 && feedType.ToUpper() == "LOOP"))
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ELBOW;
                }
                //BYPASS
                else if (fno == 14 || fno == 15 || fno == 36)
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.BYPASS;
                }
                else
                {
                    isIsolationScenario = false;
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("Error from Isolation Scenario FI:CheckIsoScenarioFeature: " + ex.Message);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// If the triggering component = CU / Ancillary CU Attributes:Delete the corresponding instance of Work Point CU Attributes.
        /// </summary>
        public void DeleteWorkpointCUInstace(CommonFunctions m_gtcommonFunctions)
        {
            IGTKeyObjects gTOwnerWPKeyObjects = GTClassFactory.Create <IGTKeyObjects>();

            try
            {
                if (m_gtcommonFunctions.IsActiveFeatureIsLinear(m_ActiveKeyObject.FNO))
                {
                    IGTKeyObjects gTOwnerKeyObjects = LocateOwnersOfActiveFeature();

                    if (gTOwnerKeyObjects.Count > 0)
                    {
                        foreach (IGTKeyObject gtOKeyObject in gTOwnerKeyObjects)
                        {
                            gTOwnerWPKeyObjects = FindWorkpointsOfFeature(gtOKeyObject.Components.GetComponent(1));

                            foreach (IGTKeyObject gtWp in gTOwnerWPKeyObjects)
                            {
                                DeleteCUInstanceMatched(gtWp.Components["WORKPOINT_CU_N"]);

                                DeleteWorkpoint(gtWp);
                            }
                        }
                    }
                }
                else
                {
                    gTOwnerWPKeyObjects = FindWorkpointsOfFeature(m_gTComponents.GetComponent(1));

                    foreach (IGTKeyObject gtWp in gTOwnerWPKeyObjects)
                    {
                        DeleteCUInstanceMatched(gtWp.Components["WORKPOINT_CU_N"]);

                        DeleteWorkpoint(gtWp);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 8
0
        public void Execute()
        {
            GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Creating Duct COnfiguration");
            String         valueEntered = "";
            String         sFNO         = "";
            int            FID          = 0;
            int            iHorz        = 0;
            int            iVert        = 0;
            IGTKeyObject   Feature      = null;
            short          FNO          = 0;
            IGTApplication oApp         = GTClassFactory.Create <IGTApplication>();

            try
            {
                //objGlobal.gServices = GTClassFactory.Create<IGTRelationshipService>();
                //objGlobal.gDataCont = DataContext;

                ADODB.Recordset netElementSet = _components.GetComponent(2401).Recordset;
                netElementSet.MoveFirst();
                valueEntered = netElementSet.Fields["CONFIG_C"].Value.ToString();
                sFNO         = netElementSet.Fields["G3E_FNO"].Value.ToString();
                FID          = Convert.ToInt32(netElementSet.Fields["G3E_FID"].Value.ToString());
                FNO          = Convert.ToInt16(sFNO);
                Feature      = DataContext.OpenFeature(FNO, FID);


                ////Validate if the Duct Configuration is defined already
                //csGlobals.gServices.ActiveFeature = Feature;

                //IGTKeyObjects oCollection = GTClassFactory.Create<IGTKeyObjects>();

                //oCollection = csGlobals.gServices.GetRelatedFeatures(csConstant.iContains);

                //if (oCollection != null)
                //{
                //    GTClassFactory.Create<IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                //    MessageBox.Show( " Duct Configuration is alredy defined", "Create Duct Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    netElementSet.Fields["CU_C"].Value = _original.FieldValue.ToString();
                //    return;
                //}
                csGlobals objGlobal = new csGlobals(DataContext, Feature);

                if (sFNO != "2400")
                {
                    GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                    return;
                }

                if (valueEntered == "")
                {
                    GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
                    return;
                }

                else
                {
                    try
                    {
                        Char     Delimiter = 'X';
                        String[] sValues   = valueEntered.Split(Delimiter);
                        int      iVal      = 1;
                        foreach (var sValue in sValues)
                        {
                            if (iVal == 1)
                            {
                                string sCorrectValue = Regex.Match(sValue, @"\d").Value;
                                iHorz = Convert.ToInt32(sCorrectValue);
                            }
                            else
                            {
                                string sCorrectValue = Regex.Match(sValue, @"\d").Value;
                                iVert = Convert.ToInt32(sCorrectValue);
                            }
                            iVal = iVal + 1;
                        }
                    }
                    catch (Exception exValue)
                    {
                        MessageBox.Show(exValue.Message + " Value is incorrect, should be Horizontal Number X Vertical Number. Example: 2X2", "Create Duct Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    oApp.BeginWaitCursor();
                    objGlobal.DeleteExistingDucts(FNO, FID);
                    objGlobal.CreateDucConfiguration(iHorz, iVert);

                    oApp.EndWaitCursor();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Duct Creation " + ex.Message);
            }
            finally
            {
                oApp.EndWaitCursor();
            }
            GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "");
        }
Esempio n. 9
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = new string[1];
            ErrorMessageArray  = new string[1];
            string networkManaged         = null;
            string networkRestricted      = null;
            string errorPriorityManaged   = Convert.ToString(Arguments.GetArgument(0));
            string errorPriorityUnmanaged = Convert.ToString(Arguments.GetArgument(1));
            short  m_ManholeCNO           = 10601;

            GTValidationLogger gTValidationLogger = null;

            int activeFID  = 0;
            int relatedFID = 0;

            string activeFieldValue  = string.Empty;
            string relatedFieldValue = string.Empty;

            IGTComponent activeComponent = ActiveComponents[ActiveComponentName];

            if (activeComponent != null && activeComponent.Recordset != null && activeComponent.Recordset.RecordCount > 0)
            {
                activeFID        = int.Parse(activeComponent.Recordset.Fields["G3E_FID"].Value.ToString());
                activeFieldValue = Convert.ToString(activeComponent.Recordset.Fields[ActiveFieldName].Value);
            }

            IGTComponent relatedComponent = RelatedComponents[RelatedComponentName];

            if (relatedComponent != null && relatedComponent.Recordset != null && relatedComponent.Recordset.RecordCount > 0)
            {
                relatedFID        = int.Parse(relatedComponent.Recordset.Fields["G3E_FID"].Value.ToString());
                relatedFieldValue = Convert.ToString(relatedComponent.Recordset.Fields[RelatedFieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ActiveComponentName,
                    ActiveFID           = activeFID,
                    ActiveFieldName     = ActiveFieldName,
                    ActiveFieldValue    = activeFieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = RelatedComponentName,
                    RelatedFID              = relatedFID,
                    RelatedFieldName        = RelatedFieldName,
                    RelatedFieldValue       = relatedFieldValue,
                    ValidationInterfaceName = "Network Management",
                    ValidationInterfaceType = "RAI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Network Management Entry", "N/A", "");
            }

            try
            {
                ValidationRuleManager validateMsg = new ValidationRuleManager();

                IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>();
                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Network Management Validation Started");

                if (m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset != null)
                {
                    if (!(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.EOF&& m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.BOF))
                    {
                        m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.MoveFirst();

                        networkManaged    = Convert.ToString(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.Fields["NETWORK_MANAGED_YN"].Value);
                        networkRestricted = Convert.ToString(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.Fields["NETWORK_RESTRICTED_YN"].Value);
                    }
                }

                if (!m_oDataContext.IsRoleGranted("PRIV_DESIGN_NET") && networkManaged == "Y" && networkRestricted == "Y")
                {
                    validateMsg.Rule_Id = "NETMGMT01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessageArray[0]  = validateMsg.Rule_MSG;
                    ErrorPriorityArray[0] = errorPriorityManaged;
                }

                if (!m_oDataContext.IsRoleGranted("PRIV_DESIGN_NET") && networkManaged == "N" && networkRestricted == "Y")
                {
                    validateMsg.Rule_Id = "NETMGMT02";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessageArray[0]  = validateMsg.Rule_MSG;
                    ErrorPriorityArray[0] = errorPriorityUnmanaged;
                }

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Network Management Validation Completed");

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Network Management Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in Network Management Relationship Attribute Interface:" + ex.Message);
            }
        }
        public void ProcessCategoryCount(CalledFromDelete p_calledFromDelete)
        {
            IGTApplication oApp = GTClassFactory.Create <IGTApplication>();

            string placementType         = string.Empty;
            string cuCode                = string.Empty;
            string categroryCodeArgument = Convert.ToString(m_arguments.GetArgument(0));
            int    anoCount              = Convert.ToInt32(m_arguments.GetArgument(1));
            string currentCU             = string.Empty;

            try
            {
                ADODB.Recordset rs        = oApp.DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "g3e_Ano = " + anoCount);
                Int16           cno       = 0;
                string          fieldName = Convert.ToString(rs.Fields["G3E_FIELD"].Value);

                string categoryCode = string.Empty;

                if (rs != null)
                {
                    if (rs.RecordCount > 0)
                    {
                        rs.MoveFirst();
                        cno = Convert.ToInt16(rs.Fields["g3E_cno"].Value);

                        try
                        {
                            if (m_components.GetComponent(cno) == null)
                            {
                                return;
                            }
                        }
                        catch (Exception)
                        {
                            return;
                        }
                    }
                }

                int iCount = 0;


                if (m_components[m_componentName].Recordset != null)
                {
                    if (m_components[m_componentName].Recordset.RecordCount > 0)
                    {
                        currentCU = Convert.ToString(m_components[m_componentName].Recordset.Fields["CU_C"].Value);
                        m_components[m_componentName].Recordset.MoveFirst();

                        while (!m_components[m_componentName].Recordset.EOF)
                        {
                            categoryCode = GetCUCategoryCode(Convert.ToString(m_components[m_componentName].Recordset.Fields["CU_C"].Value), oApp);

                            if (string.Equals(categoryCode, categroryCodeArgument) && m_components[m_componentName].Recordset.Fields["ACTIVITY_C"].Value.ToString() != "R")
                            {
                                iCount = iCount + 1;
                            }
                            m_components[m_componentName].Recordset.MoveNext();
                        }

                        categoryCode = GetCUCategoryCode(currentCU, oApp);
                        m_components.GetComponent(cno).Recordset.MoveFirst();

                        if (p_calledFromDelete == CalledFromDelete.Yes && string.Equals(categoryCode, categroryCodeArgument))
                        {
                            iCount = iCount - 1;
                        }

                        m_components.GetComponent(cno).Recordset.Fields[fieldName].Value = iCount;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error from Count Ancillaries By Category FI: " + ex.Message, "G/Technology");
            }
        }
Esempio n. 11
0
        //public RestrictedArea(short Fno, int Fid)
        //{
        //    m_fno = Fno;
        //    m_fid = Fid;
        //    m_iGtApplication = GTClassFactory.Create<IGTApplication>();
        //    m_iGtDataContext = m_iGtApplication.DataContext;
        //}

        /// <summary>
        /// Process Restricted Area validation
        /// </summary>
        /// <returns>true if the process is complete without errors, else returns false</returns>
        public bool Process()
        {
            IGTGeometry       featureGeometry          = null;
            IGTSpatialService gTSpatialService         = null;
            IGTComponent      restrictedAreaAttributes = null;

            try
            {
                foreach (IGTKeyObject feature in m_features)
                {
                    m_fno = feature.FNO;
                    m_fid = feature.FID;

                    IGTComponents selectedfeatureComponents = m_iGtDataContext.OpenFeature(m_fno, m_fid).Components;

                    CommonFunctions commonFunctions = new CommonFunctions();
                    short           primaryCno      = commonFunctions.GetPrimaryGraphicCno(m_fno, true);

                    // If the CNO is zero (not defined), then try the detail CNO
                    if (0 == primaryCno)
                    {
                        primaryCno = commonFunctions.GetPrimaryGraphicCno(m_fno, false);
                    }

                    IGTComponent primaryGraphicComponent = selectedfeatureComponents.GetComponent(primaryCno);

                    if (primaryGraphicComponent != null)
                    {
                        Recordset graphicCompRs = primaryGraphicComponent.Recordset;
                        if (graphicCompRs != null && graphicCompRs.RecordCount > 0)
                        {
                            graphicCompRs.MoveFirst();
                            //  Retrieve the geometry of the primary graphic component
                            featureGeometry = primaryGraphicComponent.Geometry;

                            // Find any Restricted Area features whose area component overlaps the retrieved geometry; if none are found, return with a successful status.
                            gTSpatialService                = GTClassFactory.Create <IGTSpatialService>();
                            gTSpatialService.DataContext    = m_iGtDataContext;
                            gTSpatialService.Operator       = GTSpatialOperatorConstants.gtsoEntirelyContainedBy;
                            gTSpatialService.FilterGeometry = featureGeometry;

                            Recordset restrictedAreaFeaturesRs = gTSpatialService.GetResultsByFNO(new short[] { RestrictedAreaFno });

                            if (restrictedAreaFeaturesRs != null && restrictedAreaFeaturesRs.RecordCount > 0)
                            {
                                //Prathyusha
                                //if (restrictedAreaFeaturesRs.RecordCount == 0)
                                //{
                                //    return false;
                                //}
                                restrictedAreaFeaturesRs.MoveFirst();

                                while (!restrictedAreaFeaturesRs.EOF)
                                {
                                    int fid = Convert.ToInt32(restrictedAreaFeaturesRs.Fields["G3E_FID"].Value);
                                    restrictedAreaAttributes = m_iGtDataContext.OpenFeature(RestrictedAreaFno, fid).Components.GetComponent(RestrictedAreaAttributesCno);

                                    if (!ValidateRestrictedAreaFeature(restrictedAreaAttributes))
                                    {
                                        return(false);
                                    }

                                    restrictedAreaFeaturesRs.MoveNext();
                                }
                                return(true);
                            }
                        }
                    }
                }
                return(true);// Prathyusha: return false;
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Get Origin
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativeComponent"></param>
        /// <param name="xOffset"></param>
        /// <param name="pointLocation"></param>
        /// <returns></returns>
        private IGTPoint GetOrigin(IGTKeyObject KeyObject, IGTComponents m_gtComponents, IGTGraphicComponent m_gtRelativeComponent, double xOffset, string pointLocation)
        {
            try
            {
                IGTPoint m_gtOriginPoint = null;
                m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Isolation Point placement is in Progress......");

                //Get the related Point feature
                IGTKeyObject m_gtRelativePoint = m_gtApplication.DataContext.OpenFeature(m_gtRelativeComponent.FNO, m_gtRelativeComponent.FID);

                //get the related lines
                IGTKeyObjects m_gtRelativeLines = GetRelatedFeature(m_gtRelativePoint, iRNO, linearFNO);

                //get the related Linear features in case they are not connected to relativepoint
                if (m_gtRelativeLines.Count == 0)
                {
                    IGTKeyObjects m_gtBypasspt = GetRelatedFeature(m_gtRelativePoint, iRNO, KeyobjectFNO);
                    if (m_gtBypasspt.Count > 0)
                    {
                        m_gtRelativeLines = GetRelatedFeature(m_gtBypasspt[0], iRNO, linearFNO);
                    }
                }

                //Check if related line geometry is not null
                if (m_gtRelativeLines != null && m_gtRelativeLines.Count > 0)
                {
                    EstablishRelationship(m_gtRelativePoint, m_gtRelativeLines);

                    IGTGeometry m_gtLineGeometry = m_gtRelativeLines[0].Components.GetComponent(primaryCNO).Geometry;

                    if (m_gtLineGeometry != null)
                    {
                        //Get node values
                        GetNodeValues(m_gtRelativePoint, m_gtRelativeLines);

                        //create offset geoemtry
                        if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1))
                        {
                            IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset);
                            m_gtOriginPoint = geoms[0].LastPoint;

                            //set the node value
                            m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode2;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                            m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();

                            //set the node value
                            if (m_gtRelativePoint.FNO == transformerUGFNO)
                            {
                                if (m_gtRelativeLines.Count > 1)
                                {
                                    m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode2;
                                    m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                                }
                            }
                        }
                        else
                        {
                            IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset);
                            m_gtOriginPoint = geoms[0].FirstPoint;

                            //set the node value
                            m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode1;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                            m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                            m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();

                            //set the node value
                            if (m_gtRelativePoint.FNO == transformerUGFNO)
                            {
                                if (m_gtRelativeLines.Count > 1)
                                {
                                    m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode1;
                                    m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                                }
                            }
                        }
                    }
                    if (m_gtOriginPoint == null)
                    {
                        m_gtOriginPoint = m_gtRelativeComponent.Geometry.FirstPoint;
                    }
                }
                else
                {
                    if (pointLocation == "R")
                    {
                        MessageBox.Show("Error: Unable to place Isolation Points as the linear feature is not selected properly", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                return(m_gtOriginPoint);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

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

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

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

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

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

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

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

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

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

                int recordsAffected = 0;

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

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

                m_frmSecondaryCalculator.m_CustomCommandHelper = CustomCommandHelper;
                m_frmSecondaryCalculator.StartPosition         = FormStartPosition.CenterScreen;
                m_frmSecondaryCalculator.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
Esempio n. 14
0
        public void Execute()
        {
            short commonCompCNO = 1;
            short CUCompCNO     = 21;

            try
            {
                // If G/Tech is not running in interactive mode, then skip message boxes.
                GUIMode guiMode = new GUIMode();
                m_InteractiveMode = guiMode.InteractiveMode;

                IGTComponent commonComponent = m_components.GetComponent(commonCompCNO);

                if ((commonComponent != null) && (commonComponent.Recordset.RecordCount > 0))
                {
                    commonComponent.Recordset.MoveFirst();

                    if (commonComponent.Recordset.Fields["LENGTH_GRAPHIC_Q"].Value.GetType() != typeof(DBNull))
                    {
                        double graphicLengthMtr = Convert.ToDouble(commonComponent.Recordset.Fields["LENGTH_GRAPHIC_Q"].Value);

                        SetLengthAttributes(graphicLengthMtr, commonComponent);
                    }

                    if (commonComponent.Recordset.Fields["LENGTH_ACTUAL_Q"].Value.GetType() != typeof(DBNull))
                    {
                        CUAttributesLengthUpdate(commonComponent, CUCompCNO);
                    }
                }
            }
            catch (Exception exception)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show("Error occured in CopyLengthAttributes Functional interface : " + exception.Message, "G/Technology");
                }
            }
        }