Ejemplo n.º 1
0
 /// <summary>
 /// 根据表名填充绑定对象的值
 /// </summary>
 /// <param name="tableName">字段对应的表名</param>
 /// <param name="fieldCollection">字段集合</param>
 /// <param name="fno">设备fno</param>
 /// <param name="xps">绑定对象</param>
 /// <param name="flag">是否是必填</param>
 private void GenderObjByTable(TableWithProperty tableWithProperty, int fno, XProps xps, bool flag)
 {
     if (tableWithProperty != null)
     {
         var fieldCollection = tableWithProperty.PropertiesFromTable;
         if (fieldCollection != null && fieldCollection.Any())
         {
             foreach (var item in fieldCollection)
             {
                 if (item.Browsable == flag)
                 {
                     XProp xp = new XProp
                     {
                         Category    = tableWithProperty.TableName,
                         Name        = item.Field,
                         DisplayName = flag ? "*" + item.DisplayName : item.DisplayName,
                         ReadOnly    = item.ReadOnly,
                         ProType     = GetFieldType(fno, tableWithProperty.TableName.Trim(), item.Field),
                         Converter   = GetConverterByField(tableWithProperty.TableName, item.DropDownTable, item.Field, fno),
                         //Editor = GetUIEditor(tableName.Trim(), item.Field),
                         Value          = GetDefaultValue(fno, tableWithProperty.TableName.Trim(), item),
                         Browsable      = item.Browsable,
                         SaveValueByFid = item.SaveValueByFid,
                     };
                     xps.Add(xp);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public XPropDescriptor(ref XProp prop, Attribute[] attrs)
     : base(prop.DisplayName, attrs)
 {
     theProp = prop;
 }