示例#1
0
        private bool IsCorrectCrossEntity(bool isCreate, Entity target, Entity image)
        {
            if (target.Contains("statecode") && !isCreate)
            {
                return(true);
            }

            if (target.Attributes.Count > 1)
            {
                var hasTargetOOB    = SDKHelper.AttributeExists(target.Attributes, $"{_unsecureString}id");
                var hasImageOOB     = SDKHelper.AttributeExists(image.Attributes, $"{_unsecureString}id");
                var hasTargetCustom = SDKHelper.AttributeExists(target.Attributes, $"bpf_{_unsecureString}id");
                var hasImageCustom  = SDKHelper.AttributeExists(image.Attributes, $"bpf_{_unsecureString}id");

                var oobExists = hasTargetOOB || hasImageOOB;

                var customExists = hasTargetCustom || hasImageCustom;

                if (ValidateDuplicateUpdate(isCreate, oobExists, customExists, hasTargetOOB, hasImageOOB, hasTargetCustom, hasImageCustom))
                {
                    return(false);
                }

                return(oobExists || customExists);
            }

            return(true);
        }
示例#2
0
        private bool CheckFieldExists(IOrganizationService service, string entityName, string fieldName)
        {
            var metadata = SDKHelper.GetEntityMetadata(service, entityName);

            return(SDKHelper.AttributeExists(metadata.Attributes, fieldName));
        }