public List <ParameterCount> GetParameterCount()
        {
            EntityCollection parameters = RetrieveSamplingPlanParameters();
            EntityCollection msp        = RetrieveMonthlySamplingPlan();

            foreach (Entity p in parameters.Entities)
            {
                SamplingPlanParameters.Add(new SamplingPlanParameter(p));
            }

            foreach (Entity m in msp.Entities)
            {
                MonthlySamplingPlans.Add(new MonthlySamplingPlan(m));
            }


            foreach (var p in SamplingPlanParameters.GroupBy(p => p.Name))
            {
                var spp = p.ToList();

                var groupA = spp.Where(pr => pr.GroupType == EGroupType.ACheck).FirstOrDefault();
                var groupB = spp.Where(pr => pr.GroupType == EGroupType.BAudit).FirstOrDefault();

                ParameterCount pc = new ParameterCount(p.Key, MonthlySamplingPlans, groupA != null, groupB != null);
                ParametersCount.Add(pc);
            }

            return(ParametersCount);
        }
            public int CompareTo(IConstructionInfo other)
            {
                // ReSharper disable once ImpureMethodCallOnReadonlyValueField
                var isConfiguredComparison = other.IsConfigured.CompareTo(IsConfigured);

                if (isConfiguredComparison != 0)
                {
                    return(isConfiguredComparison);
                }

                var conditionalComparison = IsUnconditional.CompareTo(other.IsUnconditional);

                if (conditionalComparison != 0)
                {
                    return(conditionalComparison);
                }

                var paramCountComparison = ParameterCount.CompareTo(other.ParameterCount);

                if (paramCountComparison != 0)
                {
                    return(paramCountComparison);
                }

                var priorityComparison = other.Priority.CompareTo(Priority);

                return(priorityComparison);
            }
Esempio n. 3
0
        /// <summary>
        /// Returns a string representation of the function.
        /// </summary>
        /// <returns>String representation of the function.</returns>
        public override string ToString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(m_strName);
            stringBuilder.Append("(");
            for (int iIndex = 0; iIndex < m_listParameters.Count; iIndex++)
            {
                if (iIndex > 0)
                {
                    stringBuilder.Append(", ");
                }
                stringBuilder.Append(m_listParameters[iIndex]);
            }
            stringBuilder.Append(") [");
            stringBuilder.Append(ParameterCount.ToString("00000000"));
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
Esempio n. 4
0
        public static List <ParameterCount> MockParameterCount()
        {
            //List<SamplingPlanParameter> SamplingPlanParameters = MockSamplingPlanParametersForParameterCount();
            List <SamplingPlanParameter> SamplingPlanParameters = MockSamplingPlanParameters();
            List <MonthlySamplingPlan>   MonthlySamplingPlans   = MockMonthlySamplinPlans();

            List <ParameterCount> list = new List <ParameterCount>();

            foreach (var p in SamplingPlanParameters.Where(p => p.GroupType == EGroupType.ACheck || p.GroupType == EGroupType.BAudit).GroupBy(p => p.Name))
            {
                var spp = p.ToList();

                var groupA = spp.Where(pr => pr.GroupType == EGroupType.ACheck).FirstOrDefault();
                var groupB = spp.Where(pr => pr.GroupType == EGroupType.BAudit).FirstOrDefault();

                ParameterCount pc = new ParameterCount(p.Key, MonthlySamplingPlans, groupA != null, groupB != null);
                list.Add(pc);
            }

            return(list);
        }
Esempio n. 5
0
        public virtual void WriteXml(XmlWriter writer)
        {
            try
            {
                writer.WriteAttributeString("Type", GetType().AssemblyQualifiedName);
                writer.WriteAttributeString("Guid", Guid.ToString());
                writer.WriteAttributeString("StateCount", Store.Count.ToString());
                writer.WriteAttributeString("InputCount", InputNodes.Count.ToString());
                writer.WriteAttributeString("OutputCount", OutputNodes.Count.ToString());
                writer.WriteAttributeString("ParameterCount", ParameterCount.ToString());

                if (InputNodes.Count > 0)
                {
                    writer.WriteStartElement("InputNodes");
                    foreach (var inputNode in InputNodes)
                    {
                        InputNode item = inputNode as InputNode;
                        var       ext  = string.Join(",", item.GetSupportedExtensions());

                        writer.WriteStartElement("InputNode");

                        writer.WriteAttributeString("Identifier", item.Identity.ToString());
                        writer.WriteAttributeString("DisplayName", item.DisplayName);
                        writer.WriteAttributeString("Extension", ext);

                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }
                if (OutputNodes.Count > 0)
                {
                    writer.WriteStartElement("OutputNodes");

                    foreach (var item in OutputNodes)
                    {
                        var ext = string.Join(",", item.GetSupportedExtensions());

                        writer.WriteStartElement("OutputNode");

                        writer.WriteAttributeString("Identifier", item.Identity.ToString());
                        writer.WriteAttributeString("DisplayName", item.DisplayName);
                        writer.WriteAttributeString("Extension", ext);

                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }


                if (Store.Count > 0)
                {
                    XmlSerializer keySerializer = new XmlSerializer(typeof(SerializableDictionary <Guid, ModuleState>));
                    keySerializer.Serialize(writer, Store);
                }

                if (StateInfo.Count > 0)
                {
                    writer.WriteStartElement("StateInfo");
                    writer.WriteAttributeString("Count", StateInfo.Count.ToString());
                    XmlSerializer keySerializer = new XmlSerializer(typeof(SerializableDictionary <string, string>));
                    keySerializer.Serialize(writer, StateInfo);
                    writer.WriteEndElement();
                }

                WriteParameter(writer);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }