예제 #1
0
        public override object GetSimpleFieldValue(IDataSourceStore dsStore)
        {
            DataTypes dataType;

            if (!Enum.TryParse <DataTypes>(this.FieldType, out dataType))
            {
                throw new AccountingModuleException("Data type is not supported. Data type was: {0}. Field name was: {1}", this.FieldType, this.FieldName ?? string.Empty);
            }

            IDataSource ds = dsStore.GetDataSource(DataSources.Table);

            switch (dataType)
            {
            case DataTypes.Decimal: return(ds.GetValue <Decimal>(this.FieldName));

            case DataTypes.Int32: return(ds.GetValue <Int32>(this.FieldName));

            case DataTypes.String: return(ds.GetValue <String>(this.FieldName));

            case DataTypes.DateTime: return(ds.GetValue <DateTime>(this.FieldName));

            case DataTypes.TimeSpan: return(ds.GetValue <DateTime>(this.FieldName).TimeOfDay);

            default: throw new AccountingModuleException("Data type is not supported. Data type was: {0}. Field name was: {1}", dataType.ToString(), this.FieldName ?? string.Empty);
            }
        }
예제 #2
0
 public override bool IsComplexConditionHold(IDataSourceStore dsStore)
 {
     foreach (var condition in this.innerConditions)
     {
         condition.IsHold(dsStore); // since we want every condition to be exhausted we do not use short-circuit evaluation
     }
     return(true);
 }
예제 #3
0
 public override IEnumerable <IEventDefinition> GetHoldEvents(IDataSourceStore dsStore)
 {
     foreach (var evDef in this.eventDefinitions)
     {
         if (evDef.IsHold(dsStore))
         {
             yield return(evDef);
         }
     }
 }
예제 #4
0
 public override bool IsComplexConditionHold(IDataSourceStore dsStore)
 {
     foreach (var condition in this.innerConditions)
     {
         if (condition.IsHold(dsStore))
         {
             return(true);
         }
     }
     return(false);
 }
예제 #5
0
        public Dictionary <string, object> TakeReaction(IDataSourceStore dsStore)
        {
            Dictionary <string, object> fields = new Dictionary <string, object>();

            foreach (var fieldMatch in this.fieldMatches)
            {
                if (!(fieldMatch.TargetField is TableField))
                {
                    throw new AccountingModuleException("Target field must be of table field type. Field type was: {0}. Field name was: {1}", fieldMatch.TargetField.GetType().FullName);
                }

                object value           = fieldMatch.SourceField.GetValue(dsStore);
                string targetFieldName = ((TableField)fieldMatch.TargetField).FieldName;
                fields.Add(targetFieldName, value);
            }
            return(fields);
        }
예제 #6
0
        public override object GetComplexFieldValue(IDataSourceStore dsStore)
        {
            object temp = null;

            foreach (var fld in this.innerFields)
            {
                if (temp == null)
                {
                    temp = fld.GetValue(dsStore);
                }
                else
                {
                    temp = this.Add(temp, fld.GetValue(dsStore));
                }
            }
            return(temp);
        }
예제 #7
0
        public override object GetSimpleFieldValue(IDataSourceStore dsStore)
        {
            SpecialFieldValues specialFieldValue;

            if (!Enum.TryParse <SpecialFieldValues>(this.FieldValue, out specialFieldValue))
            {
                throw new AccountingModuleException("Special field value is not supported. Value was: {0}. Field name was: {1}", this.FieldValue, this.FieldName ?? string.Empty);
            }

            switch (specialFieldValue)
            {
            case SpecialFieldValues.CurrentDate: return(DateTime.Now.Date);

            case SpecialFieldValues.CurrentTime: return(DateTime.Now.TimeOfDay);

            case SpecialFieldValues.CurrentDateTime: return(DateTime.Now);

            default: throw new AccountingModuleException("Special field value is not supported. Value was: {0}. Field name was: {1}", specialFieldValue.ToString(), this.FieldName ?? string.Empty);
            }
        }
예제 #8
0
 public abstract bool IsSimpleConditonHold(IDataSourceStore dsStore);
예제 #9
0
 public override IEnumerable <Tuple <IEventReaction, Dictionary <string, object> > > TakeReactionsFor(IEventDefinition eventDefinition, IDataSourceStore dsStore)
 {
     foreach (var evRec in eventDefinition.EventReactions)
     {
         yield return(Tuple.Create <IEventReaction, Dictionary <string, object> >(evRec, evRec.TakeReaction(dsStore)));
     }
 }
예제 #10
0
 public abstract object GetValue(IDataSourceStore dsStore);
예제 #11
0
 public bool IsHold(IDataSourceStore dsStore)
 {
     return(this.Condition.IsHold(dsStore));
 }
예제 #12
0
 public bool IsLessThan(Field another, IDataSourceStore dsStore)
 {
     return(CustomMathOps.IsLessThan(this.GetValue(dsStore), another.GetValue(dsStore)));
 }
예제 #13
0
 public abstract IEnumerable <Tuple <IEventReaction, Dictionary <string, object> > > TakeReactionsFor(IEventDefinition eventDefinition, IDataSourceStore dsStore);
예제 #14
0
 public bool IsHold(IDataSourceStore dsStore)
 {
     return(this.IsSimpleConditonHold(dsStore));
 }
예제 #15
0
 public override bool IsSimpleConditonHold(IDataSourceStore dsStore)
 {
     return(sourceField.IsEqualTo(targetField, dsStore) || sourceField.IsLessThan(targetField, dsStore));
 }
 public bool IsHold(IDataSourceStore dsStore)
 {
     return(this.IsComplexConditionHold(dsStore));
 }
 public abstract bool IsComplexConditionHold(IDataSourceStore dsStore);
예제 #18
0
 public override object GetValue(IDataSourceStore dsStore)
 {
     return(this.GetSimpleFieldValue(dsStore));
 }
예제 #19
0
 public abstract object GetSimpleFieldValue(IDataSourceStore dsStore);
예제 #20
0
 public override bool IsSimpleConditonHold(IDataSourceStore dsStore)
 {
     return(sourceField.IsGreaterThan(targetField, dsStore));
 }
예제 #21
0
 public abstract IEnumerable <IEventDefinition> GetHoldEvents(IDataSourceStore dsStore);