public List <Jzxinfo> JzxToJzxinfo(List <Jzx> jzxList) { List <Jzxinfo> list = new List <Jzxinfo>(); char[] separator = new char[] { '_' }; foreach (Jzx current in jzxList) { List <string> jzxBs = current.getJzxBs(); for (int i = 0; i < jzxBs.Count; i++) { string text = jzxBs[i]; string[] array = text.Split(separator); Jzxinfo jzxinfo = new Jzxinfo(); jzxinfo.setBzdh(current.getCbfbm()); jzxinfo.setQdh(array[0]); jzxinfo.setZdh(array[1]); jzxinfo.setTsbc(double.Parse(array[4])); jzxinfo.setJxxz("确定界"); jzxinfo.setJzxlb(array[2]); jzxinfo.setJzxwz(array[3]); jzxinfo.setQdzb(array[5]); jzxinfo.setZdzb(array[6]); list.Add(jzxinfo); } } return(list); }
public static Dictionary <string, List <Jzxinfo> > MdbToJzxinfo(string mdbPath) { DataTable dataTable = OperateMdb.ReadAllData("jzxinfo", mdbPath, true); DataRowCollection rows = dataTable.Rows; List <Jzxinfo> list = null; Dictionary <string, List <Jzxinfo> > dictionary = new Dictionary <string, List <Jzxinfo> >(); foreach (DataRow dataRow in rows) { object[] itemArray = dataRow.ItemArray; Jzxinfo jzxinfo = new Jzxinfo(); int i = 0; while (i < itemArray.Length) { switch (i) { case 0: jzxinfo.setBzdh((string)itemArray[i]); break; case 2: jzxinfo.setQdh((string)itemArray[i]); break; case 3: jzxinfo.setZdh((string)itemArray[i]); break; case 4: { double tsbc = 0.0; try { tsbc = double.Parse((string)itemArray[i]); } catch { } jzxinfo.setTsbc(tsbc); break; } } IL_E4: i++; continue; goto IL_E4; } if (jzxinfo.getTsbc() > 0.0) { dictionary.TryGetValue(jzxinfo.getBzdh(), out list); if (list == null) { list = new List <Jzxinfo>(); list.Add(jzxinfo); dictionary.Add(jzxinfo.getBzdh(), list); } else { list.Add(jzxinfo); } } } return(dictionary); }