Пример #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="p_node1IsolationFeatures">Node1 Isolation features connected to active feature</param>
 /// <param name="p_node2IsolationFeatures">Node2 Isolation features connected to active feature</param>
 /// <param name="p_errorPriority">Error Priority</param>
 public IsoDualScenario(List <IGTKeyObject> p_node1IsolationFeatures, List <IGTKeyObject> p_node2IsolationFeatures, string p_errorPriority)
 {
     validateMsg = new ValidationRuleManager();
     m_oNode1IsolationFeatures = p_node1IsolationFeatures;
     m_oNode2IsolationFeatures = p_node2IsolationFeatures;
     m_errorPriority           = p_errorPriority;
 }
Пример #2
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = null;
            ErrorMessageArray  = null;
            GTValidationLogger gTValidationLogger = null;

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

                ValidationLog(ref gTValidationLogger);

                if (!CheckForEqualFeederTieFeederValues())
                {
                    ValidationRuleManager validateMsg = new ValidationRuleManager();
                    validateMsg.Rule_Id = "FEED02";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorPriorityArray    = new string[1];
                    ErrorMessageArray     = new string[1];
                    ErrorPriorityArray[0] = errorPriority;
                    ErrorMessageArray[0]  = validateMsg.Rule_MSG;
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Feeder Validation FI Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in Feeder Validaiton FI" + ex.Message);
            }
        }
Пример #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="p_Node1ElbowFeatures">Node1 Elbows features connected to active feature</param>
 /// <param name="p_Node2ElbowFeatures">Node2 Elbows features connected to active feature</param>
 /// <param name="p_errorPriority">Error Priority</param>
 public ElbowScenario(List <IGTKeyObject> p_Node1ElbowFeatures, List <IGTKeyObject> p_Node2ElbowFeatures, string p_errorPriority)
 {
     validateMsg           = new ValidationRuleManager();
     m_oNode1ElbowFeatures = p_Node1ElbowFeatures;
     m_oNode2ElbowFeatures = p_Node2ElbowFeatures;
     m_errorPriority       = p_errorPriority;
 }
Пример #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="p_ByPassFeatures">Bypass Points features connected to active feature</param>
 /// <param name="p_ErrorPriority">Error Priority</param>
 public ByPassScenario(List <IGTKeyObject> p_node1ByPassFeatures, List <IGTKeyObject> p_node2ByPassFeatures, string p_ErrorPriority)
 {
     validateMsg            = new ValidationRuleManager();
     m_oNode1ByPassFeatures = p_node1ByPassFeatures;
     m_oNode2ByPassFeatures = p_node2ByPassFeatures;
     m_errorPriority        = p_ErrorPriority;
 }
