コード例 #1
0
        /// <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.GetFieldDelegate(), conditions);
                metPostPlugin = XrmEntity.MeetsConditions(GetField, conditions);
                break;
            }

            case PluginMessage.Delete:
            {
                metPrePlugin = XrmEntity.MeetsConditions(XrmEntity.GetFieldDelegate(PreImageEntity), 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);
        }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
 protected void DerivedConcatenatedField(string fieldToSet, string[] fields, string separator)
 {
     if (IsMessage(PluginMessage.Create, PluginMessage.Update) &&
         Stage == PluginStage.PreOperationEvent)
     {
         if (FieldChanging(fields))
         {
             var values = new List <object>();
             foreach (var field in fields)
             {
                 var value = XrmEntity.GetFieldAsDisplayString(GetField(field));
                 if (!String.IsNullOrWhiteSpace(value))
                 {
                     values.Add(value);
                 }
             }
             SetField(fieldToSet, String.Join(separator, values));
         }
     }
 }
コード例 #5
0
 public void SetOptionSetField(string fieldName, int index)
 {
     XrmEntity.SetOptionSetField(TargetEntity, fieldName, index);
 }
コード例 #6
0
 /// <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)));
 }
コード例 #7
0
 /// <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)));
 }
コード例 #8
0
 /// <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)));
 }
コード例 #9
0
 /// <summary>
 ///     0 if null
 /// </summary>
 public int GetIntField(string fieldName)
 {
     return(XrmEntity.GetInt(GetField(fieldName)));
 }
コード例 #10
0
 /// <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)));
 }
コード例 #11
0
 public Guid?GetLookupGuidPreImage(string fieldName)
 {
     return(XrmEntity.GetLookupGuid(GetFieldFromPreImage(fieldName)));
 }
コード例 #12
0
 /// <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)));
 }