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); } }
public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = null; ErrorMessageArray = null; string errorPriority = Convert.ToString(Arguments.GetArgument(0)); GTValidationLogger gTValidationLogger = null; if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = Convert.ToString(ActiveFeature.CNO), ActiveFID = ActiveFeature.FID, ActiveFieldName = "N/A", ActiveFieldValue = "N/A", JobID = DataContext.ActiveJob, RelatedComponentName = Convert.ToString(RelatedCNO), RelatedFID = 0, RelatedFieldName = "N/A", RelatedFieldValue = "N/A", ValidationInterfaceName = "Voltage Agreement", ValidationInterfaceType = "RGI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Voltage Agreement Entry", "N/A", ""); } try { IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>(); gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Started"); SetAffectedRelatedNodeVoltages(errorPriority); if (m_lstErrorMessage.Count > 0) { ErrorMessageArray = m_lstErrorMessage.ToArray(); ErrorPriorityArray = m_lstErrorPriority.ToArray(); } gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Voltage Agreement Validation Completed"); if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Voltage Agreement Exit", "N/A", ""); } } catch (Exception ex) { throw new Exception("Error in Voltage Agreement Relationship Geometry Interface-Validate: " + ex.Message); } }
/// <summary> /// Method for Validate. /// </summary> private void ProcessValidate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { try { ErrorPriorityArray = null; ErrorMessageArray = null; GTValidationLogger gTValidationLogger = null; if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = Convert.ToString(m_rgiBaseClass.ActiveFeature.CNO), ActiveFID = m_rgiBaseClass.ActiveFeature.FID, ActiveFieldName = "N/A", ActiveFieldValue = "N/A", JobID = m_rgiBaseClass.DataContext.ActiveJob, RelatedComponentName = Convert.ToString(m_rgiBaseClass.RelatedCNO), RelatedFID = 0, RelatedFieldName = "N/A", RelatedFieldValue = "N/A", ValidationInterfaceName = "Feeder Agreement", ValidationInterfaceType = "RGI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Feeder Agreement Entry", "N/A", ""); } IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>(); gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Started"); ProcessEstablish(); if (m_lstErrorMessage.Count > 0) { ErrorMessageArray = m_lstErrorMessage.ToArray(); ErrorPriorityArray = m_lstErrorPriority.ToArray(); } gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Agreement Validation Completed"); if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Feeder Agreement Exit", "N/A", ""); } } catch { throw; } }
/// <summary> /// Validate Logger to check the entry and exit of the FI. /// </summary> /// <param name="gTValidationLogger"></param> private void ValidationLog(ref GTValidationLogger gTValidationLogger) { int fid = 0; string fieldValue = string.Empty; try { IGTComponent comp = Components[ComponentName]; if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0) { comp.Recordset.MoveFirst(); fid = Convert.ToInt32(comp.Recordset.Fields["G3E_FID"].Value); 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 = "Feeder Validaiton", ValidationInterfaceType = "FI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Feeder Validaiton FI Entry", "N/A", ""); } } catch { throw; } }
/// <summary> /// Validate /// </summary> /// <param name="ErrorPriorityArray"></param> /// <param name="ErrorMessageArray"></param> public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = new string[1]; ErrorMessageArray = new string[1]; 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 = "Validate Isolation", ValidationInterfaceType = "FI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Validate Isolation Entry", "N/A", ""); } try { short activeFNO = Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value); bool isIsolationScenario = false; IsolationScenarios isolationScenarioType = IsolationScenarios.NULL; if (m_IsoScenarioFNOs.Contains(activeFNO)) { // Check if active feature is an Isolation Scenario feature. if (CheckIsoScenarioFeature(m_gComps, activeFNO, ref isIsolationScenario, ref isolationScenarioType)) { if (isIsolationScenario) { string errorPriority = Convert.ToString(Arguments.GetArgument(0)); string activeFeatureState = null; string feedType = null; short numberofNodes = 0; IGTKeyObject m_activeFeature = GTClassFactory.Create <IGTKeyObject>(); IGTKeyObject relativeFeature = GTClassFactory.Create <IGTKeyObject>(); IGTKeyObjects m_relatedNode1Features = null; IGTKeyObjects m_relatedNode2Features = null; Recordset activeFeatureConnRS = null; List <IGTKeyObject> node1FeaturesLst = new List <IGTKeyObject>(); List <IGTKeyObject> node2FeaturesLst = new List <IGTKeyObject>(); m_activeFeature = DataContext.OpenFeature(Convert.ToInt16(Components[ComponentName].Recordset.Fields["G3E_FNO"].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields["G3E_FID"].Value)); GetNumberOfNodes(m_activeFeature, ref numberofNodes); m_relatedNode1Features = GetRelatedFeatures(m_activeFeature, m_cRNO, "NODE1"); if (numberofNodes == 2) { m_relatedNode2Features = GetRelatedFeatures(m_activeFeature, m_cRNO, "NODE2"); } activeFeatureConnRS = m_activeFeature.Components.GetComponent(m_cCNO).Recordset; if (activeFeatureConnRS.RecordCount > 0) { activeFeatureConnRS.MoveFirst(); m_aNode1 = Convert.ToInt32(activeFeatureConnRS.Fields["NODE_1_ID"].Value == System.DBNull.Value ? 0 : activeFeatureConnRS.Fields["NODE_1_ID"].Value); m_aNode2 = Convert.ToInt32(activeFeatureConnRS.Fields["NODE_2_ID"].Value == System.DBNull.Value ? 0 : activeFeatureConnRS.Fields["NODE_2_ID"].Value); if (m_activeFeature.Components.GetComponent(1).Recordset != null && m_activeFeature.Components.GetComponent(1).Recordset.RecordCount > 0) { m_activeFeature.Components.GetComponent(1).Recordset.MoveFirst(); activeFeatureState = Convert.ToString(m_activeFeature.Components.GetComponent(1).Recordset.Fields["FEATURE_STATE_C"].Value); } if (m_activeFeature.FNO == 59 && m_activeFeature.Components.GetComponent(5901).Recordset != null && m_activeFeature.Components.GetComponent(5901).Recordset.RecordCount > 0) { m_activeFeature.Components.GetComponent(5901).Recordset.MoveFirst(); feedType = Convert.ToString(m_activeFeature.Components.GetComponent(5901).Recordset.Fields["FEED_TYPE"].Value); } else if (m_activeFeature.FNO == 60 && m_activeFeature.Components.GetComponent(6002).Recordset != null && m_activeFeature.Components.GetComponent(6002).Recordset.RecordCount > 0) { m_activeFeature.Components.GetComponent(6002).Recordset.MoveFirst(); feedType = Convert.ToString(m_activeFeature.Components.GetComponent(6002).Recordset.Fields["FEED_TYPE"].Value); } } if (CheckFeatureState(activeFeatureState)) { if (m_relatedNode1Features != null) { foreach (IGTKeyObject feature in m_relatedNode1Features) { node1FeaturesLst.Add(feature); } } if (m_relatedNode2Features != null) { foreach (IGTKeyObject feature in m_relatedNode2Features) { node2FeaturesLst.Add(feature); } } //ISODUAL if (m_activeFeature.FNO == 34) //Autotransformer { IProcessIsolationScenario isoDual = new IsoDualScenario(node1FeaturesLst.Where(a => a.FNO == 6).ToList(), node2FeaturesLst.Where(a => a.FNO == 6).ToList(), errorPriority); isoDual.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]); } //ISOSINGLE if (m_activeFeature.FNO == 4 || m_activeFeature.FNO == 12 || m_activeFeature.FNO == 59 || (m_activeFeature.FNO == 60 && feedType.ToUpper() == "RADIAL")) { IProcessIsolationScenario isoSingle = new IsoSingleScenario(node1FeaturesLst.Where(a => a.FNO == 6).ToList(), node2FeaturesLst.Where(a => a.FNO == 6).ToList(), errorPriority); isoSingle.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]); } //ISOSINGLE NETWORK FEATURES if (m_activeFeature.FNO == 99 || m_activeFeature.FNO == 98) { IProcessIsolationScenario isoSingle = new IsoSingleScenario(node1FeaturesLst.Where(a => a.FNO == 82).ToList(), node2FeaturesLst.Where(a => a.FNO == 82).ToList(), errorPriority); isoSingle.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]); } //ELBOW need clarification if (m_activeFeature.FNO == 5 || (m_activeFeature.FNO == 60 && feedType.ToUpper() == "LOOP")) { IProcessIsolationScenario elbowScenario = new ElbowScenario(node1FeaturesLst.Where(a => a.FNO == 41).ToList(), node2FeaturesLst.Where(a => a.FNO == 41).ToList(), errorPriority); elbowScenario.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]); } //BYPASS if (m_activeFeature.FNO == 14 || m_activeFeature.FNO == 15 || m_activeFeature.FNO == 36) { IProcessIsolationScenario byPassScenario = new ByPassScenario(node1FeaturesLst.Where(a => a.FNO == 40).ToList(), node2FeaturesLst.Where(a => a.FNO == 40).ToList(), errorPriority); byPassScenario.ProcessIsolationScenario(out ErrorMessageArray[0], out ErrorPriorityArray[0]); } } } } } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END ", "Validate Isolation Exit", "N/A", ""); } } catch (Exception ex) { throw new Exception("Error from Isolation Scenario FI: " + ex.Message); } }
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); } }
/// <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); } }
public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = null; ErrorMessageArray = null; if (string.IsNullOrEmpty(DataContext.ActiveJob)) { return; } if (IsCorrectionJob()) { return; } if (IsFeatureOwnedToPrimarySwitchGear(Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fid"].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fno"].Value))) { return; } if (!IsFeatureEdited(Convert.ToInt32(Components[ComponentName].Recordset.Fields["g3e_fid"].Value))) { return; } m_WorkPointCommonFunctions = new WorkPointCommonFunctions(ActiveKeyObject, DataContext); List <string> m_lstErrorMessage = new List <string>(); List <string> m_lstErrorPriority = new List <string>(); int FID = 0; IGTComponent comp = Components[ComponentName]; string fieldValue = string.Empty; GTValidationLogger gTValidationLogger = null; 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 = "Accounting Impact", ValidationInterfaceType = "FI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Accounting Impact Entry", "N/A", ""); } try { // //Features in the state CLS, OSR, OSA, or LIP do not require Validation as they interfere with the WMIS closure batch process if (!IsValidFeatureState()) { if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Accounting Impact Exit", "N/A", ""); } return; } string errorPriorityNoWorkpoint = Convert.ToString(Arguments.GetArgument(0)); string errorPriorityNoMatchingWorkPoint = Convert.ToString(Arguments.GetArgument(0)); m_gTActiveComponent = GetActiveComponent(); m_WorkPointCommonFunctions.m_gTActiveComponent = m_gTActiveComponent; m_WorkPointCommonFunctions.m_gTComponents = Components; if ((m_gTActiveComponent != null) && (m_gTActiveComponent.CNO == 21 || m_gTActiveComponent.CNO == 22)) { ValidateFeature(errorPriorityNoWorkpoint, errorPriorityNoMatchingWorkPoint, ref m_lstErrorMessage, ref m_lstErrorPriority); if (m_lstErrorMessage.Count > 0) { ErrorMessageArray = m_lstErrorMessage.ToArray(); ErrorPriorityArray = m_lstErrorPriority.ToArray(); } } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Accounting Impact Exit", "N/A", ""); } } catch (Exception ex) { if (null != ex.InnerException && "MULTIPLE WORKPOINTS" == ex.InnerException.Message) { ErrorPriorityArray = new string[1]; ErrorMessageArray = new string[1]; ErrorMessageArray[0] = ex.Message; ErrorPriorityArray[0] = "P1"; } else { throw new Exception("Error during execution of Accounting Impact FI." + Environment.NewLine + ex.Message); } } }
public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = new string[1]; ErrorMessageArray = new string[1]; List <string> lstErrors = new List <string>(); List <string> lstPriority = new List <string>(); 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 = "Protective Device Validation", ValidationInterfaceType = "RAI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Protective Device Validation Entry", "N/A", ""); } try { ProcessValidate(ref lstPriority, ref lstErrors); // ProcessValidate(ref lstPriority, ref lstErrors, "PP_PROTECTIVE_DEVICE_FID"); if (lstErrors.Count > 0) { ErrorPriorityArray = lstPriority.ToArray(); ErrorMessageArray = lstErrors.ToArray(); } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Protective Device Validation Exit", "N/A", ""); } } catch (Exception) { throw; //Just throwing error so that it will be added to the Validation Errors grid automatically } }
/// <summary> /// Validate /// </summary> /// <param name="ErrorPriorityArray"></param> /// <param name="ErrorMessageArray"></param> public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { 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 Agreement", ValidationInterfaceType = "FI" }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Phase Agreement Entry", "N/A", ""); } ErrorPriorityArray = null; ErrorMessageArray = null; IGTKeyObject affectedFeatureKeyObject = GTClassFactory.Create <IGTKeyObject>(); IGTKeyObjects relatedFeaturesKeyObjects = GTClassFactory.Create <IGTKeyObjects>(); List <char> downstreamPhaseList = new List <char>(); List <char> upstreamPhaseList = new List <char>(); List <char> insidePhaseList = new List <char>(); List <char> parallelPhaseList = new List <char>(); List <char> outsidePhaseList = new List <char>(); List <string> errorMessage = new List <string>(); List <string> errorPriority = new List <string>(); GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Phase Agreement FI"); try { if (!CheckAffectedFeatureIsSecondary()) // Check for affected feature is secondary or not { if (m_affectedConnectivityRs.RecordCount > 0) { m_affectedConnectivityRs.MoveFirst(); m_aNode1 = Convert.ToInt32(m_affectedConnectivityRs.Fields[ATTRIB_NODE1].Value == DBNull.Value ? 0.0 : m_affectedConnectivityRs.Fields[ATTRIB_NODE1].Value); m_aNode2 = Convert.ToInt32(m_affectedConnectivityRs.Fields[ATTRIB_NODE2].Value == DBNull.Value ? 0.0 : m_affectedConnectivityRs.Fields[ATTRIB_NODE2].Value); if (m_aNode1 != 0 || m_aNode2 != 0) { m_activeFeaturePhase = Convert.ToString(m_affectedConnectivityRs.Fields[ATTRIB_PHASE].Value); affectedFeatureKeyObject = DataContext.OpenFeature(Convert.ToInt16(Components[ComponentName].Recordset.Fields[ATTRIB_FNO].Value), Convert.ToInt32(Components[ComponentName].Recordset.Fields[ATTRIB_FID].Value)); // Gets the related features of affected feature. relatedFeaturesKeyObjects = GetRelatedFeatures(affectedFeatureKeyObject, m_cRNO); GetNumberOfNodes(affectedFeatureKeyObject); if (m_numberofNodes == 2) { ConnectivityFactory connecFactory = new ConnectivityHelperFactory(); //Collects phase list of parallel features of affected feature. GetParallelFeaturesPhaseList(affectedFeatureKeyObject, connecFactory, ref parallelPhaseList); //Collects phase list of Upstream features of affected feature. GetUpstreamFeaturesPhaseList(affectedFeatureKeyObject, connecFactory, ref upstreamPhaseList); //Collects phase list of DownStream features of affected feature. GetDownStreamFeaturesPhaseList(affectedFeatureKeyObject, connecFactory, ref downstreamPhaseList); //Collects phase list of Inside features of affected feature. GetInsideFeaturesPhaseList(affectedFeatureKeyObject, connecFactory, ref insidePhaseList); //Collects phase list of Outside features of affected feature. GetOutsideFeaturesPhaseList(affectedFeatureKeyObject, connecFactory, ref outsidePhaseList); } //Validates the Phase values based on different conditions ValidatePhase(outsidePhaseList, insidePhaseList, parallelPhaseList, upstreamPhaseList, downstreamPhaseList, relatedFeaturesKeyObjects, affectedFeatureKeyObject.FNO, ref errorPriority, ref errorMessage); if (errorMessage.Count > 0) { ErrorPriorityArray = errorPriority.ToArray(); ErrorMessageArray = errorMessage.ToArray(); } } } } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Phase Agreement Exit", "N/A", ""); } } catch (Exception ex) { throw new Exception("Error during Phase agreement Validation" + ex.Message); } finally { downstreamPhaseList = null; upstreamPhaseList = null; insidePhaseList = null; outsidePhaseList = null; } }
public override void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = new string[1]; ErrorMessageArray = new string[1]; IGTKeyObject oRelatedFeature = null; IGTKeyObjects oRelatedFeatureOwnedBy = null; string sPriCondNodeType = string.Empty; IGTKeyObject oActiveFeature = null; IGTKeyObjects oActiveFeatureOwnedBy = null; int activePhaseCount = 0; 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 = "Feeder Validation", ValidationInterfaceType = "RAI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Feeder Validation Entry", "N/A", ""); } DataAccessLayer dataAccessLayer = new DataAccessLayer(DataContext); try { GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feeder Validation Started"); SetVariables(dataAccessLayer); string strRelatedFeederAttribute = Convert.ToString(RelatedFieldValue.FieldValue); string strActiveFeederAttribute = Convert.ToString(ActiveFieldValue.FieldValue); if (m_sTieAttribute != null) { string strActiveTieFeederAttribute = dataAccessLayer.GetTieFeederAttribute(ActiveComponents[ActiveComponentName], m_sTieAttribute); if (!string.Equals(strRelatedFeederAttribute, strActiveFeederAttribute) && !string.Equals(strRelatedFeederAttribute, strActiveTieFeederAttribute)) { ShowValidation(out ErrorPriorityArray[0], out ErrorMessageArray[0]); } } else { if (!string.Equals(strRelatedFeederAttribute, strActiveFeederAttribute) && string.Equals(m_sNormalStatus.ToUpper(), "CLOSED")) { ShowValidation(out ErrorPriorityArray[0], out ErrorMessageArray[0]); } } GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Network Management Validation Completed"); if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Feeder Validation Exit", "N/A", ""); } } catch (Exception ex) { throw new Exception("Error in Feeder Validation Relationship Attribute Interface \n" + ex.Message); } finally { dataAccessLayer = null; } }
/// <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); } }
public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { ErrorPriorityArray = new string[1]; ErrorMessageArray = new string[1]; short iFNOActive = 0; int iFIDActive = 0; short iFNORelated = 0; int iFIDRelated; string sActivePhase = string.Empty; IGTRelationshipService relationShipService = GTClassFactory.Create <IGTRelationshipService>(); IGTKeyObject oRelatedFeature = null; IGTKeyObjects oRelatedFeatureOwnedBy = null; string sPriCondNodeType = string.Empty; IGTKeyObject oActiveFeature = null; IGTKeyObjects oActiveFeatureOwnedBy = null; int activePhaseCount = 0; GTValidationLogger gTValidationLogger = null; IGTComponent activeComponent = ActiveComponents[ActiveComponentName]; int activeFID = 0; if (activeComponent != null) { activeComponent.Recordset.MoveFirst(); activeFID = int.Parse(activeComponent.Recordset.Fields["G3E_FID"].Value.ToString()); } IGTComponent relatedComponent = RelatedComponents[RelatedComponentName]; int relatedFID = 0; if (relatedComponent != null) { relatedComponent.Recordset.MoveFirst(); relatedFID = int.Parse(relatedComponent.Recordset.Fields["G3E_FID"].Value.ToString()); } if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = ActiveComponentName, ActiveFID = activeFID, ActiveFieldName = ActiveFieldName, ActiveFieldValue = Convert.ToString(activeComponent.Recordset.Fields[ActiveFieldName].Value), JobID = DataContext.ActiveJob, RelatedComponentName = RelatedComponentName, RelatedFID = relatedFID, RelatedFieldName = RelatedFieldName, RelatedFieldValue = Convert.ToString(relatedComponent.Recordset.Fields[RelatedFieldName].Value), ValidationInterfaceName = "Conductor Validation", ValidationInterfaceType = "RAI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Conductor Validation Entry", "N/A", ""); } try { if (m_oActiveComponents[m_sActiveComponentName].Recordset != null) { if (!(m_oActiveComponents[m_sActiveComponentName].Recordset.EOF && m_oActiveComponents[m_sActiveComponentName].Recordset.BOF)) { iFNOActive = Convert.ToInt16(m_oActiveComponents[m_sActiveComponentName].Recordset.Fields["g3e_fno"].Value); iFIDActive = Convert.ToInt32(m_oActiveComponents[m_sActiveComponentName].Recordset.Fields["g3e_fid"].Value); sActivePhase = Convert.ToString(m_oActiveComponents[m_sActiveComponentName].Recordset.Fields["PHASE_ALPHA"].Value); activePhaseCount = sActivePhase.Length; oActiveFeature = m_oDataContext.OpenFeature(iFNOActive, iFIDActive); } } if (m_oRelatedComponents[m_sRelatedComponentName].Recordset != null) { if (!(m_oRelatedComponents[m_sRelatedComponentName].Recordset.EOF && m_oRelatedComponents[m_sRelatedComponentName].Recordset.BOF)) { iFNORelated = Convert.ToInt16(m_oRelatedComponents[m_sRelatedComponentName].Recordset.Fields["g3e_fno"].Value); iFIDRelated = Convert.ToInt32(m_oRelatedComponents[m_sRelatedComponentName].Recordset.Fields["g3e_fid"].Value); oRelatedFeature = m_oDataContext.OpenFeature(iFNORelated, iFIDRelated); if (iFNORelated == 10) //Primary Conductor Node - Store the Type as well { oRelatedFeature.Components["PRI_COND_NODE_N"].Recordset.MoveFirst(); sPriCondNodeType = Convert.ToString(oRelatedFeature.Components["PRI_COND_NODE_N"].Recordset.Fields["TYPE_C"].Value); } } } if ((iFNOActive == 8 || iFNOActive == 9) && (iFNORelated == 13 || iFNORelated == 39) && activePhaseCount == 1) { if (sActivePhase != "*") { relationShipService.DataContext = m_oDataContext; relationShipService.ActiveFeature = oRelatedFeature; oRelatedFeatureOwnedBy = relationShipService.GetRelatedFeatures(3); if (oRelatedFeatureOwnedBy != null && oRelatedFeatureOwnedBy.Count > 0) { for (int i = 0; i < oRelatedFeatureOwnedBy.Count; i++) { if (oRelatedFeatureOwnedBy[i].FNO == 19) { ErrorPriorityArray[0] = m_sPriority; ErrorMessageArray[0] = "Single-phase conductor should not be connected to a switch gear"; } } } } } if ((iFNOActive == 8 || iFNOActive == 9) && iFNORelated == 10 && sPriCondNodeType.Equals("DEADEND")) { relationShipService.DataContext = m_oDataContext; relationShipService.ActiveFeature = oActiveFeature; oActiveFeatureOwnedBy = relationShipService.GetRelatedFeatures(3); if (oActiveFeatureOwnedBy != null && oActiveFeatureOwnedBy.Count > 0) { for (int i = 0; i < oActiveFeatureOwnedBy.Count; i++) { if (oActiveFeatureOwnedBy[i].FNO == 110) { IGTKeyObject oPoleOwner = null; bool bGuyFound = false; IGTKeyObjects oFeatureOwnedByPole = null; oPoleOwner = m_oDataContext.OpenFeature(oActiveFeatureOwnedBy[i].FNO, oActiveFeatureOwnedBy[i].FID); relationShipService.DataContext = m_oDataContext; relationShipService.ActiveFeature = oPoleOwner; oFeatureOwnedByPole = relationShipService.GetRelatedFeatures(2); if (oFeatureOwnedByPole != null && oFeatureOwnedByPole.Count > 0) { for (int j = 0; j < oFeatureOwnedByPole.Count; j++) { if (oFeatureOwnedByPole[j].FNO == 105) { bGuyFound = true; break; } } } if (!bGuyFound) { ErrorPriorityArray[0] = m_sPriority; ErrorMessageArray[0] = "Primary Conductor with a dead end should have a guy present"; } } } } } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Conductor Validation Exit", "N/A", ""); } } catch (Exception ex) { MessageBox.Show("Error in Conductor Validation Relationship Attribute Interface \n" + ex.Message, "G/Technology"); } finally { if (relationShipService != null) { relationShipService.Dispose(); relationShipService = null; } } }
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); } }
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); } }
/// <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; } }
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); } }
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); } }
/// <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; } }
//this function is called upon validation. It was made a seperate function from Execute(), because the processing is slightly different. public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray) { try { Recordset RS; jobService.DataContext = m_DataContext; object[] arguments = m_Arguments.GTechArgumentArray; string errorP1 = arguments[0].ToString(); string errorP2 = arguments[1].ToString(); string error; List <string> priorityList = new List <string>(); List <string> messageList = new List <string>(); 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()); if (FieldName != "G3E_GEOMETRY") { fieldValue = Convert.ToString(comp.Recordset.Fields[FieldName].Value); } } if (new gtLogHelper().CheckIfLoggingIsEnabled()) { LogEntries logEntries = new LogEntries { ActiveComponentName = ComponentName, ActiveFID = FID, ActiveFieldName = FieldName, ActiveFieldValue = FieldName == "G3E_GEOMETRY" ? "N/A" : fieldValue, JobID = DataContext.ActiveJob, RelatedComponentName = "N/A", RelatedFID = 0, RelatedFieldName = "N/A", RelatedFieldValue = "N/A", ValidationInterfaceName = "Street Light Account Agreement", ValidationInterfaceType = "FI", }; gTValidationLogger = new GTValidationLogger(logEntries); gTValidationLogger.LogEntry("TIMING", "START", "Street Light Account Agreement Entry", "N/A", ""); } if (m_FieldName.ToUpper() == "G3E_GEOMETRY") //check for boundary error { //check for errors releated to street light symbol being moved error = CheckForBoundaryErrorValidate(); if (!string.IsNullOrEmpty(error)) //if error conditions were met in method { priorityList.Add(errorP2); messageList.Add(error); } } //check for account matching error if (m_FieldName.ToUpper() == "ACCOUNT_ID") { error = CheckForAccountMatchErrorValidate(); if (!string.IsNullOrEmpty(error)) //if error conditions were met in method { priorityList.Add(errorP2); messageList.Add(error); } } //check for SLA errors string SQL = "select granted_role from user_role_privs where granted_role = ?"; RS = m_DataContext.OpenRecordset(SQL, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, "PRIV_MGMT_STLT"); if (!(RS.RecordCount > 0)) //if user does NOT have SLA role { //check for a street light that has a restricted accounts, pending edits, and is part of an active job. error = CheckForRestrictedAndPendingEditsValidate(); if (!string.IsNullOrEmpty(error)) //if error conditions were met in method, stop code. { priorityList.Add(errorP1); messageList.Add(error); } //check for street lights that are non-located error = CheckForNonLocatedStreetLightValidate(); if (!string.IsNullOrEmpty(error)) //if error conditions were met in method, stop code. { priorityList.Add(errorP1); messageList.Add(error); } } //make the list into arrays which are passed out as an out parameter if (!priorityList.Equals(null) && priorityList.Any() && !messageList.Equals(null) && messageList.Any()) { ErrorPriorityArray = priorityList.ToArray(); ErrorMessageArray = messageList.ToArray(); } else { ErrorPriorityArray = null; ErrorMessageArray = null; } if (gTValidationLogger != null) { gTValidationLogger.LogEntry("TIMING", "END", "Street Light Account Agreement Exit", "N/A", ""); } } catch (Exception ex) { string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message); throw new Exception(exMsg); } }
public 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); } }
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; } }
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); } }