Пример #5
0
        /// <summary>
        /// Add valdiations required to validate the active feature.
        /// </summary>
        /// <param name="noWorkPoint"></param>
        /// <param name="noMatchingWorkPoint"></param>
        /// <param name="strArgument1"></param>
        /// <param name="strArgument2"></param>
        /// <param name="p_lstErrorMessage"></param>
        /// <param name="p_lstErrorPriority"></param>
        /// <param name="errorPriorityNoWorkpoint"></param>
        /// <param name="errorPriorityNoMatchingWorkPoint"></param>
        private void AddValidationsToArray(bool noWorkPoint, bool noMatchingWorkPoint, string strArgument1, string strArgument2, ref List <string> p_lstErrorMessage, ref List <string> p_lstErrorPriority, string errorPriorityNoWorkpoint, string errorPriorityNoMatchingWorkPoint)
        {
            ValidationRuleManager validateMsg = new ValidationRuleManager();

            object[] messArguments;
            try
            {
                if (noWorkPoint)
                {
                    messArguments       = new object[1];
                    messArguments[0]    = strArgument1;
                    validateMsg.Rule_Id = "JM1";
                    validateMsg.BuildRuleMessage((IGTApplication)GTClassFactory.Create <IGTApplication>(), messArguments);

                    p_lstErrorMessage.Add(validateMsg.Rule_MSG);
                    p_lstErrorPriority.Add(errorPriorityNoWorkpoint);
                }

                if (!noMatchingWorkPoint)
                {
                    messArguments       = new object[1];
                    messArguments[0]    = strArgument2;
                    validateMsg.Rule_Id = "JM2";
                    validateMsg.BuildRuleMessage((IGTApplication)GTClassFactory.Create <IGTApplication>(), messArguments);

                    p_lstErrorMessage.Add(validateMsg.Rule_MSG);
                    p_lstErrorPriority.Add(errorPriorityNoMatchingWorkPoint);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #6
0
        /// <summary>
        /// ProcessIsolationScenario
        /// </summary>
        /// <param name="ErrorMessage">Error Message to be displayed</param>
        /// <param name="ErrorPriority">Error Priority</param>
        public void ProcessIsolationScenario(out string ErrorMessage, out string ErrorPriority)
        {
            try
            {
                if (!CheckIsoDual(m_oNode1IsolationFeatures, m_oNode2IsolationFeatures))
                {
                    validateMsg.Rule_Id = "ISO01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessage  = validateMsg.Rule_MSG;
                    ErrorPriority = m_errorPriority;
                }
                else
                {
                    ErrorMessage  = null;
                    ErrorPriority = null;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                validateMsg = null;
                m_oNode1IsolationFeatures = null;
                m_oNode2IsolationFeatures = null;
            }
        }
Пример #7
0
        private void ValidateVoltages(Common.FeatureInfo p_affected, Common.FeatureInfo p_related)
        {
            try
            {
                List <string> statesProposedUpdate = new List <string> {
                    "PPI", "ABI", "INI", "CLS"
                };
                bool isAffectedProposedUpdate = statesProposedUpdate.Contains(p_affected.FeatureState);
                bool isRelatedProposedUpdate  = statesProposedUpdate.Contains(p_related.FeatureState);

                string affectedVoltage = null;
                string relatedVoltage  = null;

                if (isAffectedProposedUpdate && isRelatedProposedUpdate && !String.IsNullOrEmpty(m_sProposedAffectedVoltage))
                {
                    affectedVoltage = m_sProposedAffectedVoltage;
                }
                else
                {
                    affectedVoltage = m_sActualAffectedVoltage;
                }

                if (isAffectedProposedUpdate && isRelatedProposedUpdate && !String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                {
                    relatedVoltage = m_sProposedRelatedVoltage;
                }
                else
                {
                    relatedVoltage = m_sActualRelatedVoltage;
                }

                if ((affectedVoltage != null || relatedVoltage != null) && !affectedVoltage.Equals(relatedVoltage))
                {
                    ValidationRuleManager validateMsg = new ValidationRuleManager();

                    validateMsg.Rule_Id = "VOLT01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    m_lstErrorPriority.Add(m_errorPriority);
                    m_lstErrorMessage.Add(validateMsg.Rule_MSG);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #8
0
 public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
 {
     try
     {
         m_errorPriority = Convert.ToString(m_rgiBaseClass.Arguments.GetArgument(0));
         m_validateMsg   = new ValidationRuleManager();
         m_messArguments = new object[4];
         ProcessValidate(out ErrorPriorityArray, out ErrorMessageArray);
     }
     catch
     {
         throw;
     }
     finally
     {
         m_validateMsg   = null;
         m_messArguments = null;
     }
 }
Пример #9
0
        /// <summary>
        /// ValidateVoltages:Validates voltage values of connected features and raises a P1 error for mismatch of the connected features.
        /// <summary>
        /// <param name="p_errorPriority">Error Priority</param>
        private void ValidateVoltages(string p_errorPriority)
        {
            try
            {
                if ((m_sActualAffectedVoltage != null && !m_sActualAffectedVoltage.Equals(m_sActualRelatedVoltage)) || (m_sProposedAffectedVoltage != null && !m_sProposedAffectedVoltage.Equals(m_sProposedRelatedVoltage)))
                {
                    ValidationRuleManager validateMsg = new ValidationRuleManager();

                    validateMsg.Rule_Id = "VOLT01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    m_lstErrorPriority.Add(p_errorPriority);
                    m_lstErrorMessage.Add(validateMsg.Rule_MSG);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #10
0
        /// <summary>
        /// ValidateVoltages:Validates voltage values of connected features and raises a P1 error for mismatch of the connected features.
        /// <summary>
        /// <param name="p_errorPriority">Error Priority</param>
        private void ValidateVoltages()
        {
            string affectedVoltage = null;
            string relatedVoltage  = null;

            try
            {
                if (!String.IsNullOrEmpty(m_sProposedAffectedVoltage))
                {
                    affectedVoltage = m_sProposedAffectedVoltage;
                }
                else
                {
                    affectedVoltage = m_sActualAffectedVoltage;
                }

                if (!String.IsNullOrEmpty(m_sProposedRelatedVoltage))
                {
                    relatedVoltage = m_sProposedRelatedVoltage;
                }
                else
                {
                    relatedVoltage = m_sActualRelatedVoltage;
                }

                if ((affectedVoltage != null || relatedVoltage != null) && !affectedVoltage.Equals(relatedVoltage))
                {
                    ValidationRuleManager validateMsg = new ValidationRuleManager();

                    validateMsg.Rule_Id = "VOLT01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    m_lstErrorPriority.Add(m_errorPriority);
                    m_lstErrorMessage.Add(validateMsg.Rule_MSG);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #11
0
        /// <summary>
        /// Method to get the Validation Message
        /// </summary>
        /// <param name="ErrorPriority"></param>
        /// <param name="ErrorMessage"></param>
        private void ShowValidation(out string ErrorPriority, out string ErrorMessage)
        {
            ValidationRuleManager validateMsg = new ValidationRuleManager();

            object[] messArguments = new object[3];
            try
            {
                validateMsg.Rule_Id = "FEED01";
                messArguments[0]    = ActiveFieldName;
                messArguments[1]    = ActiveFieldValue.FieldValue;
                messArguments[2]    = RelatedFieldValue.FieldValue;
                validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), messArguments);

                ErrorPriority = Priority;
                ErrorMessage  = validateMsg.Rule_MSG;
            }
            catch
            {
                throw;
            }
        }
Пример #12
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);
            }
        }
Пример #13
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            Regex regex = new Regex("^\\d+'\\d+\"$");             // Regular expression for height format - ex 5'6"

            ErrorPriorityArray = null;
            ErrorMessageArray  = null;
            List <string>         errorMsg           = new List <string>();
            List <string>         errorPriority      = new List <string>();
            IGTComponent          component          = Components[ComponentName];
            Recordset             componentRecordSet = component.Recordset;
            ValidationRuleManager validateMsg        = new ValidationRuleManager();

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Height Validation",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Height Validation Entry", "N/A", "");
            }



            try
            {
                if (componentRecordSet != null)
                {
                    if (componentRecordSet.RecordCount > 0)
                    {
                        m_AttachmentHeight = Convert.ToString(componentRecordSet.Fields[m_FieldName].Value);
                        if (!string.IsNullOrEmpty(m_AttachmentHeight))
                        {
                            Match match = regex.Match(m_AttachmentHeight);
                            if (match.Success)
                            {
                                if (!CheckHeightRange(m_AttachmentHeight))
                                {
                                    validateMsg.Rule_Id = "HGT01";
                                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);
                                    errorMsg.Add(validateMsg.Rule_MSG);
                                    errorPriority.Add(Convert.ToString(m_Arguments.GetArgument(0)));
                                }
                            }
                            else
                            {
                                validateMsg.Rule_Id = "HGT01";
                                validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);
                                errorMsg.Add(validateMsg.Rule_MSG);
                                errorPriority.Add(Convert.ToString(m_Arguments.GetArgument(0)));
                            }
                        }
                    }

                    if (errorMsg.Count > 0)
                    {
                        ErrorPriorityArray = errorPriority.ToArray();
                        ErrorMessageArray  = errorMsg.ToArray();
                    }
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Height Validation Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Attachment Height Validation" + ex.Message);
            }
        }
Пример #14
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorMessageArray  = null;
            ErrorPriorityArray = null;
            short      cNo          = 0;
            int        deviceRating = 0;
            List <int> ampsList     = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            if (comp != null)
            {
                comp.Recordset.MoveFirst();
                FID = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = Convert.ToString(comp.Recordset.Fields[FieldName].Value),
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Check Device Rating",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Check Device Rating Entry", "N/A", "");
            }

            try
            {
                List <String>  strErrorMsg      = new List <String>();
                List <String>  strErrorPriority = new List <String>();
                IGTApplication iGtApplication   = GTClassFactory.Create <IGTApplication>();
                iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Check Device Rating Validation Started");
                string errorPriority = Convert.ToString(m_Arguments.GetArgument(0));
                short  fNo           = Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value);

                ValidationRuleManager validateMsg = new ValidationRuleManager();

                IGTComponent loadAnalysisAttributes = Components.GetComponent(32); // Load Analysis Attributes Component

                if (loadAnalysisAttributes == null)
                {
                    iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Check Device Rating Validation Completed");
                    if (gTValidationLogger != null)
                    {
                        gTValidationLogger.LogEntry("TIMING", "END", "Check Device Rating Exit", "N/A", "");
                    }
                    return;
                }

                string query = @"SELECT A.G3E_CNO FROM G3E_ATTRIBUTEINFO_OPTABLE A, G3E_FEATURECOMPS_OPTABLE F WHERE 
								 A.G3E_FIELD =  'DEVICE_RTG_Q' AND
								 F.G3E_CNO = A.G3E_CNO AND
								 F.G3E_FNO = {0}"                                ;

                Recordset resultRs = GetRecordSet(string.Format(query, fNo));

                // Get the device rating
                if (resultRs != null && resultRs.RecordCount > 0)
                {
                    resultRs.MoveFirst();
                    cNo = Convert.ToInt16(resultRs.Fields["G3E_CNO"].Value); // CNO for the attribute containing Device rating
                    if (cNo > 0)
                    {
                        Recordset tempRs = Components.GetComponent(cNo).Recordset;
                        if (tempRs != null && tempRs.RecordCount > 0)
                        {
                            tempRs.MoveFirst();
                            if (!string.IsNullOrEmpty(Convert.ToString(tempRs.Fields["DEVICE_RTG_Q"].Value)))
                            {
                                deviceRating = Convert.ToInt32(tempRs.Fields["DEVICE_RTG_Q"].Value);
                            }
                        }
                    }
                }
                if (deviceRating <= 0)
                {
                    if (gTValidationLogger != null)
                    {
                        gTValidationLogger.LogEntry("TIMING", "END", "Check Device Rating Exit", "N/A", "");
                    }
                    return;
                }
                // Get the Summer Amps and Winter Amps
                Recordset loadAnalysisAttributesRs = loadAnalysisAttributes.Recordset;
                if (loadAnalysisAttributesRs != null && loadAnalysisAttributesRs.RecordCount > 0)
                {
                    ampsList = new List <int>();
                    loadAnalysisAttributesRs.MoveFirst();
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_A_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_A_Q"].Value));
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_B_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_B_Q"].Value));
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_C_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["SUMMER_AMPS_C_Q"].Value));
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["WINTER_AMPS_A_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["WINTER_AMPS_A_Q"].Value));
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["WINTER_AMPS_B_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["WINTER_AMPS_B_Q"].Value));
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(loadAnalysisAttributesRs.Fields["WINTER_AMPS_C_Q"].Value)))
                    {
                        ampsList.Add(Convert.ToInt32(loadAnalysisAttributesRs.Fields["WINTER_AMPS_C_Q"].Value));
                    }

                    if (ampsList != null && ampsList.Count > 0 && ampsList.Max() > deviceRating)
                    {
                        validateMsg.Rule_Id = "DRTG01";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        strErrorMsg.Add(validateMsg.Rule_MSG);
                        strErrorPriority.Add(errorPriority);
                    }
                }

                iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Check Device Rating Validation Completed");
                ErrorMessageArray  = strErrorMsg.ToArray();
                ErrorPriorityArray = strErrorPriority.ToArray();

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Check Device Rating Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Check Device Rating FI validation. " + ex.Message);
            }
        }
