Esempio n. 1
0
File: DataBase.cs Progetto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        virtual public AttributePropertyInfoPairCollection GetDeviceDataItemAttributes()
        {
            AttributePropertyInfoPairCollection result = new AttributePropertyInfoPairCollection();

            PropertyInfo[] propertyInfos = this.GetType().GetProperties();
            foreach (PropertyInfo pi in propertyInfos)
            {
                object[] atts = pi.GetCustomAttributes(typeof(DataItemAttribute), false);
                if (atts.Length > 0)
                {
                    DataItemAttribute att = (DataItemAttribute)atts[0];

                    AttributePropertyInfoPair pair = new AttributePropertyInfoPair(
                        att, pi);

                    result.Add(pair);
                }
            }

            // sort
            //
            result.Sort();

            return(result);
        }
Esempio n. 2
0
File: DataBase.cs Progetto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        virtual public ReportItemCollection GetReportItems()
        {
            ReportItemCollection reportItems = new ReportItemCollection();

            AttributePropertyInfoPairCollection attPropertyInfos = this.GetDeviceDataItemAttributes();

            foreach (AttributePropertyInfoPair item in attPropertyInfos)
            {
                DataItemAttribute att   = item.Attribute;
                PropertyInfo      pi    = item.PropertyInfo;
                object            value = pi.GetValue(this, null);

                //if (!this.HideDataAttributeNames.Contains(att.Name))
                if (!HideDataAttributeNameManager.Default.Contains(this.GetType().Name, att.Name))
                {
                    ReportItem reportItem = new ReportItem(att.Name, value, att.Unit, att.Format);
                    reportItems.Add(reportItem);
                }
            }

            return(reportItems);
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="att"></param>
 /// <param name="pi"></param>
 public AttributePropertyInfoPair(DataItemAttribute att, PropertyInfo pi)
 {
     this.Attribute    = att;
     this.PropertyInfo = pi;
 }
Esempio n. 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="att"></param>
 /// <param name="pi"></param>
 public AttributePropertyInfoPair(DataItemAttribute att, PropertyInfo pi)
 {
     this.Attribute = att;
     this.PropertyInfo = pi;
 }