private void btnView_Click(object sender, EventArgs e) { string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/SourceDB"), "DBType"); if (string.IsNullOrEmpty(strCurrentDB)) { ComUtil.MsgBox("没有进行字段匹配,无法导入!"); return; } //选择待导入的文件 string str = ""; if (strCurrentDB.CompareTo("EXCEL") == 0) { openFileDialog1.Filter = "Excel文档(*.xls)|*.xls"; } if (strCurrentDB.CompareTo("ACCESS") == 0) { openFileDialog1.Filter = "MDB文档(*.mdb)|*.mdb"; } openFileDialog1.FilterIndex = 1; openFileDialog1.Title = "打开文件"; openFileDialog1.InitialDirectory = EmedFunc.GetLocalPersonCfgPath(); openFileDialog1.RestoreDirectory = true; openFileDialog1.FileName = ""; openFileDialog1.ShowDialog(); try { str = openFileDialog1.FileName; if (!string.IsNullOrEmpty(str)) { this.txtImportFilePath.Text = str; ClientConfiguration.HisPath = str; string sql = string.Empty; if (strCurrentDB.CompareTo("EXCEL") == 0) { ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + str + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'"; sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/Sqls/Sql").InnerText; } if (strCurrentDB.CompareTo("ACCESS") == 0) { string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/HisProductMapList.xml", "Config/DestDB"), "Password")); ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ;Jet OLEDB:Database Password="******"; Data Source = " + str + ";"; sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisProductMapList.xml", "Config/ASqls/Sql").InnerText; } ClientConfiguration.Save(); DataTable dt = GpoSendDao.GetInstance().GetErpSend(sql); dt.DefaultView.RowFilter = " PRODUCT_CODE is not null"; this.bindingSource1.DataSource = null; this.bindingSource1.DataSource = dt; } } catch (Exception ex) { this.bindingSource1.DataSource = null; ComUtil.MsgBox("不是有效的数据文件!"); } }
private GpoSendBLL(string connectionName) { dao = GpoSendDao.GetInstance(connectionName); }
/// <summary> /// 获取导入的发货列表 /// </summary> /// <returns></returns> private DataTable GetImportTable() { string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/Sqls/Sql").InnerText; return(GpoSendDao.GetInstance().GetErpSend(sql)); }
private GpoSendBLL() { dao = GpoSendDao.GetInstance(); }