Пример #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ErrorPriorityArray"></param>
        /// <param name="ErrorMessageArray"></param>
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = null;
            ErrorMessageArray  = null;

            string activeFeatureState = null;
            short  numberofNodes      = 0;

            int node1 = 0;
            int node2 = 0;

            string errorPriorityUnconnected = Convert.ToString(Arguments.GetArgument(0));
            string errorPrioritySelf        = Convert.ToString(Arguments.GetArgument(1));
            string errorPrioritySharedOwner = Convert.ToString(Arguments.GetArgument(2));

            ValidationRuleManager validateMsg = new ValidationRuleManager();

            object[] messArguments = new object[1];

            List <string> errorMessage  = new List <string>();
            List <string> errorPriority = new List <string>();

            IGTKeyObject  activeFeature   = GTClassFactory.Create <IGTKeyObject>();
            IGTKeyObjects relatedFeatures = GTClassFactory.Create <IGTKeyObjects>();

            IGTGeometry primaryGeometry = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int    FID        = 0;
            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Connectivity Validation",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Connectivity Validation Entry", "N/A", "");
            }


            GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "ConnectionValidation FI Started");
            try
            {
                activeFeature = DataContext.OpenFeature(Convert.ToInt16(Components[ComponentName].Recordset.Fields[ATTRIB_FNO].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields[ATTRIB_FID].Value));

                if (CheckValidFeatures(activeFeature.FNO))
                {
                    relatedFeatures = GetRelatedFeatures(activeFeature, cRNO);

                    GetNumberOfNodes(activeFeature, ref numberofNodes);

                    GetPrimaryGeometry(activeFeature, ref primaryGeometry);

                    /*Gets active Feature attributes*/
                    if (activeFeature.Components.GetComponent(cCNO).Recordset.RecordCount > 0)
                    {
                        activeFeature.Components.GetComponent(cCNO).Recordset.MoveFirst();

                        node1 = Convert.ToInt32(activeFeature.Components.GetComponent(cCNO).Recordset.Fields[ATTRIB_NODE1].Value == DBNull.Value ? 0 : activeFeature.Components.GetComponent(cCNO).Recordset.Fields[ATTRIB_NODE1].Value);
                        node2 = Convert.ToInt32(activeFeature.Components.GetComponent(cCNO).Recordset.Fields[ATTRIB_NODE2].Value == DBNull.Value ? 0 : activeFeature.Components.GetComponent(cCNO).Recordset.Fields[ATTRIB_NODE2].Value);

                        activeFeature.Components.GetComponent(oCNO).Recordset.MoveFirst();

                        activeFeatureState = Convert.ToString(activeFeature.Components.GetComponent(oCNO).Recordset.Fields[ATTRIB_FEATURE_STATE].Value);
                    }

                    //Feature in Feature State in (PPI, PPR, PPA, INI, CLS, ABI, ABR) must be connected.

                    if (CheckFeatureState(activeFeatureState) && CheckNotOwnedByPrimarySwitchGear(activeFeature))
                    {
                        if ((numberofNodes == 1 && node1 == 0 && node2 == 0) || (numberofNodes == 2 && (node1 == 0 || node2 == 0)))
                        {
                            messArguments[0] = activeFeatureState;

                            validateMsg.Rule_Id = "CONN01";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), messArguments);

                            errorMessage.Add(validateMsg.Rule_MSG);
                            errorPriority.Add(errorPriorityUnconnected);
                        }
                    }

                    //Feature may not be connected to itself.

                    if ((numberofNodes == 2) && node1 != 0 && node1 == node2)
                    {
                        validateMsg.Rule_Id = "CONN02";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        errorMessage.Add(validateMsg.Rule_MSG);
                        errorPriority.Add(errorPrioritySelf);
                    }

                    // Feature is a point feature and feature owner not in the set of connected owners

                    if (primaryGeometry != null && primaryGeometry.Type == "OrientedPointGeometry")
                    {
                        int noMatchingOwnerCnt = 0;

                        GetActiveAndRelatedFeaturesOwners(activeFeature, relatedFeatures, ref noMatchingOwnerCnt);

                        for (int i = 1; i <= noMatchingOwnerCnt; i++)
                        {
                            validateMsg.Rule_Id = "CONN03";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorMessage.Add(validateMsg.Rule_MSG);
                            errorPriority.Add(errorPrioritySharedOwner);
                        }
                    }


                    //Feature is a Service Line and not connected to exactly one Service Point

                    if (activeFeature.FNO == 54)//FNO == 54, is Service Line
                    {
                        int count = 0;

                        for (int i = 0; i < relatedFeatures.Count; i++)
                        {
                            if (relatedFeatures[i].FNO == 55) //FNO == 55, is Service Point FNO
                            {
                                count++;
                            }
                        }

                        if (count != 1)
                        {
                            validateMsg.Rule_Id = "CONN04";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorMessage.Add(validateMsg.Rule_MSG);
                            errorPriority.Add(errorPriorityUnconnected);
                        }
                    }

                    //Feature is a Primary Conductor Node or Secondary Conductor Node and Type = DEAD END and not connected to exactly one other feature

                    if (activeFeature.FNO == 10 || activeFeature.FNO == 162) //FNO == 10, is Primary Conductor Node; FNO == 162, is Secondary Conductor Node
                    {
                        string        conductorNodeType   = GetConductorNodeType(activeFeature);
                        string        relatedFeatureState = string.Empty;
                        IGTKeyObjects oKeyObjects         = GTClassFactory.Create <IGTKeyObjects>();


                        if (!String.IsNullOrEmpty(conductorNodeType))
                        {
                            if (conductorNodeType.ToUpper() == "DEADEND")
                            {
                                int iCount = 0;

                                foreach (IGTKeyObject item in relatedFeatures)
                                {
                                    //Check if the related feature belong to valid feature state
                                    item.Components.GetComponent(oCNO).Recordset.MoveFirst(); //This is common component recordset so no harm in moving to first
                                    relatedFeatureState = Convert.ToString(item.Components.GetComponent(oCNO).Recordset.Fields["FEATURE_STATE_C"].Value);

                                    if (relatedFeatureState.Equals("PPI") || relatedFeatureState.Equals("ABI") || relatedFeatureState.Equals("PPX") || relatedFeatureState.Equals("ABX") || relatedFeatureState.Equals("INI") || relatedFeatureState.Equals("CLS"))
                                    {
                                        iCount = iCount + 1;
                                    }
                                }

                                if (iCount > 1 && (activeFeatureState.Equals("PPI") || activeFeatureState.Equals("ABI") || activeFeatureState.Equals("INI") || activeFeatureState.Equals("CLS")))
                                {
                                    validateMsg.Rule_Id = "CONN05";
                                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                                    errorMessage.Add(validateMsg.Rule_MSG);
                                    errorPriority.Add(errorPriorityUnconnected);
                                }
                            }
                        }
                    }

                    //Feature is a Street Light and Owner Type = COMPANY and not connected.

                    if (activeFeature.FNO == 56)
                    {
                        activeFeature.Components.GetComponent(oCNO).Recordset.MoveFirst();

                        string ownerType = Convert.ToString(activeFeature.Components.GetComponent(oCNO).Recordset.Fields["OWNED_TYPE_C"].Value);

                        if (!String.IsNullOrEmpty(ownerType))
                        {
                            if (ownerType.ToUpper() == "COMPANY" && node1 == 0 && node2 == 0)
                            {
                                validateMsg.Rule_Id = "CONN06";
                                validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                                errorMessage.Add(validateMsg.Rule_MSG);
                                errorPriority.Add(errorPriorityUnconnected);
                            }
                        }
                    }

                    //Removal of this feature will cause downstream features to be disconnected.

                    if (numberofNodes == 2 && CheckForRemovalActiveFeatureState(activeFeatureState)) //Active feature Feature State in (PPR, PPA, ABR, ABA)
                    {
                        List <IGTKeyObject> loadFeatures       = new List <IGTKeyObject>();
                        List <IGTKeyObject> sharedLoadFeatures = new List <IGTKeyObject>();
                        List <IGTKeyObject> parallelFeatures   = new List <IGTKeyObject>();

                        ConnectivityFactory oFactory = new ConnectivityHelperFactory();

                        GetLoadsFeatures(ref loadFeatures, activeFeature, oFactory);

                        GetSharedLoadsFeatures(ref sharedLoadFeatures, activeFeature, oFactory);

                        GetParallelFeatures(ref parallelFeatures, activeFeature, oFactory);

                        if (loadFeatures.Count > 0 && sharedLoadFeatures.Count == 0 && parallelFeatures.Count == 0) //Affected feature has one or more “loads” and Affected features has zero “parallel sources”
                        {
                            validateMsg.Rule_Id = "CONN07";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorMessage.Add(validateMsg.Rule_MSG);
                            errorPriority.Add(errorPriorityUnconnected);
                        }
                    }

                    if (errorMessage.Count > 0)
                    {
                        ErrorPriorityArray = errorPriority.ToArray();
                        ErrorMessageArray  = errorMessage.ToArray();
                    }

                    GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "ConnectionValidation FI Completed");

                    if (gTValidationLogger != null)
                    {
                        gTValidationLogger.LogEntry("TIMING", "END", "Connectivity Validation Exit", "N/A", "");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error from Connection Validation FI: " + ex.Message);
            }
        }
