/// <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; } }
/// <summary> ///创建行 /// </summary> /// <param name="row"></param> public void CreateDataRow(ref DataRow row) { ElectrodeRemarksInfo info = this.Clone() as ElectrodeRemarksInfo; foreach (PropertyInfo propertyInfo in typeof(ElectrodeRemarksInfo).GetProperties()) { try { row[propertyInfo.Name] = propertyInfo.GetValue(info, null); } catch (Exception ex) { throw ex; } } }
/// <summary> /// 读取属性 /// </summary> public static ElectrodeRemarksInfo GetAttribute(NXObject obj) { ElectrodeRemarksInfo info = new ElectrodeRemarksInfo(); try { info.EleType = AttributeUtils.GetAttrForString(obj, "EleType"); info.Condition = AttributeUtils.GetAttrForString(obj, "Condition"); info.Ch = AttributeUtils.GetAttrForString(obj, "CH"); info.Remarks = AttributeUtils.GetAttrForString(obj, "Remarks"); info.Technology = AttributeUtils.GetAttrForString(obj, "Technology"); info.ElePresentation = AttributeUtils.GetAttrForString(obj, "ElePresentation"); 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; } }
/// <summary> /// 通过行获取数据 /// </summary> /// <param name="row"></param> public static ElectrodeRemarksInfo GetInfoForDataRow(DataRow row) { ElectrodeRemarksInfo info = new ElectrodeRemarksInfo(); 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; } }