public override void UpdateTable(string TName, params object[] list) { bs = new BindingSource(); TwoXAttri _twoZAttri = new TwoXAttri(); _twoZAttri = _DTwoXAttri[TName]; Type myType = typeof(TwoXAttri); PropertyInfo[] myProperty = myType.GetProperties(); string[] strRow = new string[myProperty.Length]; for (int i = 0; i < list.Length; i++) { if (!list[i].Equals(-1)) { myProperty[i].SetValue(_twoZAttri, list[i]); } } for (int i = 0; i < myProperty.Length; i++) { strRow[i] = myProperty[i].GetValue(_twoZAttri).ToString(); } _DTwoXAttri[TName] = _twoZAttri; bs.DataSource = _DTwoXAttri.Values; xmlOperate.SetXMLRowValue(TName, strRow); }
public override void TableInitial() { bs = new BindingSource(); _DTwoXAttri.Clear(); TwoXAttri t1 = new TwoXAttri(); TwoXAttri t2 = new TwoXAttri(); TwoXAttri t3 = new TwoXAttri(); TwoXAttri t4 = new TwoXAttri(); string[,] strTable = xmlOperate.GenerateXMLFile(XYpos, TowX); if (strTable != null) { Type myType = typeof(TwoXAttri); PropertyInfo[] myProperty = myType.GetProperties(); for (int i = 0; i < myProperty.Length; i++) { myProperty[i].SetValue(t1, Convert.ToDouble(strTable[0, i])); myProperty[i].SetValue(t2, Convert.ToDouble(strTable[1, i])); myProperty[i].SetValue(t3, Convert.ToDouble(strTable[2, i])); myProperty[i].SetValue(t4, Convert.ToDouble(strTable[3, i])); } } _DTwoXAttri.Add(XYpos[0], t1); _DTwoXAttri.Add(XYpos[1], t2); _DTwoXAttri.Add(XYpos[2], t3); _DTwoXAttri.Add(XYpos[3], t4); bs.DataSource = _DTwoXAttri.Values; }
public object[] GetValue(string type) { int[] index = GetNameId(type); object[] obj = null; if (index.Length == 1) { FromTableClass fromTableClass = LTableModel[index[0]].GetTableInfo(type); if (fromTableClass is SixZAttri) { SixZAttri _sixZAttri = fromTableClass as SixZAttri; Type myType = typeof(SixZAttri); PropertyInfo[] myProperty = myType.GetProperties(); obj = new object[myProperty.Length]; for (int i = 0; i < myProperty.Length; i++) { obj[i] = myProperty[i].GetValue(_sixZAttri); } } } else { List <object> Lobj = new List <object>(); for (int j = 0; j < index.Length; j++) { FromTableClass fromTableClass = LTableModel[index[j]].GetTableInfo(type); if (fromTableClass is TwoXAttri) { TwoXAttri _sixZAttri = fromTableClass as TwoXAttri; Type myType = typeof(TwoXAttri); PropertyInfo[] myProperty = myType.GetProperties(); for (int i = 0; i < myProperty.Length; i++) { Lobj.Add(myProperty[i].GetValue(_sixZAttri)); } } else if (fromTableClass is YAttri) { YAttri _sixZAttri = fromTableClass as YAttri; Type myType = typeof(YAttri); PropertyInfo[] myProperty = myType.GetProperties(); for (int i = 0; i < myProperty.Length; i++) { Lobj.Add(myProperty[i].GetValue(_sixZAttri)); } } } obj = Lobj.ToArray(); } return(obj); }
public override void UpdateTable(string TName, FromTableClass TClass) { bs = new BindingSource(); TwoXAttri _twoXAttri = TClass as TwoXAttri; _DTwoXAttri[TName] = _twoXAttri; bs.DataSource = _DTwoXAttri.Values; Type myType = typeof(TwoXAttri); PropertyInfo[] myProperty = myType.GetProperties(); string[] strRow = new string[myProperty.Length]; for (int i = 0; i < myProperty.Length; i++) { strRow[i] = myProperty[i].GetValue(_twoXAttri).ToString(); } xmlOperate.SetXMLRowValue(TName, strRow); }
public override FromTableClass GetTableInfo(string TName) { TwoXAttri _twoXAttri = _DTwoXAttri[TName]; return(_twoXAttri); }