Пример #16
0
        /// <summary>
        /// ValidatePhase : All the validations reagrding the Phase values are validated in this method.
        /// </summary>
        /// <param name="outsidePhaseList">List of Outside Phases</param>
        /// <param name="insidePhaseList">List of Inside Phases</param>
        /// <param name="parallelPhaseList">List of parallel Phases</param>
        /// <param name="upstreamPhaseList">List of upstream Phases</param>
        /// <param name="downstreamPhaseList">List of downstream Phases</param>
        /// <param name="relatedFeatures">List of related features of active feature</param>
        /// <param name="activeFNO">Active feature FNO</param>
        /// <param name="errorPriority">List of error priorities</param>
        /// <param name="errorMessage">List of error Messages</param>
        private void ValidatePhase(List <char> outsidePhaseList, List <char> insidePhaseList, List <char> parallelPhaseList, List <char> upstreamPhaseList, List <char> downstreamPhaseList, IGTKeyObjects relatedFeatures, short activeFNO, ref List <string> errorPriority, ref List <string> errorMessage)
        {
            string       relatedPhase         = String.Empty;
            List <short> protectionDevicesFNO = new List <short> {
                11, 87, 38, 88, 14, 15, 16, 91, 59, 98, 60, 99, 18, 34
            };                                                                                                             //Protection Device feature FNO's

            List <short> conductorsFNO = new List <short> {
                8, 9, 84, 85
            };                                                            //conductor feature FNO's
            List <char> activePhaseList = new List <char>();

            try
            {
                ValidationRuleManager validateMsg = new ValidationRuleManager();

                string errorPriorityMissing        = Convert.ToString(Arguments.GetArgument(0));
                string errorPriorityParallelSingle = Convert.ToString(Arguments.GetArgument(1));
                string errorPriorityUnused         = Convert.ToString(Arguments.GetArgument(2));
                string errorPriorityPhaseCount     = Convert.ToString(Arguments.GetArgument(3));
                string errorPriorityUnfed          = Convert.ToString(Arguments.GetArgument(4));

                if (!String.IsNullOrEmpty(m_activeFeaturePhase))
                {
                    foreach (char c in m_activeFeaturePhase)
                    {
                        if (c != 'N')
                        {
                            activePhaseList.Add(c); //Active phase list
                        }
                    }
                }

                if (m_numberofNodes == 2 && activeFNO != 16 && activeFNO != 91)
                {
                    //Checks if Phase of affected feature minus “outside phases” is not an empty set"
                    if (outsidePhaseList != null && activePhaseList.Except(outsidePhaseList).Count() > 0)
                    {
                        if (!CheckPhaseNotEmptySet(activePhaseList, outsidePhaseList, conductorsFNO)) // Checks for Affected feature has three phases,Affected feature is not a conductor, Quantity of “outside phases” = 2

                        {
                            validateMsg.Rule_Id = "PHAG01";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorPriority.Add(errorPriorityUnused);
                            errorMessage.Add(validateMsg.Rule_MSG);
                        }
                    }

                    //If Set of ”outside phases” differs from the set of “inside phases”,then raise an error "Not all phases are carried between nodes of the feature."

                    if (outsidePhaseList != null && insidePhaseList != null)
                    {
                        if (outsidePhaseList.Except(insidePhaseList).Count() > 0 || insidePhaseList.Except(outsidePhaseList).Count() > 0)
                        {
                            validateMsg.Rule_Id = "PHAG02";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorPriority.Add(errorPriorityMissing);
                            errorMessage.Add(validateMsg.Rule_MSG);
                        }
                    }

                    //Single-phase devices with the same phase connected in parallel.

                    if (activePhaseList.Count == 1 && parallelPhaseList.Count > 0)
                    {
                        if (parallelPhaseList.Contains(activePhaseList[0]))
                        {
                            validateMsg.Rule_Id = "PHAG03";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            errorPriority.Add(errorPriorityParallelSingle);
                            errorMessage.Add(validateMsg.Rule_MSG);
                        }
                    }
                }
                //1 or 2 phase feature is connected to a 3-phase feature other than a protective device.
                if ((activePhaseList.Count == 1 || activePhaseList.Count == 2) && conductorsFNO.Contains(activeFNO))
                {
                    if (relatedFeatures.Count > 0)
                    {
                        for (int i = 0; i < relatedFeatures.Count; i++)
                        {
                            relatedFeatures[i].Components.GetComponent(m_cCNO).Recordset.MoveFirst();

                            relatedPhase = Convert.ToString(relatedFeatures[i].Components.GetComponent(m_cCNO).Recordset.Fields[ATTRIB_PHASE].Value);

                            if (relatedPhase.Length == 3 && !relatedPhase.Contains('N') && !protectionDevicesFNO.Contains(relatedFeatures[i].FNO))
                            {
                                validateMsg.Rule_Id = "PHAG04";
                                validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                                errorPriority.Add(errorPriorityPhaseCount);
                                errorMessage.Add(validateMsg.Rule_MSG);
                            }
                        }
                    }
                }

                if (m_numberofNodes == 2 && activeFNO != 16 && activeFNO != 91)
                {
                    //One or more phases connected downstream of the feature are not present at the upstream node.

                    if (downstreamPhaseList.Except(upstreamPhaseList).Count() > 0)
                    {
                        validateMsg.Rule_Id = "PHAG05";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        errorPriority.Add(errorPriorityUnfed);
                        errorMessage.Add(validateMsg.Rule_MSG);
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                protectionDevicesFNO = null;
                conductorsFNO        = null;
                activePhaseList      = null;
            }
        }
Пример #17
0
        /// <summary>
        /// Protective Device validation.
        /// </summary>
        /// <param name="ErrorPriorityArray">Error messages that need to be displayed after validation</param>
        /// <param name="ErrorMessageArray">Error message Priority that need to be displayed after validation</param>
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorMessageArray  = null;
            ErrorPriorityArray = null;
            List <string>         lstErrorMsg                = new List <string>();
            List <string>         lstErrorPriority           = new List <string>();
            ValidationRuleManager validateMsg                = new ValidationRuleManager();
            IGTApplication        gtApp                      = (IGTApplication)GTClassFactory.Create <IGTApplication>();
            List <int>            lstFeaturesExcludedFromVal = new List <int> {
                11, 14, 15, 38, 59, 87, 88, 98
            };

            IGTComponent       comp = Components[ComponentName];
            GTValidationLogger gTValidationLogger = null;
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Protective Device Validation",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Protective Device Validation Entry", "N/A", "");
            }

            try
            {
                gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Protective Device Validation Started.");
                if (comp != null)
                {
                    String phase = comp.Recordset.Fields["PHASE_ALPHA"].Value.ToString();
                    int    protectiveDeviceFID         = 0;
                    int    proposedProtectiveDeviceFID = 0;
                    if (!String.IsNullOrEmpty(Convert.ToString(comp.Recordset.Fields["PROTECTIVE_DEVICE_FID"].Value)))
                    {
                        protectiveDeviceFID = Convert.ToInt32(comp.Recordset.Fields["PROTECTIVE_DEVICE_FID"].Value);
                    }
                    if (!String.IsNullOrEmpty(Convert.ToString(comp.Recordset.Fields["PP_PROTECTIVE_DEVICE_FID"].Value)))
                    {
                        proposedProtectiveDeviceFID = Convert.ToInt32(comp.Recordset.Fields["PP_PROTECTIVE_DEVICE_FID"].Value);
                    }

                    int  phaseCount          = 0;
                    bool isSubstationBreaker = false;

                    //Feature Phase count is 1 or 2 and Protective Device ID indicates a Substation Breaker

                    if (phase.Length > 0 && phase != "*")//(phase != "*" || phase != "N"))
                    {
                        phaseCount = phase.Length;
                    }

                    if (CheckIsFIDSubstation(protectiveDeviceFID, gtApp) || CheckIsFIDSubstation(proposedProtectiveDeviceFID, gtApp))
                    {
                        isSubstationBreaker = true;
                    }

                    if ((phaseCount == 1 || phaseCount == 2) && isSubstationBreaker && !lstFeaturesExcludedFromVal.Contains(Convert.ToInt32(comp.Recordset.Fields["G3E_FNO"].Value)))
                    {
                        validateMsg.Rule_Id = "PDEV01";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        lstErrorMsg.Add(validateMsg.Rule_MSG);
                        lstErrorPriority.Add(Arguments.GetArgument(0).ToString());
                    }

                    // Protective Device ID or Proposed Protective Device ID indicates a feature other than Substation Breaker or Recloser

                    if (Convert.ToInt32(comp.Recordset.Fields["G3E_FNO"].Value) == 14 || Convert.ToInt32(comp.Recordset.Fields["G3E_FNO"].Value) == 15)
                    {
                        bool isRecloser = false;
                        if (IsProtectiveDeviceRecloser(protectiveDeviceFID, Convert.ToInt32(comp.Recordset.Fields["G3E_FNO"].Value), gtApp) ||
                            IsProtectiveDeviceRecloser(proposedProtectiveDeviceFID, Convert.ToInt32(comp.Recordset.Fields["G3E_FNO"].Value), gtApp))
                        {
                            isRecloser = true;
                        }

                        if (!isRecloser && !isSubstationBreaker)
                        {
                            validateMsg.Rule_Id = "PDEV02";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            lstErrorMsg.Add(validateMsg.Rule_MSG);
                            lstErrorPriority.Add(Arguments.GetArgument(0).ToString());
                        }
                    }

                    ErrorMessageArray  = lstErrorMsg.ToArray();
                    ErrorPriorityArray = lstErrorPriority.ToArray();
                }
                gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Protective Device Validation Completed.");

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Protective Device Validation Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Protective Device Validation" + ex.Message);
            }
            finally
            {
                comp  = null;
                gtApp = null;
            }
        }
