コード例 #1
0
        /// <summary>
        /// 通过行获取数据
        /// </summary>
        /// <param name="row"></param>
        public static ElectrodeGapValueInfo GetInfoForDataRow(DataRow row)
        {
            ElectrodeGapValueInfo info = new ElectrodeGapValueInfo();

            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;
                }
            }
            try
            {
                info.ERNum[0] = Convert.ToInt32(row["ER-X"]);
                info.ERNum[0] = Convert.ToInt32(row["ER-X"]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(info);
        }
コード例 #2
0
        /// <summary>
        ///创建行
        /// </summary>
        /// <param name="row"></param>
        public void CreateDataRow(ref DataRow row)
        {
            ElectrodeGapValueInfo info = this.Clone() as ElectrodeGapValueInfo;

            foreach (PropertyInfo propertyInfo in typeof(ElectrodeGapValueInfo).GetProperties())
            {
                try
                {
                    row[propertyInfo.Name] = propertyInfo.GetValue(info, null);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            try
            {
                row["ER-X"] = info.ERNum[0];
                row["ER-Y"] = info.ERNum[1];
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
 /// <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;
     }
 }
コード例 #4
0
        /// <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;
            }
        }
コード例 #5
0
 /// <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;
     }
 }
コード例 #6
0
        /// <summary>
        /// 读取属性
        /// </summary>
        public static ElectrodeGapValueInfo GetAttribute(NXObject obj)
        {
            ElectrodeGapValueInfo info = new ElectrodeGapValueInfo();

            try
            {
                info.CrudeInter  = AttributeUtils.GetAttrForDouble(obj, "CrudeInter");
                info.CrudeNum    = AttributeUtils.GetAttrForInt(obj, "CrudeNum");
                info.DuringInter = AttributeUtils.GetAttrForDouble(obj, "DuringInter");
                info.DuringNum   = AttributeUtils.GetAttrForInt(obj, "DuringNum");
                info.FineInter   = AttributeUtils.GetAttrForDouble(obj, "FineInter");
                info.FineNum     = AttributeUtils.GetAttrForInt(obj, "FineNum");
                for (int i = 0; i < 2; i++)
                {
                    info.ERNum[i] = AttributeUtils.GetAttrForInt(obj, "ERNum", i);
                }
                return(info);
            }
            catch (NXException ex)
            {
                throw ex;
            }
        }
コード例 #7
0
 /// <summary>
 /// 比较是否修改电极
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool IsEquals(ElectrodeGapValueInfo other)
 {
     return(this.ERNum[0] == other.ERNum[0] &&
            this.ERNum[1] == other.ERNum[1]);
 }