示例#1
0
        /// <summary>
        /// 判断订单中未匹配的产品和企业
        /// </summary>
        /// <param name="sOrderID"></param>
        /// <param name="sOrgID"></param>
        //private void JudgeCropDataList(string sOrderID, string sOrgID)
        //{
        //    DataTable dtCrop = new DataTable();
        //    DataTable dtProd = new DataTable();
        //    dtCrop = SalerOrderBLL.GetInstance().GetNotMapCorp(sOrderID, sOrgID);
        //    if (dtCrop.Rows.Count > 0)
        //    {
        //        FormCropMapExp formexpmap = new FormCropMapExp(dtCrop);
        //        formexpmap.ShowDialog();
        //    }
        //    dtProd = SalerOrderBLL.GetInstance().GetNotMapProd(sOrderID, sOrgID);
        //    if (dtProd.Rows.Count > 0)
        //    {
        //        FormProMapExp formpromap = new FormProMapExp(dtProd);
        //        formpromap.ShowDialog();
        //    }


        //}

        /// <summary>
        /// 获取对应的列名
        /// </summary>
        /// <param name="colName"></param>
        /// <returns></returns>
        private string getMapColName(string colName)
        {
            string result;

            /******************************************************************
            *
            * 修改时间:2007-3-21
            * 修改人:ningbo
            * 修改原因:
            * 新增代码:EmedFunc.GetLocalPersonCfgPath()+"GpoOrderSend.xml"
            *
            ******************************************************************/
            XmlNodeList nodeList = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/ContrastList").ChildNodes;

            foreach (XmlNode xn in nodeList)
            {
                XmlElement xe = (XmlElement)xn;
                if (colName.Equals(xe.GetAttribute("SourceField").ToUpper()))
                {
                    if (!string.IsNullOrEmpty(xe.GetAttribute("DestField")))
                    {
                        return(xe.GetAttribute("DestField"));
                    }
                }
            }
            return("");
        }
 public FormMain()
 {
     //InitializeComponent();
     this.components     = null;
     this._cfgList       = new CfgList();
     this._listIndex     = new ArrayList();
     this._isExistSlnCfg = false;
     this.InitializeComponent();
     localPersonCfgPath = EmedFunc.GetLocalPersonCfgPath();
 }
示例#3
0
        /// <summary>
        /// 选择数据文件 梁晓奕添加2007-4-13
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnImportDbFile_Click(object sender, EventArgs e)
        {
            switch (this.cmbDBType.SelectedIndex)
            {
            case 1:
                openFileDialog1.Filter = "MDB文档(*.mdb)|*.mdb";
                break;

            case 2:
                openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf";
                break;

            case 4:
                openFileDialog1.Filter = "Excel文档(*.xls)|*.xls";
                break;

            default:
                return;
            }
            openFileDialog1.FilterIndex      = 1;
            openFileDialog1.Title            = "打开文件";
            openFileDialog1.InitialDirectory = Application.StartupPath;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName         = "";
            //modify by gaoyuan 20070417 取消时不做任何操作
            if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            string fileName = openFileDialog1.FileName;

            //add by yanbing 2007-6-11 for export to access
            //this.txtDataBase.Text = fileName;
            //end by yanbing  2007-6-11

            string soureFileName = EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text;
            string backFileName  = EmedFunc.GetLocalPersonCfgPath() + @"\Bak" + this.txtDataBase.Text;

            if (!File.Exists(backFileName))
            {
                File.Copy(soureFileName, backFileName);
            }
            if (File.Exists(soureFileName))
            {
                File.Delete(soureFileName);
            }
            if (File.Exists(fileName))
            {
                File.Copy(fileName, soureFileName);
            }
        }