Пример #18
0
        public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = null;
            ErrorMessageArray  = null;
            Recordset             rsPremise      = null;
            bool                  validateMess   = false;
            List <string>         errorMsg       = new List <string>();
            List <string>         errorPriority  = new List <string>();
            ValidationRuleManager validateMsg    = new ValidationRuleManager();
            bool                  connectedToPPD = false;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "ESI Location Premise",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "ESI Location Premise Entry", "N/A", "");
            }


            try
            {
                if (ActiveKeyObject.FNO == 55)
                {
                    GetActiveComponent();

                    if (ActiveComponent.CNO == 5504)
                    {
                        rsPremise      = ActiveComponent.Recordset;
                        connectedToPPD = IsServicePointConnectedToPrimaryPointsDelivery();

                        if (rsPremise != null && rsPremise.RecordCount > 0 && connectedToPPD)
                        {
                            if (!rsPremise.EOF && !rsPremise.BOF)
                            {
                                if (string.IsNullOrEmpty(Convert.ToString(rsPremise.Fields["PREMISE_NBR"].Value)))
                                {
                                    validateMess = true;
                                }
                            }
                        }
                    }
                }

                if (validateMess)
                {
                    validateMsg.Rule_Id = "PESI01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    errorMsg.Add(validateMsg.Rule_MSG);
                    errorPriority.Add(Convert.ToString(Arguments.GetArgument(0)));

                    ErrorPriorityArray = errorPriority.ToArray();
                    ErrorMessageArray  = errorMsg.ToArray();
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "ESI Location Premise Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during execution of ESI Location Premise FI: " + ex.Message);
            }
        }
