/// <summary>
        ///     NOT IMPLEMENTED FOR SET STATE
        /// </summary>
        public bool MeetsConditionsChanging(IEnumerable <ConditionExpression> conditions)
        {
            var metPrePlugin  = false;
            var metPostPlugin = false;

            switch (MessageName)
            {
            case PluginMessage.Create:
            {
                metPostPlugin = XrmEntity.MeetsConditions(GetField, conditions);
                break;
            }

            case PluginMessage.Update:
            {
                metPrePlugin  = XrmEntity.MeetsConditions(PreImageEntity.GetField, conditions);
                metPostPlugin = XrmEntity.MeetsConditions(GetField, conditions);
                break;
            }

            case PluginMessage.Delete:
            {
                metPrePlugin = XrmEntity.MeetsConditions(PreImageEntity.GetField, conditions);
                break;
            }

            default:
            {
                //not sure what to do for setstate with status
                throw new InvalidPluginExecutionException(
                          "MeetsConditionsChanging Not Implemented for plugin message " + MessageName);
            }
            }
            return(metPostPlugin != metPrePlugin);
        }
 /// <summary>
 ///     NOT IMPLEMENTED FOR SET STATE
 /// </summary>
 public bool MeetsConditions(IEnumerable <ConditionExpression> conditions)
 {
     if (IsMessage(PluginMessage.Create, PluginMessage.Update))
     {
         return(XrmEntity.MeetsConditions(GetField, conditions));
     }
     throw new NotSupportedException("Method Not Implemented For PLugin Message: " + MessageName);
 }
 /// <summary>
 ///     MAYBE TRUE FOR DELETE! FIELD MUST BE IN PREIMAGE FOR UPDATE STEP! Returns if the fields value is logically changing
 ///     by inspecting the Target and Preimage
 /// </summary>
 public bool FieldChanging(string fieldName)
 {
     if (MessageName == PluginMessage.Create || MessageName == PluginMessage.Update)
     {
         return(TargetEntity.Contains(fieldName) &&
                !XrmEntity.FieldsEqual(PreImageEntity.GetField(fieldName), TargetEntity.GetField(fieldName)));
     }
     else if (MessageName == PluginMessage.Delete)
     {
         return(GetFieldFromPreImage(fieldName) != null);
     }
     else
     {
         //not sure how to get status if a setstate message
         throw new InvalidPluginExecutionException("FieldChanging Not Implemented for plugin message " +
                                                   MessageName);
     }
 }
 public void SetOptionSetField(string fieldName, int index)
 {
     XrmEntity.SetOptionSetField(TargetEntity, fieldName, index);
 }
 /// <summary>
 ///     0 IF NOTHING!! FIELD MUST BE IN PREIMAGE FOR UPDATE STEP! Returns the effective value of the boolean field in the
 ///     context record (gets from the target entity or if not in gets from the preimage)
 /// </summary>
 public decimal GetMoneyValue(string fieldName)
 {
     return(XrmEntity.GetMoneyValue(GetField(fieldName)));
 }
 /// <summary>
 ///     FALSE IF NOTHING!! FIELD MUST BE IN PREIMAGE FOR UPDATE STEP! Returns the effective value of the boolean field in
 ///     the context record (gets from the target entity or if not in gets from the preimage)
 /// </summary>
 public bool GetBoolean(string fieldName)
 {
     return(XrmEntity.GetBoolean(GetField(fieldName)));
 }
 /// <summary>
 ///     -1 IF NOTHING!! FIELD MUST BE IN PREIMAGE FOR UPDATE STEP! Returns the effective int value of the optionset field
 ///     in the context record (gets from the target entity or if not in gets from the preimage)
 /// </summary>
 public int GetOptionSet(string fieldName)
 {
     return(XrmEntity.GetOptionSetValue(GetField(fieldName)));
 }
 /// <summary>
 ///     0 if null
 /// </summary>
 public int GetIntField(string fieldName)
 {
     return(XrmEntity.GetInt(GetField(fieldName)));
 }
 /// <summary>
 ///     EMPTY STRING IF NOTHING!! FIELD MUST BE IN PREIMAGE! Returns the effective entitytype  of the lookup field in the
 ///     context record (gets from the target entity or if not in gets from the preimage)
 /// </summary>
 public string GetLookupType(string fieldName)
 {
     return(XrmEntity.GetLookupType(GetField(fieldName)));
 }
 public Guid?GetLookupGuidPreImage(string fieldName)
 {
     return(XrmEntity.GetLookupGuid(GetFieldFromPreImage(fieldName)));
 }
 /// <summary>
 ///     NULL IF NOTHING!! FIELD MUST BE IN PREIMAGE! Returns the effective id value of the lookup field in the context
 ///     record (gets from the target entity or if not in gets from the preimage)
 /// </summary>
 public Guid?GetLookupGuid(string fieldName)
 {
     return(XrmEntity.GetLookupGuid(GetField(fieldName)));
 }