protected override void Create() { var udf = new ContractUDF { Comment = Comment, Name = Name, IsDefault = IsDefault }; using ( var contractUDFService = SvcClientManager.GetSvcClient<ContractUDFServiceClient>(SvcType.ContractUDFSvc) ) { contractUDFService.AddNewContractUDF(udf, CurrentUser.Id); } }
private void FixupContractUDF(ContractUDF previousValue, bool skipKeys = false) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.Contracts.Contains(this)) { previousValue.Contracts.Remove(this); } if (ContractUDF != null) { if (!ContractUDF.Contracts.Contains(this)) { ContractUDF.Contracts.Add(this); } UDFId = ContractUDF.Id; } else if (!skipKeys) { UDFId = null; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("ContractUDF") && (ChangeTracker.OriginalValues["ContractUDF"] == ContractUDF)) { ChangeTracker.OriginalValues.Remove("ContractUDF"); } else { ChangeTracker.RecordOriginalValue("ContractUDF", previousValue); } if (ContractUDF != null && !ContractUDF.ChangeTracker.ChangeTrackingEnabled) { ContractUDF.StartTracking(); } } }