Exemplo n.º 1
0
        private void FillEMSLoadFlowNodeProperties(List <long> gids)
        {
            long mdc = 0;

            if (gids.Count <= 0)
            {
                return;
            }
            var iteratorId = GdaQuery.GetDescendentValues(0,
                                                          new List <ModelCode> {
                ModelCode.BUSNODERESLF_LINETOLINE_VMIN,
                ModelCode.,
                ModelCode.,
            }, new List <Association>(), gids, new List <Association>(), ref mdc);
Exemplo n.º 2
0
        /// <summary>
        /// Method is used for preparing input data.
        /// </summary>
        public void PrepareReportData()
        {
            long mdc = 0;
            int  iteratorId;
            int  count;

            if (containerHierarchyTree == null || containerHierarchyTree.AllNodes == null)
            {
                DMSLogger.Log(DMSLogger.LogLevel.DebugLog, "[reportParam]: PrepareReReportData all nodes in hierarchy tree are null.");
                return;
            }

            HierarchicalFilter hierTree = containerHierarchyTree;

            hierarchicalRecordData = new Dictionary <long, HierarchicalRecordData>(hierTree.AllNodes.Count);

            if (selectedRecords == null)
            {
                DMSLogger.Log(DMSLogger.LogLevel.DebugLog, "[EMSLoadFlowEMSLF]: PrepareReportData selected record is null.");
                return;
            }

            foreach (long nodeID in selectedRecords.Where(nodeID => !hierarchicalRecordData.ContainsKey(nodeID)))
            {
                hierarchicalRecordData.Add(nodeID, new EMSLoadFlowRecordBean());
            }

            // Get Names for all circuits
            List <long> nameSources = new List <long>(hierarchicalRecordData.Keys);

            if (nameSources.Count <= 0)
            {
                DMSLogger.Log(DMSLogger.LogLevel.DebugLog, "[EMSLoadFlow]: PrepareReportData selected records count is not possitive.");
                return;
            }
            try
            {
                mdc        = 0;
                iteratorId = GdaQuery.GetDescendentValues(0, new List <ModelCode>(new[] { ModelCode.IDOBJ_NAME }), new List <Association>(), nameSources, new List <Association>(), ref mdc);
                count      = GdaQuery.IteratorResourcesLeft(iteratorId);
                while (count > 0)
                {
                    List <ResourceDescription> rds = GdaQuery.IteratorNext(50000, iteratorId);
                    for (int i = 0; i < rds.Count; i++)
                    {
                        hierarchicalRecordData[rds[i].Id].Name = rds[i].GetProperty(ModelCode.IDOBJ_NAME).AsString();
                    }

                    count -= rds.Count;
                }

                GdaQuery.IteratorClose(iteratorId);

                mdc        = 0;
                iteratorId = GdaQuery.GetDescendentValues(0, new List <ModelCode>(new[] { ModelCode.LFRESVAL_QUALITY }), new List <Association>(), nameSources, new List <Association>(), ref mdc);
                count      = GdaQuery.IteratorResourcesLeft(iteratorId);
                while (count > 0)
                {
                    List <ResourceDescription> rds = GdaQuery.IteratorNext(50000, iteratorId);
                    for (int i = 0; i < rds.Count; i++)
                    {
                        EMSLoadFlowRecordBean temp = (EMSLoadFlowRecordBean)hierarchicalRecordData[rds[i].Id];
                        temp.Quality = (MeasurementValueQuality)rds[i].GetProperty(ModelCode.LFRESVAL_QUALITY).AsInt();
                    }

                    count -= rds.Count;
                }

                GdaQuery.IteratorClose(iteratorId);
            }
            catch (Exception ex)
            {
                DMSLogger.Log(DMSLogger.LogLevel.Error, "[EMSLoadFlow]: Error occurred while preparing EMSLoadFlow report data.");
                DMSLogger.DumpNonFatalExceptionToLog(DMSLogger.LogLevel.DebugLog, ex);
            }
        }