/// <summary>
 /// 读取属性
 /// </summary>
 public static ElectrodeAllInfo GetAttribute(NXObject obj)
 {
     try
     {
         ElectrodeRemarksInfo     rem   = ElectrodeRemarksInfo.GetAttribute(obj);
         ElectrodeCAMInfo         cam   = ElectrodeCAMInfo.GetAttribute(obj);
         ElectrodeGapValueInfo    gap   = ElectrodeGapValueInfo.GetAttribute(obj);
         ElectrodePitchInfo       pitch = ElectrodePitchInfo.GetAttribute(obj);
         ElectrodePreparationInfo pre   = ElectrodePreparationInfo.GetAttribute(obj);
         ElectrodeSetValueInfo    sv    = ElectrodeSetValueInfo.GetAttribute(obj);
         ElectrodeNameInfo        name  = ElectrodeNameInfo.GetAttribute(obj);
         ElectrodeDatumInfo       da    = ElectrodeDatumInfo.GetAttribute(obj);
         return(new ElectrodeAllInfo()
         {
             Remarks = rem,
             CAM = cam,
             GapValue = gap,
             Pitch = pitch,
             Preparetion = pre,
             SetValue = sv,
             Name = name,
             Datum = da
         });
     }
     catch (NXException ex)
     {
         throw ex;
     }
 }
Example #2
0
        /// <summary>
        ///创建行
        /// </summary>
        /// <param name="row"></param>
        public void CreateDataRow(ref DataRow row)
        {
            ElectrodeNameInfo info = this.Clone() as ElectrodeNameInfo;

            foreach (PropertyInfo propertyInfo in typeof(ElectrodeNameInfo).GetProperties())
            {
                try
                {
                    row[propertyInfo.Name] = propertyInfo.GetValue(info, null);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Example #3
0
        /// <summary>
        /// 读取属性
        /// </summary>
        public static ElectrodeNameInfo GetAttribute(NXObject obj)
        {
            ElectrodeNameInfo info = new ElectrodeNameInfo();

            try
            {
                info.EleName          = AttributeUtils.GetAttrForString(obj, "EleName");
                info.BorrowName       = AttributeUtils.GetAttrForString(obj, "BorrowName");
                info.EleNumber        = AttributeUtils.GetAttrForInt(obj, "EleNumber");
                info.EleEditionNumber = AttributeUtils.GetAttrForString(obj, "EleEditionNumber");
                return(info);
            }
            catch (NXException ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 创建表头
        /// </summary>
        /// <param name="table"></param>
        public static DataTable CreateDataTable()
        {
            try
            {
                DataTable table = new DataTable();
                ElectrodeCAMInfo.CreateDataTable(ref table);
                ElectrodeDatumInfo.CreateDataTable(ref table);
                ElectrodeGapValueInfo.CreateDataTable(ref table);
                ElectrodeNameInfo.CreateDataTable(ref table);

                ElectrodePitchInfo.CreateDataTable(ref table);
                ElectrodePreparationInfo.CreateDataTable(ref table);
                ElectrodeRemarksInfo.CreateDataTable(ref table);
                ElectrodeSetValueInfo.CreateDataTable(ref table);
                return(table);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        /// <summary>
        /// 通过行获取数据
        /// </summary>
        /// <param name="row"></param>
        public static ElectrodeNameInfo GetInfoForDataRow(DataRow row)
        {
            ElectrodeNameInfo info = new ElectrodeNameInfo();

            for (int i = 0; i < row.Table.Columns.Count; i++)
            {
                try
                {
                    PropertyInfo propertyInfo = info.GetType().GetProperty(row.Table.Columns[i].ColumnName);
                    if (propertyInfo != null && row[i] != DBNull.Value)
                    {
                        propertyInfo.SetValue(info, row[i], null);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(info);
        }
 /// <summary>
 /// 通过行获取数据
 /// </summary>
 /// <param name="row"></param>
 public static ElectrodeAllInfo GetInfoForDataRow(DataRow row)
 {
     try
     {
         ElectrodeAllInfo info = new ElectrodeAllInfo()
         {
             CAM         = ElectrodeCAMInfo.GetInfoForDataRow(row),
             Datum       = ElectrodeDatumInfo.GetInfoForDataRow(row),
             GapValue    = ElectrodeGapValueInfo.GetInfoForDataRow(row),
             Name        = ElectrodeNameInfo.GetInfoForDataRow(row),
             Pitch       = ElectrodePitchInfo.GetInfoForDataRow(row),
             Preparetion = ElectrodePreparationInfo.GetInfoForDataRow(row),
             Remarks     = ElectrodeRemarksInfo.GetInfoForDataRow(row),
             SetValue    = ElectrodeSetValueInfo.GetInfoForDataRow(row)
         };
         return(info);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }