//生成XML文件 public XmlDocument createXml(string kid, string username, string password, string kct_uuid) { DataTable dt = CSVFileHelper.OpenCSV(textBox1.Text); List <KCT_CASE_INFO> kctList = CSVFileHelper.ToKctList(dt); dic = CSVFileHelper.Group(kctList); XmlDocument xmlStr = CSVFileHelper.CreateXml(dic, kid, username, password, kct_uuid); if (xmlStr == null) { Console.WriteLine("f1null"); } else { Console.WriteLine("f1ookokok"); } return(xmlStr); // return CSVFileHelper.CreateXml(dic, "K3101150000002011080064", "admin", "d54335949bd2b7f43bca357350e164ed", "52813100500148620140730230647098"); //if (a) //{ // //MessageBox.Show("XML文件已生成!"); // return true; //} //else //{ // return false; //} }
public XmlDocument createXml(string kid, string username, string password, string kct_uuid) { DataTable dt = CSVFileHelper.OpenCSV(txtfile.Text.Trim()); List <KCT_CASE_INFO> kctList = CSVFileHelper.ToKctList(dt); dic = CSVFileHelper.Group(kctList); XmlDocument xmlStr = CSVFileHelper.CreateXml(dic, kid, username, password, kct_uuid); return(xmlStr); }
private void button2_Click(object sender, EventArgs e) { string constring = "Data Source=" + oracleSid + ";Persist Security Info=True;User ID=" + oracleName + ";Password="******";Unicode=True"; DBHelperORACLE doo = new DBHelperORACLE(constring); //再尝试转换对应的文件 Boolean createXmlOk = createXml(); if (createXmlOk) { //最后将转换后的数据按地址(GPS)为依据逐个作为这个K号的多个记录导入 string path = Application.StartupPath + "\\data.xml"; byte[] data; FileStream fs = File.OpenRead(path); data = new byte[fs.Length]; fs.Read(data, 0, Convert.ToInt32(fs.Length)); fs.Close(); Program.LastError = ""; DataTable dt = CSVFileHelper.OpenCSV(csvPath); List <KCT_CASE_INFO> kctList = CSVFileHelper.ToKctList(dt); dic = CSVFileHelper.Group(kctList); Boolean isOk = CSVFileHelper.insert(dic, inv_no, constring); Boolean XmlisOk = CSVFileHelper.InsertXml(inv_no, data, doo); if (isOk && XmlisOk) { MessageBox.Show("导入完成!"); this.Close(); } else { if (!isOk && !XmlisOk) { MessageBox.Show("索引和数据均导入失败!\r\n" + Program.LastError); } else if (!isOk) { MessageBox.Show("索引导入失败!\r\n" + Program.LastError); } else { MessageBox.Show("数据均导入失败!\r\n" + Program.LastError); } } } else { MessageBox.Show("XML文件生成失败"); } }
//生成XML文件 public Boolean createXml() { DataTable dt = CSVFileHelper.OpenCSV(csvPath); List <KCT_CASE_INFO> kctList = CSVFileHelper.ToKctList(dt); dic = CSVFileHelper.Group(kctList); Boolean a = false;// CSVFileHelper.CreateXml(dic); if (a) { //MessageBox.Show("XML文件已生成!"); return(true); } else { return(false); } }
private void button1_Click(object sender, EventArgs e) { string constring = "Data Source=" + oracleSid + ";Persist Security Info=True;User ID=" + oracleName + ";Password="******";Unicode=True"; DBHelperORACLE doo = new DBHelperORACLE(constring); doo.openConn(); Boolean createXmlOk = createXml(); if (createXmlOk) { DataTable dt = CSVFileHelper.OpenCSV(csvPath); List <KCT_CASE_INFO> kctList = CSVFileHelper.ToKctList(dt); dic = CSVFileHelper.Group(kctList); Boolean updateOk = CSVFileHelper.update(dic, inv_no, constring); string path = Application.StartupPath + "\\data.xml"; byte[] data; FileStream fs = File.OpenRead(path); data = new byte[fs.Length]; fs.Read(data, 0, Convert.ToInt32(fs.Length)); fs.Close(); Boolean XmlisOk = CSVFileHelper.InsertXml(inv_no, data, doo); if (updateOk && XmlisOk) { MessageBox.Show("更新成功!"); this.Close(); } else { MessageBox.Show("更新失败!"); this.Close(); } } else { MessageBox.Show("XML文件生成失败"); this.Close(); } }