public override void UpdateTable(string TName, params object[] list) { bs = new BindingSource(); YAttri _YAttri = new YAttri(); _YAttri = _DYAttri[TName]; Type myType = typeof(YAttri); 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(_YAttri, list[i]); } } for (int i = 0; i < myProperty.Length; i++) { strRow[i] = myProperty[i].GetValue(_YAttri).ToString(); } _DYAttri[TName] = _YAttri; bs.DataSource = _DYAttri.Values; xmlOperate.SetXMLRowValue(TName, strRow); }
public override void TableInitial() { bs = new BindingSource(); _DYAttri.Clear(); YAttri t1 = new YAttri(); YAttri t2 = new YAttri(); YAttri t3 = new YAttri(); YAttri t4 = new YAttri(); string[,] strTable = xmlOperate.GenerateXMLFile(XYpos, Y); if (strTable != null) { Type myType = typeof(YAttri); 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])); } } _DYAttri.Add(XYpos[0], t1); _DYAttri.Add(XYpos[1], t2); _DYAttri.Add(XYpos[2], t3); _DYAttri.Add(XYpos[3], t4); bs.DataSource = _DYAttri.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(); YAttri _yAttri = TClass as YAttri; _DYAttri[TName] = _yAttri; bs.DataSource = _DYAttri.Values; Type myType = typeof(YAttri); PropertyInfo[] myProperty = myType.GetProperties(); string[] strRow = new string[myProperty.Length]; for (int i = 0; i < myProperty.Length; i++) { strRow[i] = myProperty[i].GetValue(_yAttri).ToString(); } xmlOperate.SetXMLRowValue(TName, strRow); }
public override FromTableClass GetTableInfo(string TName) { YAttri _YAttri = _DYAttri[TName]; return(_YAttri); }