This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CalculateTotalAmountLateBoundPlugin : IPlugin | |
| { | |
| public void Execute(IServiceProvider serviceProvider) | |
| { | |
| var context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext; | |
| var serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory; | |
| var service = serviceFactory.CreateOrganizationService(context.UserId); | |
| var lateBoundEntity = context.InputParameters["Target"] as Entity; | |
| lateBoundEntity["new_totalsum"] = lateBoundEntity.GetAttributeValue<decimal>("new_netamount") + lateBoundEntity.GetAttributeValue<decimal>("new_margin"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CalculateTotalAmountEarlyBoundBADPlugin : IPlugin | |
| { | |
| public void Execute(IServiceProvider serviceProvider) | |
| { | |
| var context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext; | |
| var serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory; | |
| var service = serviceFactory.CreateOrganizationService(context.UserId); | |
| var lateBoundEntity = context.InputParameters["Target"] as Entity; | |
| switch (lateBoundEntity.LogicalName) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CalculateTotalAmountAccountPlugin : IPlugin | |
| { | |
| public void Execute(IServiceProvider serviceProvider) | |
| { | |
| var context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext; | |
| var serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory; | |
| var service = serviceFactory.CreateOrganizationService(context.UserId); | |
| var account = (context.InputParameters["Target"] as Entity).ToEntity<Account>(); | |
| account.new_totalsum = account.new_netamount + account.new_margin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface IEntityWithTotalSum | |
| { | |
| decimal new_totalsum { get; set; } | |
| decimal new_netamount { get; set; } | |
| decimal new_margin { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Execute(IServiceProvider serviceProvider) | |
| { | |
| var context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext; | |
| var serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory; | |
| var service = serviceFactory.CreateOrganizationService(context.UserId); | |
| var entityWithTotalSum = context.InputParameters["Target"] as IEntityWithTotalSum; | |
| entityWithTotalSum.new_totalsum = entityWithTotalSum.new_netamount + entityWithTotalSum.new_margin; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Extensions | |
| { | |
| public static T Mock<T>(this Entity entity) | |
| { | |
| return InterfaceMocker.Mock<T>(entity); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void Execute(IServiceProvider serviceProvider) | |
| { | |
| var context = serviceProvider.GetService(typeof(IPluginExecutionContext)) as IPluginExecutionContext; | |
| var serviceFactory = serviceProvider.GetService(typeof(IOrganizationServiceFactory)) as IOrganizationServiceFactory; | |
| var service = serviceFactory.CreateOrganizationService(context.UserId); | |
| var earlyBound = (context.InputParameters["Target"] as Entity).Mock<IEntityWithTotalSum>(); | |
| earlyBound.new_totalsum = earlyBound.new_netamount + earlyBound.new_margin; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function gridRowSelected(context) { | |
| context.getFormContext().getData().getEntity().attributes.forEach(function (attr) { | |
| if (attr.getName() === "odx_monthid") { | |
| attr.controls.forEach(function (c) { | |
| c.setDisabled(true); | |
| }) | |
| } | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public List<MyAccount> GetAccounts() | |
| { | |
| using (var ctx = new OrganizationServiceContext(this.service)) | |
| { | |
| return ctx.CreateQuery<MyAccount>() | |
| .Where(x => x.odx_clientcode != null) | |
| .ToList(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Reflection; | |
| using System.Runtime.CompilerServices; | |
| using System.Runtime.InteropServices; | |
| // General Information about an assembly is controlled through the following | |
| // set of attributes. Change these attribute values to modify the information | |
| // associated with an assembly. | |
| [assembly: AssemblyTitle("DemoCodeNoProxy")] | |
| [assembly: AssemblyDescription("")] | |
| [assembly: AssemblyConfiguration("")] |
OlderNewer