private EnterpriseIDCompareBLL()
 {
     dao = EnterpriseIDCompareDAO.GetInstance();
 }
 private EnterpriseIDCompareBLL(string connectionName)
 {
     dao = EnterpriseIDCompareDAO.GetInstance(connectionName);
 }
        private void btnView_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    this.openFileDialog.Filter = "Excel文件(*.xls)|*.xls|dbf文件(*.dbf)|*.dbf|文本文件(*.txt)|*.txt|所有文件 (*.*)|*.*";
            //    if (this.openFileDialog.ShowDialog() == DialogResult.OK)
            //    {
            //        if (this.openFileDialog.FileName == "")
            //        {
            //            EmedMessageBox.ShowWarning("请选择采购计划文件路径。");
            //        }
            //        else
            //        {
            //            this.txtFile.Text = this.openFileDialog.FileName;
            //            openFileDialog.InitialDirectory = System.Windows.Forms.Application.StartupPath;
            //            openFileDialog.RestoreDirectory = true;
            //            Cursor.Current = Cursors.AppStarting;
            //            string dbfile = this.openFileDialog.FileNames[0];
            //            this.ExcelToDS(dbfile);

            //        }
            //    }
            //}
            //catch (Exception exception1)
            //{
            //    return;
            //}
            //finally
            //{
            //    Cursor.Current = Cursors.Default;
            //    GC.Collect();
            //}


            string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisEnterPriseMapList.xml", "Config/SourceDB"), "DBType");

            if (string.IsNullOrEmpty(strCurrentDB))
            {
                XtraMessageBox.Show("没有进行字段匹配,无法导入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //ComUtil.MsgBox("没有进行字段匹配,无法导入!");
                return;
            }
            //选择待导入的文件
            string str = "";

            if (strCurrentDB.CompareTo("EXCEL") == 0)
            {
                openFileDialog.Filter = "Excel文档(*.xls)|*.xls";
            }
            if (strCurrentDB.CompareTo("ACCESS") == 0)
            {
                openFileDialog.Filter = "MDB文档(*.mdb)|*.mdb";
            }

            //openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf|Excel文档(*.xls)|*.xls";
            openFileDialog.FilterIndex      = 1;
            openFileDialog.Title            = "打开文件";
            openFileDialog.InitialDirectory = System.Windows.Forms.Application.StartupPath;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FileName         = "";
            openFileDialog.ShowDialog();
            try
            {
                str = openFileDialog.FileName;
                if (!string.IsNullOrEmpty(str))
                {
                    this.txtFile.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() + @"\HisEnterPriseMapList.xml", "Config/Sqls/Sql").InnerText;
                    }
                    if (strCurrentDB.CompareTo("ACCESS") == 0)
                    {
                        string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/HisEnterPriseMapList.xml", "Config/DestDB"), "Password"));
                        ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ;Jet OLEDB:Database Password="******"; Data Source = " + str + ";";
                        sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisEnterPriseMapList.xml", "Config/ASqls/Sql").InnerText;
                    }


                    //ClientConfiguration.ConnectionString = ClientConfiguration.ConnectionString.Replace(ClientConfiguration.HisPath, str);
                    ClientConfiguration.Save();


                    DataTable dt = EnterpriseIDCompareDAO.GetInstance().GetEnterPrise(sql);
                    this.bindingSource.DataSource = null;
                    this.bindingSource.DataSource = dt;
                    this.lb_DgvCaptionText.Text   = "HIS企业编码:共 " + dt.DefaultView.Count + " 条记录";
                    //setErpSendMapData();
                }
            }
            catch (Exception)
            {
                this.bindingSource.DataSource = null;
                XtraMessageBox.Show("不是有效的数据文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                //ComUtil.MsgBox("不是有效的数据文件!");
            }
        }