Пример #1
0
 /// <summary>
 /// 根据浏览属性生成对象
 /// </summary>
 /// <param name="entitytables"></param>
 /// <param name="entity"></param>
 /// <param name="fno"></param>
 /// <param name="xps"></param>
 /// <param name="flag"></param>
 private void GenderObjByBrowsable(SimpleAttrEntry entity, int fno, XProps xps, bool flag)
 {
     GenderObjByTable(entity.Common, fno, xps, flag);
     GenderObjByTable(entity.SelfAttribute, fno, xps, flag);
     GenderObjByTable(entity.Connectivity, fno, xps, flag);
     GenderObjByTable(entity.Gnwz, fno, xps, flag);
 }
Пример #2
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);
                 }
             }
         }
     }
 }
Пример #3
0
        /// <summary>
        /// 根据设备FNO生成绑定对象
        /// </summary>
        /// <param name="fno">设备fno</param>
        /// <returns></returns>
        public XProps GenderObjByFno(int fno)
        {
            XProps xps    = new XProps();
            var    entity = DeviceAttributeConfig.Instance.Attributes.SingleOrDefault(o => o.Fno == fno);

            if (entity == null)
            {
                return(null);
            }
            if (fno == 0)
            {
                GenderObjByTable(entity.Common, fno, xps, true);
                GenderObjByTable(entity.Common, fno, xps, false);
            }
            else
            {
                GenderObjByBrowsable(entity, fno, xps, true);
                GenderObjByBrowsable(entity, fno, xps, false);
            }

            return(xps);
        }