private void button10_Click(object sender, EventArgs e) { Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument; DocumentLock documentLock = mdiActiveDocument.LockDocument(); string text = FileUtils.SaveFileName(Utils.CADDir(), "两表模板.mdb", "Access数据库(*.mdb)|*.mdb"); if (text == null) { text = Path.GetDirectoryName(Utils.CADDir()) + "\\两表模板.mdb"; } else { FileUtils.CopyFile("C:\\ZJDTemplete\\两表模板.mdb", text, true); } JzxService jzxService = new JzxService(); List <Jzx> jzxList; try { jzxList = jzxService.SetJzxBs(); } finally { UserControl1.utils.deleteLayerSur("删除"); } List <Jzxinfo> list = jzxService.JzxToJzxinfo(jzxList); List <string> sqls = OperateMdb.OpJzxinfoSql(list); OperateMdb.InsertSql(sqls, text); mdiActiveDocument.Editor.WriteMessage("mdb标示表生成完成\n"); documentLock.Dispose(); }
private void button11_Click(object sender, EventArgs e) { Document mdiActiveDocument = Application.DocumentManager.MdiActiveDocument; DocumentLock documentLock = mdiActiveDocument.LockDocument(); Dictionary <string, string> dictionary = ExcelUtils.ReadExcelToDic("C:\\ZJDTemplete\\行政代码.xls", 0); string text = FileUtils.SaveFileName(Utils.CADDir(), "两表模板.mdb", "Access数据库(*.mdb)|*.mdb"); if (text == null) { text = Path.GetDirectoryName(Utils.CADDir()) + "\\两表模板.mdb"; } else { FileUtils.CopyFile("C:\\ZJDTemplete\\两表模板.mdb", text, true); } object[] fromText = this.formService.ShowFourAddressForm(); List <Jzx> jzxQzb = this.jzxService.getJzxQzb(fromText); List <Qzb> qzbList = this.jzxService.JzxToQzb(jzxQzb); List <string> list = OperateMdb.OpQzbSql(qzbList); if (list.Count != 0) { OperateMdb.InsertSql(list, text); } mdiActiveDocument.Editor.WriteMessage("mdb签章表生成完成\n"); documentLock.Dispose(); }
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); }