| | 1 | | using Microsoft.Xrm.Sdk; |
| | 2 | | using System; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using System.Text; |
| | 5 | |
|
| | 6 | | namespace FakeXrmEasy.Services |
| | 7 | | { |
| | 8 | | public class InvoiceInitializerService : IEntityInitializerService |
| | 9 | | { |
| | 10 | | public const string EntityLogicalName = "invoice"; |
| | 11 | |
|
| | 12 | | public Entity Initialize(Entity e, Guid gCallerId, XrmFakedContext ctx, bool isManyToManyRelationshipEntity = fa |
| 72 | 13 | | { |
| 72 | 14 | | if (string.IsNullOrEmpty(e.GetAttributeValue<string>("invoicenumber"))) |
| 72 | 15 | | { |
| | 16 | | //first FakeXrmEasy auto-numbering emulation |
| 72 | 17 | | e["invoicenumber"] = "INV-" + DateTime.Now.Ticks; |
| 72 | 18 | | } |
| | 19 | |
|
| 72 | 20 | | return e; |
| 72 | 21 | | } |
| | 22 | |
|
| | 23 | | public Entity Initialize(Entity e, XrmFakedContext ctx, bool isManyToManyRelationshipEntity = false) |
| 0 | 24 | | { |
| 0 | 25 | | return this.Initialize(e, Guid.NewGuid(), ctx, isManyToManyRelationshipEntity); |
| 0 | 26 | | } |
| | 27 | | } |
| | 28 | | } |