/// <summary> /// Examine criteria match on the provided entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public override bool ResultForEntity(EntityBaseWithoutId entity) { if (entity == null) { ThrowHelper.ThrowArgumentNullException("entity"); } ExtractObjectData of = ExtractObjectData.Create(FieldName); return(Negation ? of.GetValue(entity) != null : of.GetValue(entity) == null); }
/// <summary> /// Examine criteria match on the provided entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public override bool ResultForEntity(EntityBaseWithoutId entity) { if (entity == null) { ThrowHelper.ThrowArgumentNullException("entity"); } bool result = false; ExtractObjectData ef = ExtractObjectData.Create(FieldName); Object fieldValue = ef.GetValue(entity); switch (Operand) { case ArithmeticOperandEnum.Equal: result = Value.CompareTo(fieldValue) == 0; break; case ArithmeticOperandEnum.NotEqual: result = Value.CompareTo(fieldValue) != 0; break; case ArithmeticOperandEnum.Greater: result = Value.CompareTo(fieldValue) < 0; break; case ArithmeticOperandEnum.Lower: result = Value.CompareTo(fieldValue) > 0; break; case ArithmeticOperandEnum.GreaterOrEqual: result = Value.CompareTo(fieldValue) <= 0; break; case ArithmeticOperandEnum.LowerOrEqual: result = Value.CompareTo(fieldValue) >= 0; break; default: throw new NotImplementedException(); } if (Negation) { result = !result; } return(result); }
/// <summary> /// Examine criteria match on the provided entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public override bool ResultForEntity(EntityBaseWithoutId entity) { if (entity == null) { ThrowHelper.ThrowArgumentNullException("entity"); } ExtractObjectData ef = ExtractObjectData.Create(FieldName); object fieldValue = ef.GetValue(entity); bool result = HiValue.CompareTo(fieldValue) >= 0 && LoValue.CompareTo(fieldValue) <= 0; // az értéknek a két érték közé kell esnie if (Negation) { // az értéknek nem szabad a két érték közé kell esnie result = !result; } return(result); }
/// <summary> /// Examine criteria match on the provided entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public override bool ResultForEntity(EntityBaseWithoutId entity) { if (entity == null) { ThrowHelper.ThrowArgumentNullException("entity"); } bool result = false; ExtractObjectData ef = ExtractObjectData.Create(FieldName); String entityValue = ef.GetValue(entity).ToString(); if (entityValue != null) { switch (MatchMode) { case LikeMatchModeEnum.Exact: result = entityValue.ToLower().Equals(Value.ToLower()); break; case LikeMatchModeEnum.Start: result = entityValue.ToLower().StartsWith(Value.ToLower()); break; case LikeMatchModeEnum.End: result = entityValue.ToLower().EndsWith(Value.ToLower()); break; case LikeMatchModeEnum.Anywhere: result = entityValue.ToLower().Contains(Value.ToLower()); break; default: throw new NotImplementedException(); } } if (Negation) { result = !result; } return(result); }
/// <summary> /// Compares the specified left entity. /// </summary> /// <param name="leftEntity">The left entity.</param> /// <param name="rightEntity">The right entity.</param> /// <returns></returns> public int Compare(EntityBaseWithoutId leftEntity, EntityBaseWithoutId rightEntity) { if (leftEntity == null) { ThrowHelper.ThrowArgumentNullException("leftEntity"); } if (rightEntity == null) { ThrowHelper.ThrowArgumentNullException("rightEntity"); } int result = 0; ExtractObjectData of = ExtractObjectData.Create(FieldName); object entityValueLeft = of.GetValue(leftEntity); object entityValueRight = of.GetValue(rightEntity); if (entityValueLeft == null && entityValueRight == null) { // egyenlőek } else if (entityValueLeft == null) { result = -1; } else if (entityValueRight == null) { result = 1; } else { result = ((IComparable)entityValueLeft).CompareTo(entityValueRight); } if (OrderMode.Equals(OrderModeEnum.Desc)) { // revert order result = result * -1; } return(result); }
private static void LogAssemblyNewProperties(Assembly a) { // Log assembly properties which are available in newer version of Framework.NET if (mIsDynamicAvailable) { try { ExtractObjectData e = ExtractObjectData.Create("IsDynamic"); LOGGER.Info(string.Format("LOGUTILS, Assembly, IsDynamic: {0}", e.GetValue(a).ToString())); } catch (MissingFieldException) { mIsDynamicAvailable = false; } catch (MissingMemberException) { mIsDynamicAvailable = false; } catch (Exception) { } } if (mIsFullyTrustedAvailable) { try { ExtractObjectData e = ExtractObjectData.Create("IsFullyTrusted"); LOGGER.Info(string.Format("LOGUTILS, Assembly, IsFullyTrusted: {0}", e.GetValue(a).ToString())); } catch (MissingFieldException) { mIsFullyTrustedAvailable = false; } catch (MissingMemberException) { mIsFullyTrustedAvailable = false; } catch (Exception) { } } }
/// <summary> /// Filters the specified package. /// </summary> /// <param name="package">The package.</param> /// <returns> /// True, if the filter criterias matches, otherwise False. /// </returns> public override bool Filter(ReportPackage package) { DoInitializationCheck(); bool result = false; string value = ExtractObjectData.Create(this.MemberName).GetValue(package).ToString(); if (value != null) { switch (MatchMode) { case LikeMatchModeFilterEnum.Exact: result = value.ToLower().Equals(Value.ToLower()); break; case LikeMatchModeFilterEnum.Start: result = value.ToLower().StartsWith(Value.ToLower()); break; case LikeMatchModeFilterEnum.End: result = value.ToLower().EndsWith(Value.ToLower()); break; case LikeMatchModeFilterEnum.Anywhere: result = value.ToLower().Contains(Value.ToLower()); break; } } if (Negation) { result = !result; } return(result); }
/// <summary> /// Examine criteria match on the provided entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public override bool ResultForEntity(EntityBaseWithoutId entity) { if (entity == null) { ThrowHelper.ThrowArgumentNullException("entity"); } bool result = false; ExtractObjectData of = ExtractObjectData.Create(FieldName); object entityValue = of.GetValue(entity); foreach (object o in this.Values) { if (o == null && entityValue == null) { result = true; break; } else if (entityValue != null) { if (entityValue.Equals(o)) { result = true; break; } } } if (Negation) { result = !result; } return(result); }
/// <summary> /// Filters the specified package. /// </summary> /// <param name="package">The package.</param> /// <returns> /// True, if the filter criterias matches, otherwise False. /// </returns> public override bool Filter(ReportPackage package) { DoInitializationCheck(); bool result = false; IComparable value = (IComparable)ExtractObjectData.Create(this.MemberName).GetValue(package); switch (this.Operand) { case ArithmeticFilterOperandEnum.Equal: { if (value == null && this.Value == null) { result = true; } else if (value == null || this.Value == null) { } else { result = value.Equals((IComparable)Convert.ChangeType(this.Value, value.GetType())); } } break; case ArithmeticFilterOperandEnum.NotEqual: { if (value == null && this.Value == null) { } else if (value == null || this.Value == null) { result = true; } else { result = !value.Equals((IComparable)Convert.ChangeType(this.Value, value.GetType())); } } break; case ArithmeticFilterOperandEnum.Greater: { if (this.Value == null) { throw new NullReferenceException("Filter value is null"); } if (value == null) { throw new NullReferenceException(string.Format("Field or property value is null '{0}'", this.MemberName)); } result = value.CompareTo((IComparable)Convert.ChangeType(this.Value, value.GetType())) < 0; } break; case ArithmeticFilterOperandEnum.Lower: { if (this.Value == null) { throw new NullReferenceException("Filter value is null"); } if (value == null) { throw new NullReferenceException(string.Format("Field or property value is null '{0}'", this.MemberName)); } result = value.CompareTo((IComparable)Convert.ChangeType(this.Value, value.GetType())) > 0; } break; case ArithmeticFilterOperandEnum.GreaterOrEqual: { if (this.Value == null) { throw new NullReferenceException("Filter value is null"); } if (value == null) { throw new NullReferenceException(string.Format("Field or property value is null '{0}'", this.MemberName)); } result = value.CompareTo((IComparable)Convert.ChangeType(this.Value, value.GetType())) <= 0; } break; case ArithmeticFilterOperandEnum.LowerOrEqual: { if (this.Value == null) { throw new NullReferenceException("Filter value is null"); } if (value == null) { throw new NullReferenceException(string.Format("Field or property value is null '{0}'", this.MemberName)); } result = value.CompareTo((IComparable)Convert.ChangeType(this.Value, value.GetType())) >= 0; } break; } return(result); }
/// <summary> /// Logs the loaded assemblies. /// </summary> public static void LogDomainInfo() { if (LOGGER.IsInfoEnabled) { AppDomain domain = AppDomain.CurrentDomain; LOGGER.Info(string.Format("LOGUTILS, Domain, Id: {0}", domain.Id.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, base directory: {0}", domain.BaseDirectory)); LOGGER.Info(string.Format("LOGUTILS, Domain, dynamic directory: {0}", domain.DynamicDirectory)); LOGGER.Info(string.Format("LOGUTILS, Domain, friendly name: {0}", domain.FriendlyName)); try { ExtractObjectData e = ExtractObjectData.Create("IsFullyTrusted"); LOGGER.Info(string.Format("LOGUTILS, Domain, is fully trusted: {0}", e.GetValue(domain).ToString())); } catch (Exception) { } try { ExtractObjectData e = ExtractObjectData.Create("IsHomogenous"); LOGGER.Info(string.Format("LOGUTILS, Domain, is homogenous: {0}", e.GetValue(domain).ToString())); } catch (Exception) { } LOGGER.Info(string.Format("LOGUTILS, Domain, relative search path: {0}", domain.RelativeSearchPath)); LOGGER.Info(string.Format("LOGUTILS, Domain, shadow copy files: {0}", domain.ShadowCopyFiles)); if (domain.SetupInformation != null) { try { ExtractObjectData e = ExtractObjectData.Create("SetupInformation.AppDomainManagerAssembly"); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, AppDomainManagerAssembly: {0}", e.GetValue(domain).ToString())); } catch (Exception) { } try { ExtractObjectData e = ExtractObjectData.Create("SetupInformation.AppDomainManagerType"); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, AppDomainManagerType: {0}", e.GetValue(domain).ToString())); } catch (Exception) { } LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, ApplicationBase: {0}", domain.SetupInformation.ApplicationBase)); #if NETCOREAPP3_1 #else LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, ApplicationName: {0}", domain.SetupInformation.ApplicationName)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, CachePath: {0}", domain.SetupInformation.CachePath)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, ConfigurationFile: {0}", domain.SetupInformation.ConfigurationFile)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, DisallowApplicationBaseProbing: {0}", domain.SetupInformation.DisallowApplicationBaseProbing.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, DisallowBindingRedirects: {0}", domain.SetupInformation.DisallowBindingRedirects.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, DisallowCodeDownload: {0}", domain.SetupInformation.DisallowCodeDownload.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, DisallowPublisherPolicy: {0}", domain.SetupInformation.DisallowPublisherPolicy.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, DynamicBase: {0}", domain.SetupInformation.DynamicBase)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, LicenseFile: {0}", domain.SetupInformation.LicenseFile)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, LoaderOptimization: {0}", domain.SetupInformation.LoaderOptimization.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, PrivateBinPath: {0}", domain.SetupInformation.PrivateBinPath)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, PrivateBinPathProbe: {0}", domain.SetupInformation.PrivateBinPathProbe)); //LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, SandboxInterop: {0}", domain.SetupInformation.SandboxInterop.ToString())); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, ShadowCopyDirectories: {0}", domain.SetupInformation.ShadowCopyDirectories)); LOGGER.Info(string.Format("LOGUTILS, Domain, Setup Information, ShadowCopyFiles: {0}", domain.SetupInformation.ShadowCopyFiles)); #endif } LOGGER.Info("--------------------------------------------------------"); } }