Skip to content

Commit

Permalink
Moving FXBConnectionSettings to new file and moving metadatasetting…
Browse files Browse the repository at this point in the history
…s to this one from `FXBSettings.cs
  • Loading branch information
rappen committed May 3, 2022
1 parent 9221b74 commit c43ab6c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 66 deletions.
79 changes: 79 additions & 0 deletions FetchXmlBuilder/AppCode/FXBConnectionSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Microsoft.Xrm.Sdk.Metadata;
using System;
using System.Windows.Forms;

namespace Cinteros.Xrm.FetchXmlBuilder.AppCode
{
public class FXBConnectionSettings
{
public FilterSetting FilterSetting { get; set; } = new FilterSetting();
public ShowMetaTypesEntity ShowEntities { get; set; } = new ShowMetaTypesEntity();
public ShowMetaTypesAttribute ShowAttributes { get; set; } = new ShowMetaTypesAttribute();
public string FetchXML { get; set; } = QueryOptions.DefaultNewQuery;
}

public class QueryOptions
{
internal static string DefaultNewQuery = "<fetch top=\"50\"><entity name=\"\"/></fetch>";
public bool ShowQuickActions { get; set; } = true;
public bool UseSingleQuotation { get; set; }
public string NewQueryTemplate { get; set; } = DefaultNewQuery;
public bool ShowAllAttributes { get; set; } = false;
}

public class FilterSetting
{
public bool ShowAllSolutions { get; set; } = true;
public bool ShowUnmanagedSolutions { get; set; } = false;
public Guid ShowSolution { get; set; } = Guid.Empty;
public bool FilterByMetadata { get; set; } = true;
public bool AlwaysPrimary { get; set; } = true;
public bool AlwaysAddresses { get; set; } = true;
}

public abstract class ShowMetaTypes
{
public CheckState IsManaged { get; set; } = CheckState.Indeterminate;
public CheckState IsCustom { get; set; } = CheckState.Indeterminate;
public CheckState IsCustomizable { get; set; } = CheckState.Indeterminate;
public CheckState IsValidForAdvancedFind { get; set; } = CheckState.Indeterminate;
public CheckState IsAuditEnabled { get; set; } = CheckState.Indeterminate;
public CheckState IsLogical { get; set; } = CheckState.Unchecked;
}

public class ShowMetaTypesEntity : ShowMetaTypes
{
public CheckState IsIntersect { get; set; } = CheckState.Indeterminate; //E
public CheckState IsActivity { get; set; } = CheckState.Indeterminate; //E
public CheckState IsActivityParty { get; set; } = CheckState.Indeterminate; //E
public CheckState Virtual { get; set; } = CheckState.Indeterminate; //E
public int OwnershipType { get; set; } = 0; //E
public OwnershipTypes[] Ownerships
{
get
{
switch (OwnershipType)
{
case 1:
return new OwnershipTypes[] { OwnershipTypes.OrganizationOwned };
case 2:
return new OwnershipTypes[] { OwnershipTypes.UserOwned, OwnershipTypes.TeamOwned };
case 3:
return new OwnershipTypes[] { OwnershipTypes.BusinessOwned, OwnershipTypes.BusinessParented };
case 4:
return new OwnershipTypes[] { OwnershipTypes.None };
}
return null;
}
}
}

public class ShowMetaTypesAttribute : ShowMetaTypes
{
public CheckState IsValidForRead { get; set; } = CheckState.Indeterminate; //A
public CheckState IsFiltered { get; set; } = CheckState.Indeterminate; //A
public CheckState IsRetrievable { get; set; } = CheckState.Indeterminate; //A
public CheckState IsValidForGrid { get; set; } = CheckState.Indeterminate; //A
public CheckState AttributeOf { get; set; } = CheckState.Unchecked; //A
}
}
66 changes: 0 additions & 66 deletions FetchXmlBuilder/AppCode/FXBSettings.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using Cinteros.Xrm.FetchXmlBuilder.DockControls;
using Microsoft.Xrm.Sdk.Metadata;
using ScintillaNET;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Xml.Serialization;
using WeifenLuo.WinFormsUI.Docking;

Expand All @@ -18,8 +16,6 @@ public class FXBSettings

public bool UseFriendlyNames { get { return _useFriendlyNames; } set { _useFriendlyNames = value; FetchXmlBuilder.friendlyNames = value; } }
public QueryOptions QueryOptions { get; set; } = new QueryOptions();
public ShowMetaTypesEntity ShowEntities { get; set; } = new ShowMetaTypesEntity();
public ShowMetaTypesAttribute ShowAttributes { get; set; } = new ShowMetaTypesAttribute();
public ResultOptions Results { get; set; } = new ResultOptions();
public string CurrentVersion { get; set; }
public string LastOpenedViewEntity { get; set; }
Expand All @@ -43,63 +39,6 @@ public class FXBSettings
public bool WaitUntilMetadataLoaded { get; set; } = false;
}

public class QueryOptions
{
internal static string DefaultNewQuery = "<fetch top=\"50\"><entity name=\"\"/></fetch>";
public bool ShowQuickActions { get; set; } = true;
public bool UseSingleQuotation { get; set; }
public string NewQueryTemplate { get; set; } = DefaultNewQuery;
public bool ShowAllAttributes { get; set; } = false;
}

public abstract class ShowMetaTypes
{
public CheckState IsManaged { get; set; } = CheckState.Indeterminate;
public CheckState IsCustom { get; set; } = CheckState.Indeterminate;
public CheckState IsCustomizable { get; set; } = CheckState.Indeterminate;
public CheckState IsValidForAdvancedFind { get; set; } = CheckState.Indeterminate;
public CheckState IsAuditEnabled { get; set; } = CheckState.Indeterminate;
public CheckState IsLogical { get; set; } = CheckState.Unchecked;
}

public class ShowMetaTypesEntity : ShowMetaTypes
{
public CheckState IsIntersect { get; set; } = CheckState.Indeterminate; //E
public CheckState IsActivity { get; set; } = CheckState.Indeterminate; //E
public CheckState IsActivityParty { get; set; } = CheckState.Indeterminate; //E
public CheckState Virtual { get; set; } = CheckState.Indeterminate; //E
public int OwnershipType { get; set; } = 0; //E
public OwnershipTypes[] Ownerships
{
get
{
switch (OwnershipType)
{
case 1:
return new OwnershipTypes[] { OwnershipTypes.OrganizationOwned };
case 2:
return new OwnershipTypes[] { OwnershipTypes.UserOwned, OwnershipTypes.TeamOwned };
case 3:
return new OwnershipTypes[] { OwnershipTypes.BusinessOwned, OwnershipTypes.BusinessParented };
case 4:
return new OwnershipTypes[] { OwnershipTypes.None };
}
return null;
}
}
}

public class ShowMetaTypesAttribute : ShowMetaTypes
{
public CheckState IsValidForRead { get; set; } = CheckState.Indeterminate; //A
public CheckState IsFiltered { get; set; } = CheckState.Indeterminate; //A
public CheckState IsRetrievable { get; set; } = CheckState.Indeterminate; //A
public CheckState IsValidForGrid { get; set; } = CheckState.Indeterminate; //A
public CheckState AttributeOf { get; set; } = CheckState.Unchecked; //A
public bool AlwaysPrimary { get; set; } = true;
public bool AlwaysAddresses { get; set; } = true;
}

public class ResultOptions
{
public bool Friendly { get; set; }
Expand Down Expand Up @@ -198,11 +137,6 @@ internal void SetContentWindow(ContentType type, ContentWindow windowSettings)
}
}

public class FXBConnectionSettings
{
public string FetchXML { get; set; } = QueryOptions.DefaultNewQuery;
}

public class QueryRepository
{
public List<QueryDefinition> Queries { get; set; } = new List<QueryDefinition>();
Expand Down
1 change: 1 addition & 0 deletions FetchXmlBuilder/FetchXmlBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<Compile Include="AppCode\ConnectionExtensions.cs" />
<Compile Include="AppCode\EntityNameItem.cs" />
<Compile Include="AppCode\Extensions.cs" />
<Compile Include="AppCode\FXBConnectionSettings.cs" />
<Compile Include="FXBGui.cs">
<SubType>UserControl</SubType>
</Compile>
Expand Down

0 comments on commit c43ab6c

Please sign in to comment.