/// <summary>
        /// 建构式,传入精灵参数
        /// </summary>
        /// <param name="args"></param>
        public SelectFields(ArgDictionary args)
            : base(args)
        {
            InitializeComponent();
            NextButtonTitle = "开始验证";
            mArgs = args;
            mImportOption = mArgs["ImportOption"] as ImportFullOption;
            mImportWizard = mArgs["ImportWizard"] as ImportWizard;
            mSelectableFields = mArgs["SelectableFields"] as List<string>;

            this.Text = mImportWizard.ValidateRule.Root.GetAttributeText("Name") + "-" + this.Text;
            this.Text += "(" + CurrentStep + "/" + TotalStep + ")"; //功能名称(目前页数/总页数)

            RefreshFields();

            chkSelectAll.CheckedChanged += (sender, e) =>
            {
                foreach (ListViewItem Item in lvSourceFieldList.Items)
                {
                    Item.Checked = chkSelectAll.Checked;
                }
            };

            //若是没有使用者可选择的字段,则直接跳到下个画面;目前设这会有问题...
            //if (mSelectableFields.Count == 0)
            //    this.OnNextButtonClick();
        }
        /// <summary>
        /// 建构式,传入精灵参数
        /// </summary>
        /// <param name="args"></param>
        public SelectValidate(ArgDictionary args)
            : base(args)
        {
            InitializeComponent();

            //接口初始化设定
            NextButtonTitle = "开始汇入";
            NextButtonEnabled = false;
            btnViewResult.Enabled = false;

            //将精灵参数存起来用
            mArgs = args;
            mImportOption = mArgs["ImportOption"] as ImportFullOption;
            mImportWizard = mArgs["ImportWizard"] as ImportWizard;
            mImportWizard.ImportOption = mImportOption;

            mImportWizard.LoadRule();
            mImportWizard.ValidateRule.Save(Constants.ValidationRulePath);

            mResultFilename = Path.Combine(Constants.ValidationReportsFolder, Path.GetFileNameWithoutExtension(mImportOption.SelectedDataFile) + "(验证报告).xls");
            this.Text = mImportWizard.ValidateRule.Root.GetAttributeText("Name") + "-" + this.Text;
            this.Text += "(" + CurrentStep + "/" + TotalStep + ")"; //功能名称(目前页数/总页数)
            #region 初始化事件
            //加入可停止执行的事件内容
            lnkCancelValid.Click += (sender, e) => worker.CancelAsync();

            //加入检查验证结果程序代码
            btnViewResult.Click += (sender, e) =>
            {
                try
                {
                    Process.Start(mResultFilename);
                }
                catch (Exception ex)
                {
                    FISCA.Presentation.Controls.MsgBox.Show(ex.Message);
                }
            };
            #endregion

            StartValidate();
        }
        /// <summary>
        /// 建构式,传入精灵参数
        /// </summary>
        /// <param name="args"></param>
        public SelectImport(ArgDictionary args)
            : base(args)
        {
            InitializeComponent();

            this.PreviousButtonVisible = false;
            this.NextButtonTitle = "完成";
            this.NextButtonEnabled = false;

            //将精灵参数存起来用
            mArgs = args;
            mImportOption = mArgs["ImportOption"] as ImportFullOption;
            mImportWizard = mArgs["ImportWizard"] as ImportWizard;
            mValidatedInfo = mArgs["ValidatedInfo"] as ValidatedInfo;

            mImportName = mImportWizard.ValidateRule.Root.GetAttributeText("Name");

            this.Text = mImportName + "-" + this.Text;
            this.Text += "(5/5)"; //功能名称(目前页数/总页数)
            //this.TitleText += "(" + CurrentStep + "/" + TotalStep + ")"; //功能名称(目前页数/总页数)
        }
        /// <summary>
        /// 建构式,传入精灵参数
        /// </summary>
        /// <param name="args"></param>
        public SelectKey(ArgDictionary args)
            : base(args)
        {
            InitializeComponent();
            mArgs = args;
            mImportOption = args["ImportOption"] as ImportFullOption;
            mImportWizard = args["ImportWizard"] as ImportWizard;
            this.Text = mImportWizard.ValidateRule.Root.GetAttributeText("Name") + "-" + this.Text;
            this.Text += "(" + CurrentStep + "/" + TotalStep + ")"; //功能名称(目前页数/总页数)

            #region 将用户可选择的键值显示在画面上
            mSelectableKeyFields = args["SelectableKeyFields"] as Dictionary<string, List<string>>;

            int cboIdFieldLen = cboIdField.Width;

            foreach (List<string> KeyFields in mSelectableKeyFields.Values)
            {
                string NewItem = string.Join(",", KeyFields.ToArray());

                cboIdField.Items.Add(NewItem);

                if (NewItem.Length > cboIdFieldLen)
                    cboIdFieldLen = NewItem.Length;
            }

            if (cboIdField.Items.Count > 0)
            {
                cboIdField.SelectedIndex = 0;
                //cboIdField.Width = cboIdFieldLen;
            }
            #endregion

            #region 将用户可选择的数据动作
            ImportAction Actions = mImportWizard.GetSupportActions();

            bool IsInsert = (Actions & ImportAction.Insert) == ImportAction.Insert;
            bool IsUpdate = (Actions & ImportAction.Update) == ImportAction.Update;
            bool IsInsertOrUpdate = (Actions & ImportAction.InsertOrUpdate) == ImportAction.InsertOrUpdate;
            bool IsCover = (Actions & ImportAction.Cover) == ImportAction.Cover;
            bool IsDelete = (Actions & ImportAction.Delete) == ImportAction.Delete;

            if (IsInsert)
                lstActions.Items.Add("新增资料");
            if (IsUpdate)
                lstActions.Items.Add("更新数据");
            if (IsInsertOrUpdate)
                lstActions.Items.Add("新增或更新数据");
            if (IsCover)
                lstActions.Items.Add("覆盖数据");

            lstActions.SelectedIndexChanged += (sender, e) =>
            {
                switch ("" + lstActions.SelectedItem)
                {
                    case "新增资料": lblImportActionMessage.Text = "此选项是将所有数据新增到数据库中,不会对现有的数据进行任何修改动作。"; break;
                    case "更新数据": lblImportActionMessage.Text = "此选项将修改数据库中的现有数据,会依据您所指定的识别栏修改数据库中具有相同识别的数据。"; break;
                    case "新增或更新数据": lblImportActionMessage.Text = "此选项是将数据新增或更新到数据库中,会针对您的数据来自动判断新增或更新。"; break;
                    case "覆盖数据": lblImportActionMessage.Text = "此选项是将数据库中的数据都先删除再全部新增"; break;
                    case "删除数据": lblImportActionMessage.Text = "此选项将依汇入数据中的键值删除数据库中的现有数据,请您务必小心谨慎使用。"; break;
                };
            };

            lstActions.KeyDown += (sender, e) =>
            {
                if (e.KeyData == System.Windows.Forms.Keys.Delete)
                    if (IsDelete)
                        lstActions.Items.Add("删除数据");
            };

            lstActions.SelectedIndex = 0;

            #endregion
        }
        /// <summary>
        /// 建构式,传入精灵选项
        /// </summary>
        /// <param name="args"></param>
        public SelectSource(ArgDictionary args)
            : base(args)
        {
            InitializeComponent();

            //初始化参数
            mArgs = args;
            mImportWizard = args["ImportWizard"] as ImportWizard;
            mImportOption = TryGetOption();
            mImportName = mImportWizard.ValidateRule.Root.GetAttributeText("Name");
            mImportWizard.ImportOption = mImportOption;

            this.Text = mImportName + "-选择档案与汇入方式" + "(" + CurrentStep + "/" + TotalStep + ")";

            //加载验证规则及XSLT
            LoadValudateRule();

            //在使用者选择数据表时,将数据表的字段都记录下来
            lstSheetNames.SelectedIndexChanged += (sender, e) =>
            {
                mSheetHelper.SwitchSeet("" + lstSheetNames.SelectedItem);
                mImportOption.SelectedSheetName = "" + lstSheetNames.SelectedItem;
                mImportOption.SheetFields = mSheetHelper.Fields;
                this.NextButtonEnabled = ValidateNext();
            };

            //检视验证规则
            btnViewRule.Click += (sender, e) =>
            {
                XmlViewForm ViewForm = new XmlViewForm();

                ViewForm.PopXml(mImportName, mImportOption.SelectedValidateFile);

                ViewForm.ShowDialog();
            };

            //检视填表说明
            btnViewRuleExcel.Click += (sender, e) =>
            {
                Workbook book = new Workbook();

                string BookAndSheetName = mImportName + "(空白表格)";

                if (!string.IsNullOrEmpty(BookAndSheetName))
                    book.Worksheets[0].Name = BookAndSheetName;

                int Position = 0;

                foreach (XElement Element in mImportWizard.ValidateRule.Root.Element("FieldList").Elements("Field"))
                {
                    StringBuilder strCommentBuilder = new StringBuilder();

                    string Name = Element.GetAttributeText("Name");
                    bool Required = Element.GetAttributeBool("Required", false);

                    book.Worksheets[0].Cells[0, Position].PutValue(Name);
                    book.Worksheets[0].Cells[0, Position].Style.HorizontalAlignment = TextAlignmentType.Center;
                    book.Worksheets[0].Cells[0, Position].Style.VerticalAlignment = TextAlignmentType.Center;

                    if (Required)
                    {
                        book.Worksheets[0].Cells[0, Position].Style.BackgroundColor = System.Drawing.Color.Red;
                        strCommentBuilder.AppendLine("此为必要字段。");
                    }

                    foreach (XElement SubElement in Element.Elements("Validate"))
                        strCommentBuilder.AppendLine(SubElement.GetAttributeText("Description"));

                    book.Worksheets[0].Comments.Add(0, (byte)Position);
                    book.Worksheets[0].Comments[0, Position].Note = strCommentBuilder.ToString();
                    book.Worksheets[0].Comments[0, Position].WidthInch = 3;

                    Position++;
                }

                book.Worksheets[0].AutoFitColumns();
                Campus.Report.ReportSaver.SaveWorkbook(book, Path.Combine(Constants.ValidationReportsFolder, BookAndSheetName));
            };

            //选择源数据档案
            btnSelectFile.Click += (sender, e) =>
            {
                DialogResult dr = SelectSourceFileDialog.ShowDialog();

                if (dr == DialogResult.OK)
                {
                    try
                    {
                        //记录来源文件名
                        string FileName = SelectSourceFileDialog.FileName;

                        txtSourceFile.Text = SelectSourceFileDialog.FileName;
                        mImportOption.SelectedDataFile = FileName;
                        mSheetHelper = new SheetHelper(FileName);

                        //将数据表列表显示在画面上
                        lstSheetNames.Items.Clear();

                        foreach (Worksheet sheet in mSheetHelper.Book.Worksheets)
                            lstSheetNames.Items.Add(sheet.Name);

                        lstSheetNames.SelectedIndex = 0;
                    }
                    catch (Exception ve)
                    {
                        MsgBox.Show(ve.Message);
                    }
                }
            };

            //将前一步不出现,下一步先失效
            this.PreviousButtonVisible = false;
            this.NextButtonEnabled = false;
        }