Skip to content

Commit

Permalink
dependency with ontext menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Sattar Atta committed Jan 19, 2020
1 parent 254ca91 commit a1866d5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
16 changes: 14 additions & 2 deletions DeprecationTool/DeprecateControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,21 @@ private void tsInfo_Click(object sender, EventArgs e)

private void fieldListColumnClick(object sender, ColumnClickEventArgs e)
{
ListView myListView = (ListView)sender;
ListView theListView = (ListView)sender;
entityListViewComparer.toggleOrder(e.Column);
myListView.Sort();
theListView.Sort();
}

private void fieldListMouseClick(object sender, MouseEventArgs e)
{
ListView theListView = (ListView)sender;
if (e.Button == MouseButtons.Right)
{
if (theListView.FocusedItem != null && theListView.FocusedItem.Bounds.Contains(e.Location))
{
fieldListContextMenu.Show(Cursor.Position);
}
}
}

private void fieldListOnkeyboardPress(object sender, KeyEventArgs e)
Expand Down
5 changes: 5 additions & 0 deletions DeprecationTool/DeprecateControl.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Lib/Deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open Microsoft.Xrm.Sdk.Client
open Microsoft.Xrm.Sdk.Messages
open Microsoft.Xrm.Sdk.Query
open Microsoft.Xrm.Sdk.Metadata
open Microsoft.Crm.Sdk.Messages

module Deprecate =
open System.Globalization
Expand Down Expand Up @@ -319,6 +320,15 @@ module Deprecate =

attributeUpdateRequest attrMetadata

let getDependencyCountForEntity proxy (attr: MetaData) =
let request = RetrieveDependenciesForDeleteRequest()
request.ComponentType <- 2 //componenttype 2 = entity
request.ObjectId <- attr.attribute.MetadataId.Value

let response = getResponse<RetrieveDependenciesForDeleteResponse> proxy request

response.EntityCollection.Entities.Count

let pendingChanges (attrs: MetaDataWithCheck[]) =
attrs
|> Array.filter(fun x -> x.deprecationState <> x.metaData.deprecationState)
Expand Down
10 changes: 10 additions & 0 deletions Lib/deprecate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ open Microsoft.Xrm.Sdk.Client
open Microsoft.Xrm.Sdk.Messages
open Microsoft.Xrm.Sdk.Query
open Microsoft.Xrm.Sdk.Metadata
open Microsoft.Crm.Sdk.Messages

module Deprecate =
open System.Globalization
Expand Down Expand Up @@ -319,6 +320,15 @@ module Deprecate =

attributeUpdateRequest attrMetadata

let getDependencyCountForEntity proxy (attr: MetaData) =
let request = RetrieveDependenciesForDeleteRequest()
request.ComponentType <- 2 //componenttype 2 = entity
request.ObjectId <- attr.attribute.MetadataId.Value

let response = getResponse<RetrieveDependenciesForDeleteResponse> proxy request

response.EntityCollection.Entities.Count

let pendingChanges (attrs: MetaDataWithCheck[]) =
attrs
|> Array.filter(fun x -> x.deprecationState <> x.metaData.deprecationState)
Expand Down

0 comments on commit a1866d5

Please sign in to comment.