Ejemplo n.º 1
0
        public static Dictionary <int, string> StatusReasonElementsWithStateValues(AttributeMetadataManager statusReasonAttribute, AttributeMetadataManager stateAttribute)
        {
            var result = new Dictionary <int, string>();

            ((AttributeMetadataManagerForStatusReason)statusReasonAttribute).StatusReasonValues.ToList().ForEach(value =>
            {
                string str = ((AttributeMetadataManagerForStatus)stateAttribute).StatusValues.Where(stat => stat.Key == value.Item2).FirstOrDefault().Value.RemoveDiacritics();
                result.Add(value.Item1, $"{value.Item3}_State{str}");
            });
            return(result);
        }
Ejemplo n.º 2
0
        private void WriteAttribute(
            AttributeMetadataManager attr,
            string lastAttribute,
            bool optionSetValuesInList,
            AttributeMetadataManager statusReasonAttribute)
        {
            this.WriteLine("\t///" + attr.DisplayNameConstant);
            string str = "\t" + attr.LogicalNameConstant + ": \"" + attr.LogicalNameConstant + "\"";

            if (attr.LogicalNameConstant != lastAttribute | optionSetValuesInList || statusReasonAttribute != null && attr != statusReasonAttribute)
            {
                str += ",";
            }
            this.WriteLine(str);
        }
Ejemplo n.º 3
0
 public override void WriteAttributeHeader(AttributeMetadataManager attribute)
 {
     this.WriteLine(Environment.NewLine + "\t\t/// <summary>");
     this.WriteLine("\t\t/// Values for field " + attribute.DisplayNameConstant);
     this.WriteLine("\t\t/// <summary>");
     if (attribute.EntityLogicalName != "EntityGenericConstants")
     {
         switch (attribute)
         {
         case AttributeMetadataManagerForStatusReason _:
         case AttributeMetadataManagerForStatus _:
             this.WriteLine("\t\tpublic new enum " + attribute.LogicalNameConstant + "Values" + Environment.NewLine + "\t\t{");
             return;
         }
     }
     this.WriteLine("\t\tpublic enum " + attribute.LogicalNameConstant + "Values" + Environment.NewLine + "\t\t{");
 }
Ejemplo n.º 4
0
        internal void AddAttribute(AttributeMetadataManager attributeElem)
        {
            if (!this.CommonFields.Contains(attributeElem.LogicalNameConstant))
            {
                this.Attributes.Add(attributeElem);
            }

            if (attributeElem is AttributeMetadataManagerForPicklist manager)
            {
                this.OptionSetAttributes.Add(manager);
            }

            if (attributeElem is AttributeMetadataManagerForStatus manager1)
            {
                this.StatusAttribute = manager1;
            }

            if (attributeElem is AttributeMetadataManagerForStatusReason manager2)
            {
                this.StatusReasonAttribute = manager2;
            }
        }
Ejemplo n.º 5
0
        private void ParallelExtractData()
        {
            using (Log.Track("Transforming metadata"))
            {
                var entitiesMetadata = this.EntitiesMetadata;
                var parallelOptions  = new ParallelOptions
                {
                    MaxDegreeOfParallelism = 1
                };

                var entityConcurrentData = new ConcurrentBag <EntityMetadataManager>();

                void body(EntityMetadata entMetadata)
                {
                    if (entMetadata.DisplayName.LocalizedLabels.Count <= 0)
                    {
                        return;
                    }

                    string label = entMetadata.DisplayName.LocalizedLabels.FirstOrDefault()?.Label;
                    var    entityMetadataManager = new EntityMetadataManager(label, entMetadata.LogicalName, entMetadata.IsActivity.Value, EntityCommonFields.ToList());

                    Console.WriteLine(label);
                    foreach (AttributeMetadata attribute in entMetadata.Attributes)
                    {
                        if (attribute.DisplayName.LocalizedLabels.Count > 0)
                        {
                            AttributeMetadataManager elementFromMetadata = GetAttributeElementFromMetadata(attribute, entMetadata.LogicalName);
                            entityMetadataManager.AddAttribute(elementFromMetadata);
                        }
                    }
                    entityMetadataManager.OptionSetAttributes = entityMetadataManager.OptionSetAttributes.OrderBy(opt => opt.LogicalNameConstant).ToList();
                    entityConcurrentData.Add(entityMetadataManager);
                }

                Parallel.ForEach(entitiesMetadata, parallelOptions, body);
                this.EntityData = entityConcurrentData.OrderBy(data => data.EntityLogicalName).ToList();
            }
        }
Ejemplo n.º 6
0
 public virtual void WriteAttributeHeader(AttributeMetadataManager attr)
 {
 }
Ejemplo n.º 7
0
 public void WriteStateValues(AttributeMetadataManager stateAttribute, string tabulation)
 {
     this.WriteAttributeHeader(stateAttribute);
     this.WriteRows(((AttributeMetadataManagerForStatus)stateAttribute).StatusValues.ToList(), tabulation, new bool?());
 }
Ejemplo n.º 8
0
 public override void WriteAttributeHeader(AttributeMetadataManager attribute)
 {
     this.WriteLine(Environment.NewLine + "\t/// Values for field " + attribute.DisplayNameConstant);
     this.WriteLine("\t" + attribute.LogicalNameConstant + "Values: {");
 }