コード例 #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            attributeFormResponse = new AttributeFormResponse();
            attributeFormResponse.CurrentPowerQueryAttribute             = attributeFormMessage.CurrentPowerQueryAttribute;
            attributeFormResponse.CurrentPowerQueryAttribute.DisplayName = textBoxDisplayName.Name;
            if (checkBoxAddLookupGuid.Checked)
            {
                PowerQueryAttribute guidAttribute = FetchXmlQueryHelper.LookupGuidPowerQueryAttribute(attributeFormMessage.CurrentPowerQueryAttribute);// new PowerQueryAttribute();
                attributeFormResponse.NewFields.Add(guidAttribute);
            }
            if (checkBoxAddEntityLogicalName.Checked)
            {
                PowerQueryAttribute guidAttribute = FetchXmlQueryHelper.LogicalLookupPowerQueryAttribute(attributeFormMessage.CurrentPowerQueryAttribute);// new PowerQueryAttribute();
                attributeFormResponse.NewFields.Add(guidAttribute);
            }

            if (checkBoxAddFormattedValue.Checked)
            {
                PowerQueryAttribute formattedAttribute = FetchXmlQueryHelper.FormattedPowerQueryAttribute(attributeFormMessage.CurrentPowerQueryAttribute);
                //guidAttribute.Name = $"_{attributeFormMessage.CurrentPowerQueryAttribute.Name}[email protected]"; // $"_{attributeFormMessage.AttributeLogicName}_value";
                //guidAttribute.DisplayName = textBoxDisplayName.Text + " Enity Logical Name";
                //guidAttribute.Type = "EnityLogicalName";
                attributeFormResponse.NewFields.Add(formattedAttribute);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #2
0
        public static PowerQueryAttribute GetPowerQueryAttributeByMetadata(AttributeMetadata attribute)
        {
            string displayName = attribute.LogicalName;

            if (attribute.DisplayName != null && attribute.DisplayName.UserLocalizedLabel != null && attribute.DisplayName.UserLocalizedLabel.Label != null)
            {
                displayName = attribute.DisplayName.UserLocalizedLabel.Label;
            }

            string itemName = attribute.LogicalName;
            PowerQueryAttribute powerQueryAttribute = new PowerQueryAttribute();

            powerQueryAttribute.Name              = itemName;
            powerQueryAttribute.DisplayName       = displayName;
            powerQueryAttribute.AttributeMetadata = attribute;


            if (attribute is Microsoft.Xrm.Sdk.Metadata.DateTimeAttributeMetadata)
            {
                Microsoft.Xrm.Sdk.Metadata.DateTimeAttributeMetadata dateTimeAttribute = attribute as Microsoft.Xrm.Sdk.Metadata.DateTimeAttributeMetadata;
                powerQueryAttribute.Type = dateTimeAttribute.Format.ToString();
            }
            else
            {
                powerQueryAttribute.Type = attribute.AttributeType.Value.ToString();
            }

            return(powerQueryAttribute);
        }
コード例 #3
0
        public static ListViewItem GetListViewItemByPowerQueryAttribute(PowerQueryAttribute powerQueryAttribute)
        {
            var selectedFieldItem = new ListViewItem {
                Text = powerQueryAttribute.DisplayName, Tag = powerQueryAttribute
            };

            selectedFieldItem.SubItems.Add(powerQueryAttribute.Name);
            selectedFieldItem.SubItems.Add(powerQueryAttribute.Type);
            return(selectedFieldItem);
        }
コード例 #4
0
        public static PowerQueryAttribute GetNewObject(PowerQueryAttribute powerQueryAttribute)
        {
            PowerQueryAttribute _powerQueryAttribute = new PowerQueryBuilder.PowerQueryAttribute();

            _powerQueryAttribute.AttributeMetadata = powerQueryAttribute.AttributeMetadata;
            _powerQueryAttribute.CanBeAdded        = powerQueryAttribute.CanBeAdded;

            _powerQueryAttribute.Name        = powerQueryAttribute.Name;
            _powerQueryAttribute.DisplayName = powerQueryAttribute.DisplayName;

            _powerQueryAttribute.HasFormattedValue = powerQueryAttribute.HasFormattedValue;

            if (powerQueryAttribute.ParentPowerQueryAttribute != null)
            {
                _powerQueryAttribute.ParentPowerQueryAttribute = PowerQueryAttribute.GetNewObject(powerQueryAttribute.ParentPowerQueryAttribute);
            }

            _powerQueryAttribute.Type = powerQueryAttribute.Type;


            return(_powerQueryAttribute);
        }
コード例 #5
0
 public LookupFormMessage(PowerQueryAttribute powerQueryAttribute) : base(powerQueryAttribute)
 {
 }
コード例 #6
0
 public AttributeFormMessage(PowerQueryAttribute powerQueryAttribute)
 {
     CurrentPowerQueryAttribute = powerQueryAttribute;
 }