Пример #19
0
        /// <summary>
        /// Primary Conductor OH and UG validation.
        /// </summary>
        /// <param name="ErrorPriorityArray">Error messages that need to be displayed after validation</param>
        /// <param name="ErrorMessageArray">Error message Priority that need to be displayed after validation</param>
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            List <String> strErrorMsg      = new List <String>();
            List <String> strErrorPriority = new List <String>();

            ErrorMessageArray  = null;
            ErrorPriorityArray = null;
            ValidationRuleManager validateMsg = new ValidationRuleManager();

            object[]       messArguments = new object[2];
            IGTApplication gtApp         = (IGTApplication)GTClassFactory.Create <IGTApplication>();

            IGTComponent comp     = Components[ComponentName];
            IGTComponent compConn = Components["CONNECTIVITY_N"];
            IGTComponent compComm = Components["COMMON_N"];

            GTValidationLogger gTValidationLogger = null;
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Primary Conductor Validation",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Primary Conductor Validation Entry", "N/A", "");
            }


            gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Primary Conductor Validation Started");

            try
            {
                string errorPriorityPhasing = Convert.ToString(Arguments.GetArgument(0));
                string errorPriorityLength  = Convert.ToString(Arguments.GetArgument(1));
                int    maxUGLength          = Convert.ToInt32(Arguments.GetArgument(2));
                if (comp != null)
                {
                    comp.Recordset.MoveFirst();
                    compConn.Recordset.MoveFirst();
                    compComm.Recordset.MoveFirst();

                    short fno = Convert.ToInt16(comp.Recordset.Fields["G3E_FNO"].Value);
                    Int32 fid = Convert.ToInt32(comp.Recordset.Fields["G3E_FID"].Value);

                    if (fno == 8 || fno == 84)
                    {
                        m_compWire = Components["PRI_WIRE_OH_N"];
                    }
                    else if (fno == 9 || fno == 85)
                    {
                        m_compWire = Components["PRI_WIRE_UG_N"];
                    }

                    int    span_Length = compConn.Recordset.Fields["LENGTH_ACTUAL_Q"].Value == DBNull.Value ? 0 : Convert.ToInt32(compConn.Recordset.Fields["LENGTH_ACTUAL_Q"].Value);
                    string orientation = Convert.ToString(compComm.Recordset.Fields["ORIENTATION_C"].Value);
                    //strErrorPriority[0] = Convert.ToString(Arguments.GetArgument(0));

                    // IGTKeyObject igtActiveFeature = gtApp.DataContext.OpenFeature(fno, Convert.ToInt32(comp.Recordset.Fields["G3E_FID"].Value));

                    if (fno == 8 || fno == 84)
                    {
                        //primary conductor OH
                        if (m_compWire.Recordset != null && m_compWire.Recordset.RecordCount > 0)
                        {
                            m_compWire.Recordset.MoveFirst();
                            while (!m_compWire.Recordset.EOF && !m_compWire.Recordset.BOF)
                            {
                                string strSize = Convert.ToString(m_compWire.Recordset.Fields["SIZE_C"].Value);
                                if (!string.IsNullOrEmpty(strSize))
                                {
                                    strSize = strSize.Trim();
                                }
                                string strType = Convert.ToString(m_compWire.Recordset.Fields["TYPE_C"].Value);
                                if (!string.IsNullOrEmpty(strType))
                                {
                                    strType = strType.Trim();
                                }

                                if (!string.IsNullOrEmpty(Convert.ToString(m_compWire.Recordset.Fields["MAX_LENGTH_Q"].Value)))
                                {
                                    int maxLength = Convert.ToInt32(m_compWire.Recordset.Fields["MAX_LENGTH_Q"].Value);

                                    if (span_Length > maxLength)
                                    {
                                        validateMsg.Rule_Id = "PCND02";

                                        messArguments[0] = maxLength + " feet";
                                        messArguments[1] = strType;

                                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), messArguments);
                                        strErrorMsg.Add(validateMsg.Rule_MSG);
                                        strErrorPriority.Add(errorPriorityLength);
                                    }
                                }
                                //string strMsg = "OH span length exceeds recommended length " + span_Length + " for " + strType + " type.";

                                m_compWire.Recordset.MoveNext();
                            }
                        }
                    }
                    else if (fno == 9 || fno == 85)
                    {
                        if (span_Length > maxUGLength)
                        {
                            validateMsg.Rule_Id = "PCND01";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                            strErrorMsg.Add(validateMsg.Rule_MSG);
                            strErrorPriority.Add(errorPriorityLength);
                        }
                    }

                    if (!isPhaseDistinct(GetAggregatePhaseValue(m_compWire)))
                    {
                        validateMsg.Rule_Id = "PCND03";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        strErrorMsg.Add(validateMsg.Rule_MSG);
                        strErrorPriority.Add(errorPriorityPhasing);
                    }

                    gtApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Primary Conductor Validation Completed");

                    ErrorMessageArray  = strErrorMsg.ToArray();
                    ErrorPriorityArray = strErrorPriority.ToArray();
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Primary Conductor Validation Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Primary Conductor Validation" + ex.Message);
            }
        }
Пример #20
0
        /// <summary>
        /// Validate
        /// </summary>
        /// <param name="ErrorPriorityArray"></param>
        /// <param name="ErrorMessageArray"></param>
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            Recordset workPointRS = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Work Point Numbering",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Work Point Numbering Entry", "N/A", "");
            }

            try
            {
                string errorPriority  = Convert.ToString(Arguments.GetArgument(0));
                object workPointNbr   = m_gtComponentCollection[m_gtComponent].Recordset.Fields[m_sFieldName].Value == DBNull.Value ? null : m_gtComponentCollection[m_gtComponent].Recordset.Fields[m_sFieldName].Value;
                object workRequestNbr = m_gtComponentCollection[m_gtComponent].Recordset.Fields["WR_NBR"].Value == DBNull.Value ? null : m_gtComponentCollection[m_gtComponent].Recordset.Fields["WR_NBR"].Value;
                ErrorPriorityArray = new string[2];
                ErrorMessageArray  = new string[2];

                ValidationRuleManager validateMsg = new ValidationRuleManager();
                if (workPointNbr != null)
                {
                    if (Convert.ToInt32(workPointNbr) <= 0)
                    {
                        ErrorPriorityArray[0] = errorPriority;
                        validateMsg.Rule_Id   = "JM3";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);
                        ErrorMessageArray[0] = validateMsg.Rule_MSG;
                    }
                    else
                    {
                        workPointRS        = ExecuteCommand(string.Format("Select WP_NBR,WR_NBR from WORKPOINT_N"));
                        workPointRS.Filter = "WP_NBR = " + workPointNbr + " AND WR_NBR='" + workRequestNbr + "'";
                        if (workPointRS != null && workPointRS.RecordCount > 1)
                        {
                            ErrorPriorityArray[1] = errorPriority;
                            validateMsg.Rule_Id   = "JM4";
                            validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);
                            ErrorMessageArray[1] = validateMsg.Rule_MSG;
                        }
                    }
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Work Point Numbering Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Work Point Numbering Validation" + ex.Message);
            }
            finally
            {
                workPointRS = null;
            }
        }
