public override string ToString() { if (!_isDefaultPropertyAttributeInit) { string defaultPropertyName = string.Empty; var xafDefaultPropertyAttribute = XafTypesInfo.Instance.FindTypeInfo(GetType()).FindAttribute <XafDefaultPropertyAttribute>(); if (xafDefaultPropertyAttribute != null) { defaultPropertyName = xafDefaultPropertyAttribute.Name; } else { var defaultPropertyAttribute = XafTypesInfo.Instance.FindTypeInfo(GetType()).FindAttribute <DefaultPropertyAttribute>(); if (defaultPropertyAttribute != null) { defaultPropertyName = defaultPropertyAttribute.Name; } } if (!string.IsNullOrEmpty(defaultPropertyName)) { _defaultPropertyMemberInfo = ClassInfo.FindMember(defaultPropertyName); } _isDefaultPropertyAttributeInit = true; } object obj = _defaultPropertyMemberInfo?.GetValue(this); return(obj?.ToString() ?? base.ToString()); }
public ColumnToPropertyMapping(Columns columns, Cell headerCell, Cell errorCell) { if (columns == null) { throw new ArgumentNullException("columns"); } if (headerCell == null) { throw new ArgumentNullException("classInfo"); } if (errorCell == null) { throw new ArgumentNullException("errorCell"); } errorCell.ColumnWidth = 2500; _columns = columns; ClassInfo = columns.Sheet.ClassInfo; HeaderCell = headerCell; ErrorCell = errorCell; Member = ClassInfo.FindMember(headerCell.Name).MemberInfo; ColumnIndex = headerCell.ColumnIndex; Criteria = headerCell.GetCriteria(); }
public override string ToString() { if (!BaseObject.IsXpoProfiling) { if (!isDefaultPropertyAttributeInit) { var memberName = string.Empty; var attribute1 = XafTypesInfo.Instance.FindTypeInfo(GetType()).FindAttribute <XafDefaultPropertyAttribute>(); if (attribute1 != null) { memberName = attribute1.Name; } else { var attribute2 = XafTypesInfo.Instance.FindTypeInfo(GetType()).FindAttribute <DefaultPropertyAttribute>(); if (attribute2 != null) { memberName = attribute2.Name; } } if (!string.IsNullOrEmpty(memberName)) { defaultPropertyMemberInfo = ClassInfo.FindMember(memberName); } isDefaultPropertyAttributeInit = true; } var obj = defaultPropertyMemberInfo?.GetValue(this); if (obj != null) { return(obj.ToString()); } } return(base.ToString()); }
protected override void OnChanged(string propertyName, object oldValue, object newValue) { base.OnChanged(propertyName, oldValue, newValue); var member = ClassInfo.FindMember(propertyName); var attribute = member.FindAttributeInfo(typeof(DeleteIfNullAttribute)); if (attribute != null && newValue == null) { Delete(); } }
public void AssignToCurrentUser() { if (ClassInfo.FindMember("Users") != null) { var list = ((IList)GetMemberValue("Users")); object value = ((XPBaseObject)SecuritySystem.CurrentUser).ClassInfo.KeyProperty.GetValue(SecuritySystem.CurrentUser); object objectByKey = Session.GetObjectByKey(SecuritySystem.UserType, value); list.Add(objectByKey); } }
protected override void TriggerObjectChanged(ObjectChangeEventArgs args) { if (!string.IsNullOrEmpty(args.PropertyName)) { var mi = ClassInfo.FindMember(args.PropertyName); if (mi != null && mi.ReferenceType != null) { base.TriggerObjectChanged(new ObjectChangeEventArgs(args.Session, args.Object, args.Reason, args.PropertyName + "!", args.OldValue, args.NewValue)); } } base.TriggerObjectChanged(args); }
/// <summary> /// Get the ElasticSearch Field Properties /// </summary> /// <param name="member">Member Name</param> /// <returns>ElasticSearch Field Properties</returns> public IElasticProperties ESProperties(string member) { var modelESField = ModelClass?.AllMembers.FirstOrDefault(t => t.Name == member) as IModelMemberElasticSearch; if (modelESField == null) { return(ClassInfo?.FindMember(member)?.FindAttributeInfo(typeof(ElasticPropertyAttribute)) as IElasticProperties); } else { var props = modelESField.ElasticSearch; return(!string.IsNullOrWhiteSpace(props?.FieldName) ? props : null); } }
protected override void OnChanged(string propertyName, object oldValue, object newValue) { base.OnChanged(propertyName, oldValue, newValue); if (!IsLoading) { if (ClassInfo.FindMember(propertyName).IsAssociation&& oldValue != newValue) { if (Session.IsNewObject(this) && newValue != null) { if (ClassInfo.FindMember(propertyName).GetAssociatedMember().IsCollection) { Oid = ((ClassInfo.FindMember(propertyName).GetAssociatedMember().GetValue(newValue) as IList).Count + 1) * -1; } } } } }
private void AddSuggestContextPathFieldInfo(SuggestField sf) { foreach (var context in sf.ContextSettings.Where(cs => !string.IsNullOrWhiteSpace(cs.PathField))) { var mi = ClassInfo.FindMember(context.PathField); var cpi = _ContextPathInfos.FirstOrDefault(i => i.PathMemberName.Equals(context.PathField) && i.MemberInfo == mi); if (cpi == null) { cpi = new SuggestContextPathFieldInfo { PathMemberName = context.PathField, ESFieldName = ElasticSearchClient.FieldName(context.PathField), MemberInfo = mi, IsIndexed = IsMemberESIndexed(context.PathField), }; _ContextPathInfos.Add(cpi); } context.ContextPathFieldInfo = cpi; } }
public override string ToString() { if (!isDefaultPropertyAttributeInit) { DefaultPropertyAttribute attrib = XafTypesInfo.Instance.FindTypeInfo(GetType()).FindAttribute <DefaultPropertyAttribute>(); if (attrib != null) { defaultPropertyMemberInfo = ClassInfo.FindMember(attrib.Name); } isDefaultPropertyAttributeInit = true; } if (defaultPropertyMemberInfo != null) { object obj = defaultPropertyMemberInfo.GetValue(this); if (obj != null) { return(obj.ToString()); } } return(base.ToString()); }
public override string ToString() { if (!_isDefaultPropertyAttributeInit) { var attrib = ClassInfo.FindAttributeInfo(typeof(DefaultPropertyAttribute)) as DefaultPropertyAttribute; if (attrib != null) { _defaultPropertyMemberInfo = ClassInfo.FindMember(attrib.Name); } _isDefaultPropertyAttributeInit = true; } if (_defaultPropertyMemberInfo != null) { object obj = _defaultPropertyMemberInfo.GetValue(this); if (obj != null) { return(obj.ToString()); } } return(base.ToString()); }
/// <summary> /// Is the Member marked as contained in an ElasticSearch index /// </summary> /// <param name="member">Name of the member</param> /// <returns>True if the member is marked as contained in an ElasticSearch index; otherwise False</returns> public bool IsMemberESContaining(string member) { var modelESMember = ModelClass?.AllMembers.FirstOrDefault(t => t.Name == member) as IModelMemberElasticSearch; return(modelESMember == null?ClassInfo?.FindMember(member)?.HasAttribute(typeof(ElasticContainingAttribute)) ?? false : modelESMember.Containing); }
/// <summary> /// Is the Member indexed with ElasticSearch /// </summary> /// <param name="member">Name of the member</param> /// <returns>True if the member is indexed in an ElasticSearch index; otherwise False</returns> public bool IsMemberESIndexed(string member) { var modelESMember = ModelClass?.AllMembers.FirstOrDefault(t => t.Name == member) as IModelMemberElasticSearch; return(modelESMember == null?ClassInfo?.FindMember(member)?.HasAttribute(typeof(ElasticPropertyAttribute)) ?? false : !string.IsNullOrWhiteSpace(modelESMember.ElasticSearch.FieldName)); }
/// <summary> /// Get the ElasticSearch Field Properties /// </summary> /// <param name="member">Member Name</param> /// <returns>ElasticSearch Field Properties</returns> public IElasticProperties ESProperties(string member) { if (!(ModelClass?.AllMembers.FirstOrDefault(t => t.Name == member) is IModelMemberElasticSearch modelESField)) { return(ClassInfo?.FindMember(member)?.FindAttributeInfo(typeof(ElasticPropertyAttribute)) as IElasticProperties); }