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(); }
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); }
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); }
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); }
public LookupFormMessage(PowerQueryAttribute powerQueryAttribute) : base(powerQueryAttribute) { }
public AttributeFormMessage(PowerQueryAttribute powerQueryAttribute) { CurrentPowerQueryAttribute = powerQueryAttribute; }