Пример #21
0
        /// <summary>
        /// Method is used to add the error in message array id rules are satisfied.
        /// </summary>
        /// <param name="owner1ID"></param>
        /// <param name="owner2ID"></param>
        /// <param name="errorMsg"></param>
        /// <param name="errorPriority"></param>
        /// <param name="strOwner1FeatureState"></param>
        /// <param name="strOwner2FeatureState"></param>
        /// <param name="gTApplication"></param>
        /// <param name="validateMsg"></param>
        /// <param name="strFeatureState"></param>

        private void CheckOwnerShipStatus(int owner1ID, int owner2ID, List <string> errorMsg, List <string> errorPriority, ref string strOwner1FeatureState, ref string strOwner2FeatureState,
                                          IGTApplication gTApplication, ValidationRuleManager validateMsg, string strFeatureState)
        {
            try
            {
                object[] messArguments = new object[2];

                if (owner1ID > 0)
                {
                    strOwner1FeatureState = GetOwnerStatus(owner1ID);
                    if (strOwner1FeatureState == "PPR" || strOwner1FeatureState == "PPA" || strOwner1FeatureState == "ABR" || strOwner1FeatureState == "ABA" ||
                        strOwner1FeatureState == "OSR" || strOwner1FeatureState == "OSA" || strOwner1FeatureState == "LIP")
                    {
                        messArguments[0] = GetStatusAbbreviation(strFeatureState);
                        messArguments[1] = GetStatusAbbreviation(strOwner1FeatureState);

                        validateMsg.Rule_Id = "OWN02";
                        validateMsg.BuildRuleMessage(gTApplication, messArguments);

                        errorMsg.Add(validateMsg.Rule_MSG);
                        errorPriority.Add(Convert.ToString(m_arguments.GetArgument(0)));
                    }
                    else if (owner2ID > 0)
                    {
                        strOwner2FeatureState = GetOwnerStatus(owner2ID);
                        if (strOwner2FeatureState == "PPR" || strOwner2FeatureState == "PPA" || strOwner2FeatureState == "ABR" || strOwner2FeatureState == "ABA" ||
                            strOwner2FeatureState == "OSR" || strOwner2FeatureState == "OSA" || strOwner2FeatureState == "LIP")
                        {
                            messArguments[0] = GetStatusAbbreviation(strFeatureState);
                            messArguments[1] = GetStatusAbbreviation(strOwner2FeatureState);

                            validateMsg.Rule_Id = "OWN02";
                            validateMsg.BuildRuleMessage(gTApplication, messArguments);

                            errorMsg.Add(validateMsg.Rule_MSG);
                            errorPriority.Add(Convert.ToString(m_arguments.GetArgument(0)));
                        }
                    }
                }
                else if (owner2ID > 0)
                {
                    strOwner2FeatureState = GetOwnerStatus(owner2ID);
                    if (strOwner2FeatureState == "PPR" || strOwner2FeatureState == "PPA" || strOwner2FeatureState == "ABR" || strOwner2FeatureState == "ABA" ||
                        strOwner2FeatureState == "OSR" || strOwner2FeatureState == "OSA" || strOwner2FeatureState == "LIP")
                    {
                        messArguments[0] = GetStatusAbbreviation(strFeatureState);
                        messArguments[1] = GetStatusAbbreviation(strOwner2FeatureState);

                        validateMsg.Rule_Id = "OWN02";
                        validateMsg.BuildRuleMessage(gTApplication, messArguments);

                        errorMsg.Add(validateMsg.Rule_MSG);
                        errorPriority.Add(Convert.ToString(m_arguments.GetArgument(0)));
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Пример #22
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ADODB.Recordset rs           = null;
            int[]           spanFeatures = { 8, 84, 9, 85, 53, 96, 63, 97 };

            Int16 fnoActiveFeature = 0;
            int   owner1ID         = 0;
            int   owner2ID         = 0;

            List <string> errorMsg      = new List <string>();
            List <string> errorPriority = new List <string>();

            object[] messArguments = new object[2];

            bool passedValidation = true;

            ErrorPriorityArray = null;
            ErrorMessageArray  = null;
            string strActiveFeatureState = null;
            string strOwner1FeatureState = null;
            string strOwner2FeatureState = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Ownership Validation",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Ownership Validation Entry", "N/A", "");
            }


            IGTApplication        gTApplication = GTClassFactory.Create <IGTApplication>();
            ValidationRuleManager validateMsg   = new ValidationRuleManager();

            try
            {
                IGTComponent gtComponent = m_components[m_componentName];
                if (gtComponent != null)
                {
                    rs = gtComponent.Recordset;
                    if (rs != null && rs.RecordCount > 0)
                    {
                        rs.MoveFirst();
                    }
                    fnoActiveFeature = Convert.ToInt16(rs.Fields["G3E_FNO"].Value);


                    if ((!(rs.Fields["OWNER1_ID"].Value is DBNull) && Convert.ToInt32(rs.Fields["OWNER1_ID"].Value) > 0))
                    {
                        owner1ID = Convert.ToInt32(rs.Fields["OWNER1_ID"].Value);
                    }

                    if ((!(rs.Fields["OWNER2_ID"].Value is DBNull) && Convert.ToInt32(rs.Fields["OWNER2_ID"].Value) > 0))
                    {
                        owner2ID = Convert.ToInt32(rs.Fields["OWNER2_ID"].Value);
                    }

                    if (spanFeatures.Contains <int>(fnoActiveFeature))
                    {
                        if (owner1ID == owner2ID)
                        {
                            passedValidation = false;
                        }
                    }
                    if (!passedValidation)
                    {
                        validateMsg.Rule_Id = "OWN01";
                        validateMsg.BuildRuleMessage(gTApplication, null);

                        errorMsg.Add(validateMsg.Rule_MSG);
                        errorPriority.Add(Convert.ToString(m_arguments.GetArgument(0)));
                    }

                    if (!(rs.Fields["FEATURE_STATE_C"].Value is DBNull))
                    {
                        strActiveFeatureState = (String)rs.Fields["FEATURE_STATE_C"].Value;
                        if (strActiveFeatureState == "INI" || strActiveFeatureState == "CLS" || strActiveFeatureState == "PPI" || strActiveFeatureState == "PPX" ||
                            strActiveFeatureState == "ABI" || strActiveFeatureState == "ABX")
                        {
                            CheckOwnerShipStatus(owner1ID, owner2ID, errorMsg, errorPriority, ref strOwner1FeatureState, ref strOwner2FeatureState, gTApplication, validateMsg, strActiveFeatureState);
                        }
                    }

                    ErrorPriorityArray = errorPriority.ToArray();
                    ErrorMessageArray  = errorMsg.ToArray();
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Ownership Validation Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in Ownership Validaiton FI" + ex.Message);
            }
        }
Пример #23
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorMessageArray  = null;
            ErrorPriorityArray = null;
            List <String>         strErrorMsg      = new List <String>();
            List <String>         strErrorPriority = new List <String>();
            string                ownerType        = string.Empty;
            ValidationRuleManager validateMsg      = new ValidationRuleManager();

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Owning Company",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Owning Company Entry", "N/A", "");
            }

            try
            {
                IGTApplication iGtApplication = GTClassFactory.Create <IGTApplication>();
                iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Owning Company Validation Started");
                string    errorPriority     = Convert.ToString(m_Arguments.GetArgument(0));
                Recordset commonComponentRs = Components.GetComponent(1).Recordset;
                commonComponentRs.MoveFirst();
                short fno = Convert.ToInt16(commonComponentRs.Fields["G3E_FNO"].Value);

                if (fno != 110)
                {
                    if (gTValidationLogger != null)
                    {
                        gTValidationLogger.LogEntry("TIMING", "END", "Owning Company Exit", "N/A", "");
                    }
                    return;
                }

                ownerType = Convert.ToString(commonComponentRs.Fields["OWNED_TYPE_C"].Value);

                if (ownerType == "FOREIGN")
                {
                    if (string.IsNullOrEmpty(GetOwningCompany()))
                    {
                        validateMsg.Rule_Id = "OWNC01";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        strErrorMsg.Add(validateMsg.Rule_MSG);
                        strErrorPriority.Add(errorPriority);
                    }
                }

                if (ownerType == "COMPANY")
                {
                    string configuredCompany = GetConfiguredOwningCompany();
                    if (!Convert.ToString(GetOwningCompany()).ToUpper().Equals(Convert.ToString(configuredCompany).ToUpper()))
                    {
                        object[] messArguments = new object[1];
                        messArguments[0]    = configuredCompany;
                        validateMsg.Rule_Id = "OWNC02";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), messArguments);
                        strErrorMsg.Add(validateMsg.Rule_MSG);
                        strErrorPriority.Add(errorPriority);
                    }
                }

                iGtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Owning Company Validation Completed");
                ErrorMessageArray  = strErrorMsg.ToArray();
                ErrorPriorityArray = strErrorPriority.ToArray();

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Owning Company Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Owning Company FI validation. " + ex.Message);
            }
        }
