private void barBtnDel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (string.IsNullOrEmpty(vsRowNum.ToString()))
            {
                MessageBox.Show("错误信息:\n必须选中一行");
            }
            else
            {
                int[] Rows = gridView1.GetSelectedRows();
                for (int i = 0; i < Rows.Length; i++)
                {
                    selectRows.ImportRow(sampleSumTable.Rows[Rows[i]]);
                }
                SampleAduit Aduit = new SampleAduit();
                for (int j = 0; j < Rows.Length; j++)
                {
                    Aduit.RemoveRow(sampleSumTable, selectRows.Rows[selectRows.Rows.Count - 1 - j][0]);
                }

                barBtnUndo.Enabled = true;
                rowsIndex.Clear();

                deleted           = deleted + Rows.Length;
                qualified         = sampleSum - deleted;
                barStatic.Caption = string.Format("样本总数:{0}  已删样本数 {1} 合格样本数 {2}", sampleSum, deleted, qualified);
                if (!(Overview == null || Overview.IsDisposed))
                {
                    Overview.Activate();
                    Overview.UpdateSeries(sampleSumTable);
                }
            }
        }
        private void barBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (filepath == null)
            {
                MessageBox.Show("错误信息:\n样本调查数据的值:是必需的");
            }
            else
            {
                //if (selectRows.Rows.Count == 0)
                //{
                //    //加载地图
                //    EnviVars.instance.MapControl.AddLayer(_pFtLayer);
                //    //MAP.AddShpFileToMap(filepath);
                //}
                //else
                if (DialogResult.OK == XtraMessageBox.Show("是否保存?保存后无法撤销修改!", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
                {
                    string queryStr = string.Empty;
                    for (int i = 0; i < selectRows.Rows.Count; i++)
                    {
                        queryStr = queryStr + "FID" + " = " + selectRows.Rows[i][0] + " OR ";
                    }
                    queryStr = queryStr.Substring(0, queryStr.Length - 4);
                    SampleAduit aduit = new SampleAduit();
                    if (aduit.DeleFeature(_pFtLayer.FeatureClass, queryStr))
                    {
                        XtraMessageBox.Show("保存成功!");
                        selectRows.Rows.Clear();
                        rowsIndex.Clear();

                        EnviVars.instance.MapControl.Refresh();

                        ITableConversion conver = new TableConversion();
                        this.sampleSumTable = conver.AETableToDataTable(_pFtLayer.FeatureClass);
                        if (sampleSumTable.Columns.Contains("shape"))
                        {
                            sampleSumTable.Columns.Remove("shape");
                        }
                        gridView1.Columns.Clear();
                        sampleSumTable.DefaultView.Sort = "FID ASC";
                        gridControlTable.DataSource     = sampleSumTable;
                        gridControlTable.Refresh();
                    }
                }
            }
        }
        private void barBtnRedo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ChkDoEnable();
            if (!barBtnRedo.Enabled)
            {
                return;
            }

            //for (int j = 0; j < rowsIndex.Count; j++)
            //{

            //    SampleAduit Aduit = new SampleAduit();

            //    //sampleSumTable.Rows.Remove(sampleSumTable.Rows[j]);
            //    string foundKey = sampleSumTable.Columns[0].ColumnName + "=" + rowsIndex[rowsIndex.Count - 1 - j];
            //    DataRow[] foundRow = sampleSumTable.Select(foundKey);
            //    foreach (DataRow row in foundRow)
            //    {
            //        selectRows.ImportRow(row);
            //    }
            //    Aduit.RemoveRow(sampleSumTable, rowsIndex[rowsIndex.Count - 1 - j]);
            //    rowsIndex.RemoveAt(rowsIndex.Count - 1-j);
            //}
            SampleAduit Aduit    = new SampleAduit();
            string      queryStr = "FID = " + rowsIndex[rowsIndex.Count - 1];

            DataRow[] foundRow = sampleSumTable.Select(queryStr);
            if (foundRow.Length > 0)
            {
                selectRows.ImportRow(foundRow[0]);
                Aduit.RemoveRow(sampleSumTable, rowsIndex[rowsIndex.Count - 1]);
                rowsIndex.RemoveAt(rowsIndex.Count - 1);
                deleted++;
                qualified         = sampleSum - deleted;
                barStatic.Caption = string.Format("样本总数:{0}  已删样本数 {1} 合格样本数 {2}", sampleSum, deleted, qualified);
            }
            if (!(Overview == null || Overview.IsDisposed))
            {
                Overview.Activate();
                Overview.UpdateSeries(sampleSumTable);
            }
            ChkDoEnable();
        }
        // OK
        private void siB_Ok_Click(object sender, EventArgs e)
        {
            WaitDialogForm frmWait = new WaitDialogForm("正在生成...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                SampleAduit Aduit = new SampleAduit();
                if (cBEMethod.Text == "分层比率估计")
                {
                    if (Aduit.RatioPreprocessing(cBSamplePopu.Text, cBESample.Text, cBESamSurvey.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBEPopuBasis.Text, cBESampleClassic.Text, cBExport.Text, cBESamBasis.Text, cBECunName.Text))
                    {
                        BLL.ProductMeta meta = new BLL.ProductMeta(cBExport.Text.TrimEnd(), "", "", "总体估计", "抽样和推算结果");
                        meta.WriteDocMeta();
                        BLL.ProductQuickView view = new BLL.ProductQuickView(cBExport.Text.TrimEnd());
                        view.Create();
                        MessageBox.Show("估算成功!");
                        ExportData.report = cBExport.Text;
                    }
                }
                else
                {
                    if (Aduit.ProbabilityProcessing(cBSamplePopu.Text, cBESample.Text, cBEPopuBasis.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBESamBasis.Text, cBESamSurvey.Text, cBECunName.Text, cBExport.Text))
                    {
                        MessageBox.Show("估算成功!");
                        ExportData.report = cBExport.Text;
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Log.WriteLog(typeof(frmSampleSimulation), ex);
            }
            finally
            {
                frmWait.Close();
                this.Close();
            }
        }
        // OK
        private void siB_Ok_Click(object sender, EventArgs e)
        {
            frmWaitDialog frmWait = new frmWaitDialog("正在生成...", "提示信息");

            try
            {
                frmWait.Owner   = this;
                frmWait.TopMost = false;
                SampleAduit Aduit = new SampleAduit();
                if (cBEMethod.Text == "分层比率估计")
                {
                    if (Aduit.RatioPreprocessing(cBSamplePopu.Text, cBESample.Text, cBESamSurvey.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBEPopuBasis.Text, cBESamCunName.Text, cBExport.Text, cBESamBasis.Text))
                    {
                        MessageBox.Show("估算成功!");
                        ExportData.report = cBExport.Text;
                    }
                }
                else
                {
                    if (Aduit.ProbabilityProcessing(cBSamplePopu.Text, cBESample.Text, cBEPopuBasis.Text, cBEPopuLayer.Text, cBESamLayer.Text, cBESamBasis.Text, cBESamSurvey.Text, cBESamCunName.Text, cBExport.Text))
                    {
                        MessageBox.Show("估算成功!");
                        ExportData.report = cBExport.Text;
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Log.WriteLog(typeof(frmSampleSimulation), ex);
            }
            finally
            {
                frmWait.Close();
                this.Close();
            }
        }