private void btnSaveData_Click(object sender, EventArgs e)
        {
            if (worker.IsBusy)
            {
                return;
            }

            if (this.txtFilePath.Text == "")
            {
                MessageDxUtil.ShowTips("请选择指定的Excel文件");
                return;
            }

            if (MessageDxUtil.ShowYesNoAndWarning("该操作将把数据导入到系统数据库中,您确定是否继续?") == DialogResult.Yes)
            {
                if (myDs != null && myDs.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = myDs.Tables[0];
                    this.progressBar1.Visible = true;

                    //创建所需的事务对象
                    if (OnCreateTransaction != null)
                    {
                        transaction = OnCreateTransaction();
                    }

                    worker.RunWorkerAsync();
                }
            }
        }
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            int itemCount  = 0;
            int errorCount = 0;

            if (myDs != null && myDs.Tables[0].Rows.Count > 0)
            {
                //定义步长
                double    step = 50 * (1.0 / myDs.Tables[0].Rows.Count);
                DataTable dt   = myDs.Tables[0];
                int       i    = 1;
                try
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (OnDataSave != null)
                        {
                            #region 保存操作,如果有错误,则记录并处理
                            try
                            {
                                bool success = OnDataSave(dr);
                                if (success)
                                {
                                    itemCount++;
                                }
                            }
                            catch (Exception ex)
                            {
                                errorCount++;
                                LogTextHelper.Error(ex);
                                MessageDxUtil.ShowError(ex.Message);
                            }

                            if (errorCount >= 3)
                            {
                                var format = "记录导入已经连续出错超过[{0}]条,您是否确定退出导入操作?\r\n单击【是】退出导入,单击【否】忽略错误,继续导入下一记录。";
                                format = JsonLanguage.Default.GetString(format);
                                string message = string.Format(format, errorCount);

                                if (MessageDxUtil.ShowYesNoAndWarning(message) == System.Windows.Forms.DialogResult.Yes)
                                {
                                    break;
                                }
                                else
                                {
                                    errorCount = 0;//置零重新计算
                                }
                            }
                            #endregion
                        }

                        int currentStep = Convert.ToInt32(step * i);
                        worker.ReportProgress(currentStep);
                        i++;
                    }

                    if (itemCount == dt.Rows.Count)
                    {
                        e.Result = "操作成功";
                    }
                    else
                    {
                        e.Result = "操作完成,有错误可能未导入全部";
                    }
                }
                catch (Exception ex)
                {
                    e.Result = ex.Message;
                    LogTextHelper.Error(ex);
                    MessageDxUtil.ShowError(ex.ToString());
                }
            }
            else
            {
                e.Result = "请检查数据记录是否存在";
            }
        }