示例#4
0
        private string GetConnStr(string inDBType)
        {
            //MessageBox.Show(EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text);
            string text1 = "";
            string text2 = inDBType.ToUpper();

            if (text2 == null)
            {
                return(text1);
            }
            text2 = string.IsInterned(text2);
            if (text2 == "SQLSERVER")
            {
                return("Provider=SQLOLEDB;Server=" + this.txtServer.Text + ";UID=" + this.txtUser.Text + ";PWD=" + this.txtPassword.Text + ";Database=" + this.txtDataBase.Text);
            }
            if (text2 == "ACCESS")
            {
                //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
                //return ("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password="******";Data Source=" + this.txtDataBase.Text);
                return("Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password="******";Data Source=" + EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text);
            }
            if (text2 == "FOXPRO")
            {
                //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
                //return ("Provider=MSDASQL.1;Driver=Microsoft Visual Foxpro Driver;SourceDB=" + this.txtDataBase.Text + ";SourceType=DBF;");
                return("Provider=MSDASQL.1;Driver=Microsoft Visual Foxpro Driver;SourceDB=" + EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text + ";SourceType=DBF;");
            }
            if (text2 == "ORACLE")
            {
                return("Provider=MSDAORA.1;Data Source=" + this.txtServer.Text + ";User ID=" + this.txtUser.Text + ";Password="******"EXCEL")
            {
                return(text1);
            }
            if (Config.Intance().CurrentCfgType == "1")
            {
                //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
                return("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text + ";Persist Security Info=False;Extended Properties=\"Excel 8.0;IMEX=1\"");
            }
            //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
            return("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + EmedFunc.GetLocalPersonCfgPath() + @"\" + this.txtDataBase.Text + ";Extended Properties=Excel 8.0");
        }
        /// <summary>
        /// Handles the Load event of the SyncForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void SyncForm_Load(object sender, EventArgs e)
        {
            //StartSycn();
            InitializeListView();

            this.lblTime.Visible  = false;
            this.msgLabel.Visible = false;
            //this.SyncProgressBar.Visible = false;
            string filePath;

            //判断主库文件是否存在,不存在,只能全同步  2007-6-28
            if (EmedFunc.GetLocalPersonCfgPath().EndsWith("\\"))
            {
                filePath = EmedFunc.GetLocalPersonCfgPath() + "db\\TradeAssistant.mdf";
            }
            else
            {
                filePath = EmedFunc.GetLocalPersonCfgPath() + "\\db\\TradeAssistant.mdf";
            }
            if (!File.Exists(filePath))
            {
                this.radioGroupSyncType.SelectedIndex = 0;
                //this.radioGroupSyncType.EditValue = 1;
                this.chkUpload.Enabled = false;
            }
            else
            {
                this.radioGroupSyncType.SelectedIndex = 1;
                this.chkUpload.Enabled = true;
            }
            overFlag = false;
            if (!string.IsNullOrEmpty(ClientConfiguration.Skin))
            {
                this.LookAndFeel.SetSkinStyle(ClientConfiguration.Skin);
            }
            else
            {
                this.LookAndFeel.SetSkinStyle("Money Twins");
            }
        }
        /// <summary>
        /// 废弃
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public DataTable SetOrderReceiveDTColoum(DataTable dt)
        {
            Config.Intance().InitCfgData(EmedFunc.GetLocalPersonCfgPath() + @"\HisOrderReceive.xml");
            Config    config   = Config.Intance();
            DataTable outTable = new DataTable();

            outTable = dt.Copy();
            bool      Ifhas = false;
            ArrayList al    = new ArrayList();

            foreach (DataColumn dc in outTable.Columns)
            {
                XmlElement element1 = config.EleContrast;
                XmlElement element2 = (XmlElement)config.EleDestination.SelectSingleNode("DestTable");
                for (int num1 = 0; num1 < element1.ChildNodes.Count; num1++)
                {
                    string text1 = element1.ChildNodes[num1].Attributes["SourceField"].Value.Trim().ToLower();
                    string text2 = element1.ChildNodes[num1].Attributes["DestField"].Value.Trim().ToLower();

                    if (text1.ToLower() == dc.Caption.ToLower())
                    {
                        dc.ColumnName = text2;
                        Ifhas         = true;
                    }
                }
                if (Ifhas == false)
                {
                    al.Add(dc);
                }
                Ifhas = false;
            }

            for (int i = 0; i < al.Count; i++)
            {
                outTable.Columns.Remove((DataColumn)al[i]);
            }
            //修改DataTable列的顺序
            //DataTable dtout = changeOrder(outTable, config);
            return(outTable);
        }
        /// <summary>
        /// Handles the Load event of the SyncForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void SyncForm_Load(object sender, EventArgs e)
        {
            //StartSycn();
            InitializeListView();
            listView1.CheckBoxes         = false;
            this.lblTime.Visible         = false;
            this.msgLabel.Visible        = false;
            this.SyncProgressBar.Visible = false;
            string filePath;

            //判断主库文件是否存在,不存在,只能全同步  2007-6-28
            if (EmedFunc.GetLocalPersonCfgPath().EndsWith("\\"))
            {
                filePath = EmedFunc.GetLocalPersonCfgPath() + "db\\TradeAssistant.mdf";
            }
            else
            {
                filePath = EmedFunc.GetLocalPersonCfgPath() + "\\db\\TradeAssistant.mdf";
            }
            if (!File.Exists(filePath))
            {
                this.rbAdd.Enabled     = false;
                this.chkUpload.Enabled = false;
                this.csvFlag.Checked   = false;
                this.rbAll.Checked     = true;
            }
            //add by yanbing csv方式下载配置读取 2007-6-28
            string XmlPath = ClientConfiguration.LocalPersonConfigPath + @"\UserConfig.xml";

            if (File.Exists(XmlPath))
            {
                XmlDocument document1 = new XmlDocument();
                document1.Load(XmlPath);
                XmlElement element1 = (XmlElement)document1.SelectSingleNode("UserConfig/ConnectLogic");
                this.csvFlag.Checked = element1.GetAttribute("IfUseCSVMethod").ToLower() == "true";
            }
            //end add
        }
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <param name="inDestFilePath">目标文件路径</param>
        /// <param name="inDataTable">导出数据集</param>
        /// <returns></returns>
        public bool ExportReceive(string inDestFilePath, DataTable inDataTable)
        {
            bool flag = true;

            Config.Intance().InitCfgData(EmedFunc.GetLocalPersonCfgPath() + @"\HisOrderReceive.xml");
            this._Config = Config.Intance();
            XmlElement element1 = (XmlElement)this._Config.EleDestination.SelectSingleNode("DestTable");
            //获前当前程序路径
            string AppPath = EmedFunc.GetLocalPersonCfgPath();// AppDomain.CurrentDomain.BaseDirectory;
            //获取当前导出数据类型对象
            string DbType = this._Config.EleDestination.GetAttribute("DBType").ToString().Trim();


            switch (DbType)
            {
            case "EXCEL":
                if (!inDestFilePath.ToString().Contains("xls"))
                {
                    XtraMessageBox.Show("请选择有效的EXCEL文件(*.xls)!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                if (!this.CopyStandardTempFile(AppPath + @"\SendReceiveBak.xls", inDestFilePath, DbType))
                {
                    XtraMessageBox.Show("导出到货SendReceiveBak.xls模板复制失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                flag = OrdReceiveExcelDao.ExportReceive(inDataTable, inDestFilePath);

                break;

            default:
                break;
            }

            return(flag);
        }
 private void btnTest_Click(object sender, EventArgs e)
 {
     try
     {
         if (Config.Intance().CurrentCfgType == "1")
         {
             DataSet set1;
             if (Config.Intance().CurrentDBType == "TXT")
             {
                 set1 = uncTxt.getDataSet(Config.Intance().CurrentTxtTemplet);
             }
             else if (Config.Intance().CurrentDBType == "FOXPRO")
             {
                 set1 = EmedOdbc.getDataSet(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01"), Config.Intance().CurrentDBConStr);
             }
             else
             {
                 set1 = EmedDB.getDataSet(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01"), Config.Intance().CurrentDBConStr);
             }
             if ((set1 != null) && EmedFunc.CheckTable(set1))
             {
                 if (this.IsFullSql(set1))
                 {
                     XtraMessageBox.Show("Sql语句配置正确!", "提示");
                     this.btnSaveSql.Enabled = this.btnDataView.Enabled = true;
                 }
                 else
                 {
                     this.btnSaveSql.Enabled = this.btnDataView.Enabled = false;
                 }
             }
             else
             {
                 XtraMessageBox.Show("Sql语句配置错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 this.btnSaveSql.Enabled = this.btnDataView.Enabled = false;
             }
         }
         else
         {
             bool flag1;
             if (Config.Intance().CurrentDBType == "TXT")
             {
                 uncTxt txt1 = new uncTxt();
                 flag1 = (txt1.BeginInsert(Config.Intance().CurrentTxtTemplet) && txt1.ExecInsert(this.CreateTestDataRow(), true)) && txt1.EndInsert();
             }
             else if (Config.Intance().CurrentDBType == "FOXPRO")
             {
                 flag1 = EmedOdbc.ExcuteSql(this.CreateTestInsertSql(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01")), Config.Intance().CurrentDBConStr) && EmedOdbc.ExcuteSql(this.sqlDelete, Config.Intance().CurrentDBConStr);
             }
             else if (Config.Intance().CurrentDBType == "EXCEL")
             {
                 flag1 = EmedDB.ExcuteSql(this.CreateTestInsertSql(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01")), Config.Intance().CurrentDBConStr);
             }
             else if (Config.Intance().CurrentDBType == "ACCESS")
             {
                 flag1 = EmedDB.ExcuteSql(this.CreateTestInsertSql(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01")), Config.Intance().CurrentDBConStr) && EmedDB.ExcuteSql(this.sqlDelete, Config.Intance().CurrentDBConStr);
             }
             else
             {
                 flag1 = EmedDB.ExcuteSql(this.CreateTestInsertSql(this.rtbSql.Text.Trim().Replace(":StoreOutDate", "2002-01-01")), Config.Intance().CurrentDBConStr) && EmedDB.ExcuteSql(this.sqlDelete, Config.Intance().CurrentDBConStr);
             }
             if (flag1)
             {
                 XtraMessageBox.Show("Sql语句配置正确!", "提示");
                 this.btnSaveSql.Enabled = true;
             }
             else
             {
                 XtraMessageBox.Show("Sql语句配置错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 this.btnSaveSql.Enabled = this.btnDataView.Enabled = false;
             }
         }
     }
     catch (Exception exception1)
     {
         XtraMessageBox.Show("Sql语句配置错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         ErrorLog.SaveLog("测试SQL", exception1);
     }
 }
        /// <summary>
        /// 初始化HIS接口项目列表
        /// </summary>
        private void InitCfgList()
        {
            this.lvConfig.DataSource = null;
            //this.lvConfig.Items.Clear();
            ArrayList list1 = new ArrayList();

            this._isExistSlnCfg = this._cfgList.ReadConfig();
            if (this._isExistSlnCfg)
            {
                for (int num1 = 0; num1 < this._cfgList.Cfgs.Length; num1++)
                {
                    if (this._cfgList.Cfgs[num1] != null)
                    {
                        string text1 = Application.StartupPath + @"\" + this._cfgList.Cfgs[num1].DllName;
                        //MessageBox.Show(localPersonCfgPath + @"\" + this._cfgList.Cfgs[num1].CfgName);
                        string text2 = localPersonCfgPath + @"\" + this._cfgList.Cfgs[num1].CfgName;
                        string text3 = Application.StartupPath + @"\" + this._cfgList.Cfgs[num1].CfgTemplet;
                        if (File.Exists(text2))
                        {
                            ListViewItem item1 = new ListViewItem(this._cfgList.Cfgs[num1].Name);
                            item1.Tag = localPersonCfgPath + @"\" + this._cfgList.Cfgs[num1].CfgName;
                            item1.SubItems.Add(this._cfgList.Cfgs[num1].CfgName);
                            item1.SubItems.Add(this._cfgList.Cfgs[num1].TypeCn);
                            list1.Add(item1);
                            this._listIndex.Add(num1.ToString());
                            if (!File.Exists(text2) && File.Exists(text3))
                            {
                                File.Copy(text3, text2);
                            }
                        }
                    }
                }
            }
            else
            {
                string text4 = Application.StartupPath + @"\HisPortalReceiveLib.dll";
                if (File.Exists(text4))
                {
                    ListViewItem item2 = new ListViewItem("导出到货项目");
                    item2.Tag = EmedFunc.GetLocalPersonCfgPath() + @"\HisOrderReceive.xml";
                    item2.SubItems.Add("HisOrderReceive.xml");
                    item2.SubItems.Add("导出");
                    list1.Add(item2);
                    if (!File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\HisOrderReceive.xml") && File.Exists(Application.StartupPath + @"\ReceivePortal.data"))
                    {
                        File.Copy(Application.StartupPath + @"\ReceivePortal.data", EmedFunc.GetLocalPersonCfgPath() + @"\HisOrderReceive.xml");
                    }
                }
                string text5 = Application.StartupPath + @"\HisPortalEnterLib.dll";
                if (File.Exists(text5))
                {
                    ListViewItem item3 = new ListViewItem("导出入库项目");
                    item3.Tag = Application.StartupPath + @"\EnterPortal.cfg";
                    item3.SubItems.Add("EnterPortal.cfg");
                    item3.SubItems.Add("导出");
                    list1.Add(item3);
                    if (!File.Exists(Application.StartupPath + @"\EnterPortal.cfg") && File.Exists(Application.StartupPath + @"\EnterPortal.data"))
                    {
                        File.Copy(Application.StartupPath + @"\EnterPortal.data", Application.StartupPath + @"\EnterPortal.cfg");
                    }
                }
                string text6 = Application.StartupPath + @"\HisPortalPurchaseLib.dll";
                if (File.Exists(text6))
                {
                    ListViewItem item4 = new ListViewItem("导入采购计划项目");
                    item4.Tag = EmedFunc.GetLocalPersonCfgPath() + @"\HisPurchase.xml";
                    item4.SubItems.Add("HisPurchase.xml");
                    item4.SubItems.Add("导入");
                    list1.Add(item4);
                    if (!File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\HisPurchase.xml") && File.Exists(Application.StartupPath + @"\PurchasePortal.data"))
                    {
                        File.Copy(Application.StartupPath + @"\PurchasePortal.data", EmedFunc.GetLocalPersonCfgPath() + @"\HisPurchase.xml");
                    }
                }
                string text7 = Application.StartupPath + @"\HisPortalStockLib.dll";
                if (File.Exists(text7))
                {
                    ListViewItem item5 = new ListViewItem("导入库存项目");
                    item5.Tag = Application.StartupPath + @"\StockPortal.cfg";
                    item5.SubItems.Add("StockPortal.cfg");
                    item5.SubItems.Add("导入");
                    list1.Add(item5);
                    if (!File.Exists(Application.StartupPath + @"\StockPortal.cfg") && File.Exists(Application.StartupPath + @"\StockPortal.data"))
                    {
                        File.Copy(Application.StartupPath + @"\StockPortal.data", Application.StartupPath + @"\StockPortal.cfg");
                    }
                }
            }
            string text8 = Application.StartupPath + @"\ErpPortalStockLib.dll";

            if (File.Exists(text8))
            {
                ListViewItem item6 = new ListViewItem("导入物流系统库存数据");
                item6.Tag = Application.StartupPath + @"\ErpStockPortal.cfg";
                item6.SubItems.Add("ErpStockPortal.cfg");
                item6.SubItems.Add("导入");
                list1.Add(item6);
            }
            string text9 = Application.StartupPath + @"\ErpPortalStoreOutLib.dll";

            if (File.Exists(text9))
            {
                ListViewItem item7 = new ListViewItem("导入物流系统出库数据");
                item7.Tag = Application.StartupPath + @"\ErpStoreOutPortal.cfg";
                item7.SubItems.Add("ErpStoreOutPortal.cfg");
                item7.SubItems.Add("导入");
                list1.Add(item7);
            }
            string text10 = Application.StartupPath + @"\ErpPortalMedicalLib.dll";

            if (File.Exists(text10))
            {
                ListViewItem item8 = new ListViewItem("导入物流系统药品字典数据");
                item8.Tag = Application.StartupPath + @"\ErpMedicalPortal.cfg";
                item8.SubItems.Add("ErpMedicalPortal.cfg");
                item8.SubItems.Add("导入");
                list1.Add(item8);
            }
            ListViewItem[] itemArray1 = new ListViewItem[list1.Count];
            list1.CopyTo(itemArray1);

            //this.lvConfig.Items.AddRange(itemArray1);


            //新加实验代码
            DataTable dt = new DataTable();

            dt.Columns.Add();
            dt.Columns.Add();
            dt.Columns.Add();
            dt.Columns.Add();
            dt.Columns[0].ColumnName = "name";
            dt.Columns[1].ColumnName = "item";
            dt.Columns[2].ColumnName = "detail";
            dt.Columns[3].ColumnName = "Tag";

            ListViewItem Parameter;
            DataRow      item;

            for (int i = 0; i < itemArray1.Length; i++)
            {
                Parameter = itemArray1[i];
                item      = dt.NewRow();

                item[0] = Parameter.SubItems[0].Text.ToString();
                item[1] = Parameter.SubItems[1].Text.ToString();
                item[2] = Parameter.SubItems[2].Text.ToString();
                item[3] = Parameter.Tag.ToString();
                dt.Rows.Add(item);
            }
            lvConfig.DataSource = dt.DefaultView;

            //结束
        }
        private void btnAllExport_Click(object sender, EventArgs e)
        {
            bool flag = true;

            if (this.gridView3.RowCount == 0)
            {
                XtraMessageBox.Show("无可操作记录!", Constant.MsgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                return;
            }

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

            if (strCurrentDB.Equals("EXCEL"))
            {
                //选择导出文件
                string ExpFilePath = this.SelectExportFile();

                if (ExpFilePath.Length == 0)
                {
                    return;
                }

                try
                {
                    //dttmp = (DataTable)(this.bindingSource1.List[0]);

                    DataRow[] drArray = dtReceive.DefaultView.Table.Select(dtReceive.DefaultView.RowFilter,
                                                                           dtReceive.DefaultView.Sort,
                                                                           dtReceive.DefaultView.RowStateFilter);

                    dttmp = dtReceive.DefaultView.Table.Clone();
                    foreach (DataRow dr in drArray)
                    {
                        dttmp.Rows.Add(dr.ItemArray);
                    }
                    //原代码全导出无法查询导出
                    //flag = OutOrderReceiveDao.GetInstance().ExportReceive(ExpFilePath, dtReceive);
                    //修改后
                    flag = OutOrderReceiveDao.GetInstance().ExportReceive(ExpFilePath, dttmp);
                    if (flag)
                    {
                        XtraMessageBox.Show("导出到货信息文件成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("导出到货信息文件失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        return;
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show("导出到货信息文件出错!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;
                }
            }

            string receiveIdstr    = string.Empty;
            string receiveHisIdstr = string.Empty;

            foreach (DataRow dr in dtReceive.Rows)
            {
                if (dr["TYPE"].ToString().Equals("1"))
                {
                    receiveIdstr += "'" + dr["ID"].ToString() + "',";
                }
                else
                {
                    receiveHisIdstr += "'" + dr["ID"].ToString() + "',";
                }
            }

            //OutOrderReceiveDao.GetInstance().UpdateOrderReceive(receiveIdstr, receiveHisIdstr);
        }
示例#12
0
 private bool CheckTemplet()
 {
     //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
     //if (((Config.Intance().CurrentDBType == "FOXPRO") && (Config.Intance().CurrentFoxproTemplet != "")) && !File.Exists(Config.Intance().CurrentFoxproTemplet))
     if (((Config.Intance().CurrentDBType == "FOXPRO") && (Config.Intance().CurrentFoxproTemplet != "")) && !File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\" + Config.Intance().CurrentFoxproTemplet))
     {
         XtraMessageBox.Show(Config.Intance().CurrentFoxproTemplet + "不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
     //if (((Config.Intance().CurrentDBType == "FOXPRO") && (Config.Intance().CurrentFoxproDetailTemplet != "")) && !File.Exists(Config.Intance().CurrentFoxproDetailTemplet))
     if (((Config.Intance().CurrentDBType == "FOXPRO") && (Config.Intance().CurrentFoxproDetailTemplet != "")) && !File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\" + Config.Intance().CurrentFoxproDetailTemplet))
     {
         XtraMessageBox.Show(Config.Intance().CurrentFoxproDetailTemplet + "不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
     //if (((Config.Intance().CurrentDBType == "TXT") && (Config.Intance().CurrentTxtTemplet != "")) && !File.Exists(Config.Intance().CurrentTxtTemplet))
     if (((Config.Intance().CurrentDBType == "TXT") && (Config.Intance().CurrentTxtTemplet != "")) && !File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\" + Config.Intance().CurrentTxtTemplet))
     {
         XtraMessageBox.Show(Config.Intance().CurrentTxtTemplet + "不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     //modify by gaoyuan 20070411 由于发布时将数据库文件以数据文件的类型发布,故修改文件路径
     //if (((Config.Intance().CurrentDBType == "EXCEL") && (Config.Intance().CurrentExcelTemplet != "")) && !File.Exists(Config.Intance().CurrentExcelTemplet))
     if (((Config.Intance().CurrentDBType == "EXCEL") && (Config.Intance().CurrentExcelTemplet != "")) && !File.Exists(EmedFunc.GetLocalPersonCfgPath() + @"\" + Config.Intance().CurrentExcelTemplet))
     {
         XtraMessageBox.Show(Config.Intance().CurrentExcelTemplet + "不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);;
         return(false);
     }
     return(true);
 }
        /// <summary>
        /// 获取导入的发货列表
        /// </summary>
        /// <returns></returns>
        private DataTable GetImportTable()
        {
            string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/Sqls/Sql").InnerText;

            return(GpoSendDao.GetInstance().GetErpSend(sql));
        }
示例#14
0
        public bool ReadConfig()
        {
            XmlDocument document1 = null;
            int         num;
            bool        flag1;
            string      clientType = "0";
            string      text1      = EmedFunc.GetLocalPersonCfgPath() + @"\" + this.CfgFileName;
            string      userConfig = EmedFunc.GetLocalPersonCfgPath() + @"\UserConfig.xml";

            try
            {
                document1 = new XmlDocument();
                if (!File.Exists(text1))
                {
                    return(false);
                }

                //判断是否福建项目 2007-6-27
                if (File.Exists(userConfig))
                {
                    XmlDocument userDoc = new XmlDocument();
                    userDoc.Load(userConfig);
                    XmlElement elementUser = (XmlElement)userDoc.SelectSingleNode("UserConfig/ClientType");
                    if (elementUser != null)
                    {
                        clientType = elementUser.GetAttribute("type").Trim().ToUpper();
                    }
                }
                document1.Load(text1);
                XmlElement element1 = (XmlElement)document1.SelectSingleNode("Config/CfgList");
                this.Cfgs = new CfgList[element1.ChildNodes.Count];
                num       = 0;
                for (int num1 = 0; num1 < element1.ChildNodes.Count; num1++)
                {
                    //判断是否福建项目 2007-6-27
                    if ("1".Equals(clientType) && (element1.ChildNodes[num1].Attributes["Name"].Value.Equals("采购申请导出") || element1.ChildNodes[num1].Attributes["Name"].Value.Equals("采购申请发货导入") || element1.ChildNodes[num1].Attributes["Name"].Value.Equals("导入医院表信息")))
                    {
                        continue;
                    }

                    this.Cfgs[num]            = new CfgList();
                    this.Cfgs[num].Name       = element1.ChildNodes[num1].Attributes["Name"].Value;
                    this.Cfgs[num].Type       = element1.ChildNodes[num1].Attributes["Type"].Value;
                    this.Cfgs[num].DllName    = element1.ChildNodes[num1].Attributes["DllName"].Value;
                    this.Cfgs[num].CfgName    = element1.ChildNodes[num1].Attributes["CfgName"].Value;
                    this.Cfgs[num].CfgTemplet = element1.ChildNodes[num1].Attributes["CfgTemplet"].Value;
                    if (this.Cfgs[num].Type == "0")
                    {
                        this.Cfgs[num].TypeCn = "导出";
                    }
                    else
                    {
                        this.Cfgs[num].TypeCn = "导入";
                    }
                    if (element1.ChildNodes[num1].Attributes["IsMulti"] == null)
                    {
                        this.Cfgs[num].IsMulti = false;
                    }
                    else
                    {
                        this.Cfgs[num].IsMulti = element1.ChildNodes[num1].Attributes["CfgTemplet"].Value == "1";
                    }
                    this.Cfgs[num].FoxTemplet = element1.ChildNodes[num1].SelectSingleNode("FoxTemplet").InnerText;
                    //this.Cfgs[num1].MDBTemplet = element1.ChildNodes[num1].SelectSingleNode("MDBTemplet").InnerText;
                    //this.Cfgs[num1].DBName = element1.ChildNodes[num1].SelectSingleNode("DBName").InnerText;
                    this.Cfgs[num].FoxDetailTemplet = element1.ChildNodes[num1].SelectSingleNode("FoxDetailTemplet").InnerText;
                    this.Cfgs[num].TxtTemplet       = element1.ChildNodes[num1].SelectSingleNode("TxtTemplet").InnerText;
                    this.Cfgs[num].ExcelTemplet     = element1.ChildNodes[num1].SelectSingleNode("ExcelTemplet").InnerText;
                    ++num;
                }
                flag1 = true;
            }
            catch (Exception exception1)
            {
                ErrorLog.SaveLog("读取配置文件出错", exception1);
                flag1 = false;
            }
            finally
            {
                document1 = null;
            }
            return(flag1);
        }
        /// <summary>
        /// 浏览按钮的操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            /******************************************************************
            *
            * 修改时间:2007-3-21
            * 修改人:ningbo
            * 修改原因:
            * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml"
            *
            ******************************************************************/
            string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/SourceDB"), "DBType");

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

            if (strCurrentDB.CompareTo("EXCEL") == 0)
            {
                openFileDialog1.Filter = "Excel文档(*.xls)|*.xls";
            }
            //openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf|Excel文档(*.xls)|*.xls";
            openFileDialog1.FilterIndex      = 1;
            openFileDialog1.Title            = "打开文件";
            openFileDialog1.InitialDirectory = Application.StartupPath;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName         = "";
            openFileDialog1.ShowDialog();

            try
            {
                str = openFileDialog1.FileName;
                if (!string.IsNullOrEmpty(str))
                {
                    this.txtImportFilePath.Text = str;
                    ClientConfiguration.HisPath = str;

                    if (strCurrentDB.CompareTo("EXCEL") == 0)
                    {
                        ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + str + ";Extended Properties=Excel 8.0";
                    }
                    //ClientConfiguration.ConnectionString = ClientConfiguration.ConnectionString.Replace(ClientConfiguration.HisPath, str);
                    ClientConfiguration.Save();
                    //ClientConfiguration.Reload();

                    /******************************************************************
                    *
                    * 修改时间:2007-3-21
                    * 修改人:ningbo
                    * 修改原因:
                    * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml"
                    *
                    ******************************************************************/
                    //string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/Sqls/Sql").InnerText;

                    //DataTable dt = GpoSendDao.GetInstance().GetErpSend(sql);

                    DataTable dt = GetImportTable();
                    this.bindingSource1.DataSource = null;
                    this.bindingSource1.DataSource = dt;
                    //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24
                    //如果为1就是进销存对接接口
                    string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type");
                    if (clientPlat.Equals("1"))
                    {
                        //dtImp = dt.Clone();
                        RetOrderItem(out count);
                    }
                    else
                    {
                        setErpSendMapData(out count);
                    }



                    int matchRowsCount = 0;
                    foreach (DataGridViewRow dgvr in dgvErpSend.Rows)
                    {
                        if (dgvr.Cells["type"].Value == "0")
                        {
                            matchRowsCount++;
                        }
                    }
                    if (matchRowsCount > 0)
                    {
                        btnImport.Enabled = true;
                    }
                    else
                    {
                        //btnImport.Enabled = false;
                    }
                    if (count > 0)
                    {
                        lbmess.Text = "有" + count.ToString() + "个产品编码(显示为红色)对应多条数据,请选择一条!";
                        if (dgvErpSend.RowCount > 0)
                        {
                            lbmess.Visible = true;
                        }
                        else
                        {
                            lbmess.Visible = false;
                        }
                    }
                }
            }
            catch (Exception)
            {
                this.bindingSource1.DataSource = null;
                MessageBox.Show("不是有效的数据文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Syncs this instance.
        /// </summary>
        private bool Sync()
        {
            bool   returnvalue = true;
            string filePath;
            //FileControl.CompactAccessDB(ClientConfiguration.TmpDBFile);

            //删除的记录数
            int rows = 0;

            //上传数据操作---------------------------------------------------------
            listView1.Invoke(new treeinvoke(UpdateStart));
            if (this.chkUpload.Checked && chkUpload.Enabled)
            {
                List <string> InvalidList = null;

                if (EmedFunc.GetLocalPersonCfgPath().EndsWith("\\"))
                {
                    filePath = EmedFunc.GetLocalPersonCfgPath() + "db\\TradeAssistant.mdf";
                }
                else
                {
                    filePath = EmedFunc.GetLocalPersonCfgPath() + "\\db\\TradeAssistant.mdf";
                }
                if (File.Exists(filePath))
                {
                    //罗澜涛 仿安徽交易助手程序方法 2007-04-06
                    bool flag = new ClientUploadBLL().UploadData(false, out InvalidList, out rows);
                    if (!flag)
                    {
                        MessageBox.Show("本地数据上传失败,请重试", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        rows = 0;
                        return(false);
                    }
                }
            }
            curr_rows = rows;
            listView1.Invoke(new treeinvoke(UpdatelistView2));
            //---------------------------------------------------------------------
            DateTime Time_Star, Time_End;
            //获取买方ID
            //string buyerId = ClientSession.GetInstance().CurrentUser.UserOrg.Reg_org_id;
            //获取用户ID
            //string userId = ClientSession.GetInstance().CurrentUser.UserInfo.Id;

            //获取当前用户对象
            LogedInUser CurrentUser = ClientSession.GetInstance().CurrentUser;

            //建立同步dao对象,在整个同步过程中只建立一次数据库连接
            ClientSyncDataDAO syncDao = ClientSyncDataDAO.GetInstance("ClientTempDB");

            //if (!this.rbAdd.Checked && csvFlag.Checked)
            //syncDao.OpenADShell();
            for (int i = 1; i < listView1.Items.Count; i++)
            {
                //timer_num = 0;
                curr_row    = i;
                progressNum = 0;
                Time_Star   = DateTime.Now;
                listView1.Invoke(new treeinvoke(UpdatelistView1));

                curr_rows = 0;
                try
                {
                    if (Selected == "1" && i != listView1.Items.Count - 1)
                    {
                        if (this.rbAdd.Checked)
                        {
                            //增量同步
                            curr_rows = syncDao.AllIncrementOneSync(CurrentUser, Pub_tablename, logFlag);
                        }
                        else
                        {
                            //全同步
                            if (csvFlag.Checked)
                            {
                                //采用CVS方式
                                curr_rows = syncDao.AllSyncFromCsv(CurrentUser, Pub_tablename);
                            }
                            else
                            {
                                curr_rows = syncDao.AllSyncOneData(CurrentUser, Pub_tablename);
                            }
                        }
                    }

                    if (i == listView1.Items.Count - 1)
                    {
                        syncDao.OpenADShell();
                        syncDao.CompressDB(ClientConfiguration.TmpDBFile);
                        syncDao.CloseADShell();
                    }
                }
                catch (Exception ex)
                {
                    returnvalue = false;
                }

                Time_End = DateTime.Now;
                TimeSpan timeSpan = Time_End.Subtract(Time_Star);
                int      seconds  = Convert.ToInt16(timeSpan.TotalSeconds);
                curr_time = new ClientSyncBLL().SecondToTimeStr(seconds);
                listView1.Invoke(new treeinvoke(UpdatelistView2));
                if (curr_rows != -1)
                {
                    Total_rows = Total_rows + curr_rows;
                }
                Total_time = Total_time + seconds;
            }
            //if (!this.rbAdd.Checked && csvFlag.Checked)
            //syncDao.CloseADShell();

            //同步完成,关闭数据库连接
            syncDao.CloseConntion();

            if (Total_rows != 0)
            {
                try
                {
                    //FileControl.CompactAccessDB(ClientConfiguration.TmpDBFile);
                    CopyDB(ClientConfiguration.TmpDBFile, ClientConfiguration.LocalDBFile);
                }
                catch (Exception ex)
                {
                    if (MessageBox.Show("复制压缩库文件异常,请检查磁盘空间,现在是否退出?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }

            return(returnvalue);
        }
示例#17
0
        /// <summary>
        /// 订单导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExpOrder_Click(object sender, EventArgs e)
        {
            int    iCount   = 0;
            string sOrderID = string.Empty;          //订单ID
            string sOrgID   = base.CurrentUserOrgId; //卖方机构ID

            if (this.dgvSalerOrderList.CurrentRow == null)
            {
                MessageBox.Show("请选择订单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (this.dgvSalerOrderList.CurrentRow.Cells["order_id"].Value != null)
            {
                sOrderID = this.dgvSalerOrderList.CurrentRow.Cells["order_id"].Value.ToString();
            }
            //JudgeCropDataList(sOrderID, sOrgID);
            //判断是否有未匹配的数据

            //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24
            //如果为1就是进销存对接接口

            string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type");

            if (IfHasNotMapData(sOrderID, sOrgID) && !clientPlat.Equals("1"))
            {
                MessageBox.Show("存在未匹配数据,导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                //DataTable mapdt = ProxyFactory.ErpSendRemote.GetOrderExpData(orderid);

                DataTable mapdt = GpoSendBLL.GetInstance().GetOrderExpData(sOrderID, base.CurrentUserOrgId, clientPlat);
                DataTable dt    = new DataTable();

                //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-29
                if ("1".Equals(clientPlat))
                {
                    if (mapdt == null || mapdt.Rows.Count == 0)
                    {
                        return;
                    }
                    dt = mapdt.DefaultView.ToTable().Copy();


                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                else
                {
                    if (mapdt == null || mapdt.Rows.Count == 0)
                    {
                        return;
                    }
                    mapdt.DefaultView.RowFilter = " productid is not null";
                    dt = mapdt.DefaultView.ToTable().Copy();
                    mapdt.DefaultView.RowFilter = " productid is null";
                }

                iCount = mapdt.DefaultView.Count;
                IList result = new ArrayList();

                foreach (DataColumn dc in dt.Columns)
                {
                    string newColName = getMapColName(dc.ColumnName.ToUpper());
                    if (!string.IsNullOrEmpty(newColName))
                    {
                        dc.ColumnName = newColName;
                    }
                    else
                    {
                        result.Add(dc.ColumnName);
                    }
                }
                for (int i = 0; i < result.Count; i++)
                {
                    dt.Columns.Remove(result[i].ToString());
                }
                string str = "";

                /******************************************************************
                *
                * 修改时间:2007-3-21
                * 修改人:ningbo
                * 修改原因:
                * 新增代码:EmedFunc.GetLocalPersonCfgPath()+"GpoOrderExport.xml"
                *
                ******************************************************************/
                string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "DBType");
                this.saveFileDialog1.FilterIndex = 1;
                saveFileDialog1.Title            = "保存文件为";
                saveFileDialog1.InitialDirectory = Application.StartupPath;
                saveFileDialog1.RestoreDirectory = true;
                saveFileDialog1.FileName         = "ORD" + dgvSalerOrderList.CurrentRow.Cells["ORDER_CODE"].Value.ToString();
                if (strCurrentDB.Equals("EXCEL"))
                {
                    this.saveFileDialog1.Filter = "Excel文档(*.xls)|*.xls";
                    if (saveFileDialog1.ShowDialog() != DialogResult.Cancel)
                    {
                        str = saveFileDialog1.FileName;
                        bool flg = FileOperation.ExportExcelFile(dt, str);
                        if (flg)
                        {
                            string mess = "";
                            if (iCount > 0)
                            {
                                mess = "有" + iCount.ToString() + "条数据未被导出";
                            }
                            MessageBox.Show("导出完毕!" + mess, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                //导出订单到SQLServer
                else if (strCurrentDB.Equals("SQLSERVER"))
                {
                    bool flag = false;
                    try
                    {
                        //获得SQLServer服务数据
                        string server   = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "ServerName");
                        string database = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "DataBase");
                        string user     = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "User");
                        string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "Password"));

                        //获得表明
                        string tableName = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB/DestTable"), "TableName");

                        //导出操作
                        flag = GpoSendDao.ExportErpToMSS(tableName, GetConString(server, database, user, password), dt);
                    }
                    catch
                    {
                        flag = false;
                    }
                    if (flag)
                    {
                        string mess = "";
                        if (iCount > 0)
                        {
                            mess = "有" + iCount.ToString() + "条数据未被导出";
                        }
                        MessageBox.Show("导出完毕!" + mess, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        MessageBox.Show("导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
示例#18
0
        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 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() + @"\HisHosptailMapList.xml", "Config/SourceDB"), "DBType");

            if (string.IsNullOrEmpty(strCurrentDB))
            {
                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() + @"\HisHosptailMapList.xml", "Config/Sqls/Sql").InnerText;
                    }
                    if (strCurrentDB.CompareTo("ACCESS") == 0)
                    {
                        string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/HisHosptailMapList.xml", "Config/DestDB"), "Password"));
                        ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ;Jet OLEDB:Database Password="******"; Data Source = " + str + ";";
                        sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisHosptailMapList.xml", "Config/ASqls/Sql").InnerText;
                    }

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


                    DataTable dt = HosptailIDCompareDAO.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;
                ComUtil.MsgBox("不是有效的数据文件!");
            }
        }
示例#20
0
        /// <summary>
        /// 浏览按钮的操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            dtTemp.Columns.Clear();
            string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisPurchase.xml", "Config/SourceDB"), "DBType");

            if (string.IsNullOrEmpty(strCurrentDB))
            {
                ComUtil.MsgBox("没有进行字段匹配,无法导入!");
                return;
            }
            //选择待导入的文件
            string strFileName = string.Empty;

            if (strCurrentDB.CompareTo("EXCEL") == 0)
            {
                openFileDialog1.Filter = "Excel文档(*.xls)|*.xls";
            }
            //openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf|Excel文档(*.xls)|*.xls";
            openFileDialog1.FilterIndex      = 1;
            openFileDialog1.Title            = "打开文件";
            openFileDialog1.InitialDirectory = System.Windows.Forms.Application.StartupPath;
            openFileDialog1.RestoreDirectory = true;
            openFileDialog1.FileName         = "";
            openFileDialog1.ShowDialog();
            try
            {
                strFileName = openFileDialog1.FileName;
                if (!string.IsNullOrEmpty(strFileName))
                {
                    this.txtImportFilePath.Text = strFileName;
                    ClientConfiguration.HisPath = strFileName;

                    if (strCurrentDB.CompareTo("EXCEL") == 0)
                    {
                        ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + strFileName + ";Extended Properties=Excel 8.0";
                    }

                    ClientConfiguration.Save();

                    string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\HisPurchase.xml", "Config/Sqls/Sql").InnerText;

                    dtRequestSend = RequestSendDal.GetInstance().GetRequestSend(sql);
                    dtRequestSend.Columns.Add("type");                //采购单明细id
                    dtRequestSend.Columns.Add("state");
                    dtRequestSend.Columns.Add("emedProductId");
                    dtRequestSend.Columns.Add("emedSpecId");
                    dtRequestSend.Columns.Add("emedModelId");
                    dtRequestSend.Columns.Add("emedSenderId");
                    dtRequestSend.Columns.Add("emedSenderName");
                    dtRequestSend.Columns.Add("emedSenderEasy");
                    dtRequestSend.Columns.Add("selfpackage");
                    dtRequestSend.Columns.Add("factoryeasy");
                    dtRequestSend.Columns["Price"].DataType = Type.GetType("System.Double");
                    this.bindingSource1.DataSource          = null;
                    this.bindingSource1.DataSource          = dtRequestSend;
                    //获取耗材和医院匹配数据
                    SetErpSendMapData();
                    this.button1.Enabled   = true;
                    this.btnImport.Enabled = true;
                }
            }

            catch (Exception m)
            {
                this.bindingSource1.DataSource = null;
                ComUtil.MsgBox("不是有效的数据文件!");
            }
        }