Skip to content

Commit

Permalink
Minor updates to node properties for metadata changes #696
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Apr 15, 2022
1 parent 1cf2ce6 commit be8eec5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Controls/attributeControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected override ControlValidationResult ValidateControl(Control control)
{
return new ControlValidationResult(ControlValidationLevel.Error, "Attribute", ControlValidationMessage.IsRequired);
}
if (fxb.Service != null)
if (fxb.entities != null)
{
if (!allattributes.Any(a=>a.LogicalName == cmbAttribute.Text))
{
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Controls/conditionControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected override ControlValidationResult ValidateControl(Control control)
return new ControlValidationResult(ControlValidationLevel.Error, "Attribute", ControlValidationMessage.IsRequired);
}

if (fxb.Service != null && !cmbAttribute.Items.OfType<AttributeItem>().Any(i => i.ToString() == cmbAttribute.Text))
if (fxb.entities != null && !cmbAttribute.Items.OfType<AttributeItem>().Any(i => i.ToString() == cmbAttribute.Text))
{
return new ControlValidationResult(ControlValidationLevel.Warning, "Attribute", ControlValidationMessage.InValid);
}
Expand Down
4 changes: 2 additions & 2 deletions FetchXmlBuilder/Controls/entityControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override ControlValidationResult ValidateControl(Control control)
return new ControlValidationResult(ControlValidationLevel.Error, "Entity", ControlValidationMessage.IsRequired);
}

if (!(cmbEntity.SelectedItem is EntityItem) && fxb.Service != null)
if (!(cmbEntity.SelectedItem is EntityItem) && fxb.entities != null)
{
if (!fxb.entities.Any(e => e.Key == cmbEntity.Text))
{
Expand All @@ -49,7 +49,7 @@ protected override ControlValidationResult ValidateControl(Control control)
return new ControlValidationResult(ControlValidationLevel.Info, "Entity", ControlValidationMessage.NotShowingNow);
}
}
if (fxb.Service != null && !cmbEntity.Items.OfType<EntityItem>().Any(i => i.ToString() == cmbEntity.Text))
if (fxb.entities != null && !cmbEntity.Items.OfType<EntityItem>().Any(i => i.ToString() == cmbEntity.Text))
{
return new ControlValidationResult(ControlValidationLevel.Warning, "Entity", ControlValidationMessage.IsRequired);
}
Expand Down
15 changes: 7 additions & 8 deletions FetchXmlBuilder/Controls/linkEntityControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ private void RefreshRelationships()
{
cmbRelationship.Items.Clear();
var parententityname = Node.Parent.Value("name");
var entities = fxb.GetDisplayEntities();
if (entities != null && entities.ContainsKey(parententityname))
var parententity = fxb.GetEntity(parententityname);
if (parententity != null)
{
var parententity = entities[parententityname];
var mo = parententity.ManyToOneRelationships;
var om = parententity.OneToManyRelationships;
var mm = parententity.ManyToManyRelationships;
Expand Down Expand Up @@ -295,8 +294,8 @@ private void cmbRelationship_DropDownClosed(object sender, EventArgs e)
protected override ControlValidationResult ValidateControl(Control control)
{
var parententityname = Node.Parent.LocalEntityName();
var parententity = fxb.Service != null && fxb.entities != null && fxb.entities.ContainsKey(parententityname) ? fxb.entities[parententityname] : null;
var currententity = fxb.Service != null && fxb.entities != null && fxb.entities.ContainsKey(cmbEntity.Text) ? fxb.entities[cmbEntity.Text] : null;
var parententity = fxb.entities != null && fxb.entities.ContainsKey(parententityname) ? fxb.entities[parententityname] : null;
var currententity = fxb.entities != null && fxb.entities.ContainsKey(cmbEntity.Text) ? fxb.entities[cmbEntity.Text] : null;
if (control == cmbRelationship && string.IsNullOrWhiteSpace(cmbEntity.Text) && string.IsNullOrWhiteSpace(cmbFrom.Text) && string.IsNullOrWhiteSpace(cmbTo.Text))
{
return new ControlValidationResult(ControlValidationLevel.Info, "Select a relationship to populate fields below");
Expand All @@ -308,7 +307,7 @@ protected override ControlValidationResult ValidateControl(Control control)
return new ControlValidationResult(ControlValidationLevel.Error, "Entity", ControlValidationMessage.IsRequired);
}

if (fxb.Service != null)
if (fxb.entities != null)
{
if (currententity == null)
{
Expand Down Expand Up @@ -339,7 +338,7 @@ protected override ControlValidationResult ValidateControl(Control control)
{
return new ControlValidationResult(ControlValidationLevel.Warning, "From attribute", ControlValidationMessage.NotInMetadata);
}
if (fxb.Service != null && !cmbFrom.Items.OfType<string>().Any(i => i == cmbFrom.Text))
if (fxb.entities != null && !cmbFrom.Items.OfType<string>().Any(i => i == cmbFrom.Text))
{
return new ControlValidationResult(ControlValidationLevel.Info, "From attribute", ControlValidationMessage.NotShowingNow);
}
Expand All @@ -363,7 +362,7 @@ protected override ControlValidationResult ValidateControl(Control control)
{
return new ControlValidationResult(ControlValidationLevel.Warning, "To attribute", ControlValidationMessage.NotInMetadata);
}
if (fxb.Service != null && !cmbTo.Items.OfType<string>().Any(i => i == cmbTo.Text))
if (fxb.entities != null && !cmbTo.Items.OfType<string>().Any(i => i == cmbTo.Text))
{
return new ControlValidationResult(ControlValidationLevel.Info, "To attribute", ControlValidationMessage.NotShowingNow);
}
Expand Down
2 changes: 1 addition & 1 deletion FetchXmlBuilder/Controls/orderControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected override ControlValidationResult ValidateControl(Control control)
{
return new ControlValidationResult(ControlValidationLevel.Error, "Attribute", ControlValidationMessage.IsRequired);
}
if (fxb.Service != null)
if (fxb.entities != null)
{
if (!allattributes.Any(a => a.LogicalName == cmbAttribute.Text))
{
Expand Down

0 comments on commit be8eec5

Please sign in to comment.