Пример #24
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ADODB.Recordset rs     = null;
            ADODB.Recordset rsTemp = null;
            int             record = 0;
            bool            hasPhaseAndPosition     = true;
            bool            hasUnknownPhasePosition = false;

            ErrorPriorityArray = null;
            ErrorMessageArray  = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Phase Position",
                    ValidationInterfaceType = "FI"
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Phase Position Entry", "N/A", "");
            }


            try
            {
                List <string>         errorMsg      = new List <string>();
                List <string>         errorPriority = new List <string>();
                string                priority      = Convert.ToString(_arguments.GetArgument(0));
                ValidationRuleManager validateMsg   = new ValidationRuleManager();
                IGTApplication        gTApplication = GTClassFactory.Create <IGTApplication>();

                Recordset commonComponentRs = Components.GetComponent(1).Recordset;
                commonComponentRs.MoveFirst();
                string orientation        = Convert.ToString(commonComponentRs.Fields["ORIENTATION_C"].Value);
                int    fNo                = Convert.ToInt32(commonComponentRs.Fields["G3E_FNO"].Value);
                string featureName        = Convert.ToString(GetRecordSet(string.Format("select g3e_username NAME from g3e_features_optable where g3e_fno = {0}", fNo)).Fields["NAME"].Value);
                int    fId                = Convert.ToInt32(commonComponentRs.Fields["G3E_FID"].Value);
                bool   isFeatureConnected = CheckFeatureConnectivity(fId);

                ValidatePhaseAndPhasePosition(out hasPhaseAndPosition, out hasUnknownPhasePosition);
                if (orientation == "OH" && featureName.ToUpper().Contains("PRIMARY") && isFeatureConnected && hasUnknownPhasePosition)
                {
                    validateMsg.Rule_Id = "PHPS01";
                    validateMsg.BuildRuleMessage(gTApplication, null);

                    errorPriority.Add(priority);
                    errorMsg.Add(validateMsg.Rule_MSG);

                    //errorMsg.Add("Overhead feature is missing phase position values.");
                }

                if (ValidatePhasePositionWithSets())
                {
                    validateMsg.Rule_Id = "PHPS02";
                    validateMsg.BuildRuleMessage(gTApplication, null);

                    errorPriority.Add(priority);
                    errorMsg.Add(validateMsg.Rule_MSG);

                    //errorMsg.Add("Phase Position attributes are not consistent with respect to one another.");
                }

                if (_fieldName == "PHASE_POS_C")
                {
                    string       sqlStmt     = "Select {0},count({0}) from {1} where g3e_fid={2} and g3e_fno={3} GROUP BY {0} having count({0})>1";
                    IGTComponent gtComponent = _components[_componentName];
                    if (gtComponent != null)
                    {
                        rs = gtComponent.Recordset;
                        if (rs != null && rs.RecordCount > 0)
                        {
                            rs.MoveFirst();
                            if (Convert.ToInt32(rs.Fields["G3e_CID"].Value) == 1)
                            {
                                //JIRA 195- check Duplicate Phase Position
                                rsTemp = _dataContext.Execute(string.Format(sqlStmt, _fieldName, _componentName, rs.Fields["G3e_FID"].Value, rs.Fields["G3e_FNO"].Value), out record, (int)ADODB.CommandTypeEnum.adCmdText, null);
                                if (rsTemp != null && rsTemp.RecordCount > 0)
                                {
                                    validateMsg.Rule_Id = "PHPS02";
                                    validateMsg.BuildRuleMessage(gTApplication, null);

                                    errorMsg.Add(validateMsg.Rule_MSG);
                                    //errorMsg.Add("Feature has duplicate Phase Positions. Phase Position should be unique across all the wires within same conductor.");
                                    errorPriority.Add(priority);
                                }
                            }
                        }
                    }
                    if (errorMsg.Count > 0)
                    {
                        ErrorPriorityArray = errorPriority.ToArray();
                        ErrorMessageArray  = errorMsg.ToArray();
                    }
                }

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Phase Position Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error during Phase position validation FI. " + ex.Message, Caption);
            }
            finally
            {
                rsTemp = null;
            }
        }
Пример #25
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            List <string>         lstErrorMsg      = new List <string>();
            List <string>         lstErrorPriority = new List <string>();
            ValidationRuleManager validateMsg      = new ValidationRuleManager();

            ErrorMessageArray  = null;
            ErrorPriorityArray = null;

            GTValidationLogger gTValidationLogger = null;
            IGTComponent       comp = Components[ComponentName];
            int FID = 0;

            string fieldValue = string.Empty;

            if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
            {
                FID        = int.Parse(comp.Recordset.Fields["G3E_FID"].Value.ToString());
                fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ComponentName,
                    ActiveFID           = FID,
                    ActiveFieldName     = FieldName,
                    ActiveFieldValue    = fieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = "N/A",
                    RelatedFID              = 0,
                    RelatedFieldName        = "N/A",
                    RelatedFieldValue       = "N/A",
                    ValidationInterfaceName = "Equipment Attachment Position",
                    ValidationInterfaceType = "FI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Equipment Attachment Position Entry", "N/A", "");
            }

            try
            {
                string strAttType, strAttPosition;

                if (comp != null)
                {
                    //comp.Recordset.MoveFirst();
                    strAttType     = comp.Recordset.Fields["E_ATTACH_TYPE_C"].Value.ToString();
                    strAttPosition = comp.Recordset.Fields["E_ATTACH_POSITION_C"].Value.ToString();

                    if (strAttPosition == "Top of Pole" && strAttType != "Antenna")
                    {
                        validateMsg.Rule_Id = "EQAP01";
                        validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                        lstErrorMsg.Add(validateMsg.Rule_MSG);
                        //lstErrorPriority.Add("P1");
                        lstErrorPriority.Add(Arguments.GetArgument(0).ToString());
                    }
                }

                ErrorMessageArray  = lstErrorMsg.ToArray();
                ErrorPriorityArray = lstErrorPriority.ToArray();

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Equipment Attachment Position Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error during Attachment Position Validation" + ex.Message);
            }
        }