private PropertyFieldInfo(PropertyInfo property, FieldControlAttribute ctrlAttr) { NickName = property.Name; IsEmpty = true; DisplayNameAttribute dispAttr = Attribute.GetCustomAttribute(property, typeof(DisplayNameAttribute), false) as DisplayNameAttribute; if (dispAttr == null) { DisplayName = NickName; } else { DisplayName = dispAttr.DisplayName; } DataType = MetaDataUtil.ConvertTypeToDataType(property.PropertyType); Control = ctrlAttr; FieldLayoutAttribute layoutAttr = Attribute.GetCustomAttribute(property, typeof(FieldLayoutAttribute), false) as FieldLayoutAttribute; if (layoutAttr == null) { Layout = new FieldLayoutAttribute(); } else { Layout = layoutAttr; } FieldDecoderAttribute decodeAttr = Attribute.GetCustomAttribute(property, typeof(FieldDecoderAttribute), false) as FieldDecoderAttribute; if (decodeAttr != null) { Decoder = decodeAttr; } else { Decoder = new FieldDecoderAttribute(); } FieldInfoAttribute infoAttr = Attribute.GetCustomAttribute(property, typeof(FieldInfoAttribute), false) as FieldInfoAttribute; if (infoAttr != null) { IsKey = infoAttr.IsKey; IsEmpty = infoAttr.IsEmpty; Length = infoAttr.Length; Hint = infoAttr.Hint; HintPosition = infoAttr.HintPosition; } FieldUploadAttribute uploadAttr = Attribute.GetCustomAttribute(property, typeof(FieldUploadAttribute), false) as FieldUploadAttribute; Upload = uploadAttr; }
public CodeTableFieldInfoEx SetControl(ControlType ctrl) { VerifyControl(); if (fControl.Control != ctrl) { fControl = new FieldControlAttribute(ctrl); } return(this); }
private void VerifyControl() { var type = IsKey || FieldName == DecoderConst.DEL_FIELD_NAME ? ControlType.Hidden : ControlType.Text; if (fControl == null) { fControl = new FieldControlAttribute(type); } }
public static PropertyFieldInfo Create(PropertyInfo property) { TkDebug.AssertArgumentNull(property, "property", null); FieldControlAttribute ctrlAttr = Attribute.GetCustomAttribute(property, typeof(FieldControlAttribute), false) as FieldControlAttribute; if (ctrlAttr == null) { return(null); } return(new PropertyFieldInfo(property, ctrlAttr)); }