Exemple #1
0
        /// <summary>
        /// RawDataImport方法,将数据从Excel表格读取到RawDataFrm中的DataGridView中
        /// </summary>
        /// <param name="filePath"></param>
        private void RawDataImport(string filePath, object objList)
        {
            string areaName = "";
            int    flag;
            ImportingRawDataBLL iRdb = new ImportingRawDataBLL();

            //RawDataFrm 构造方法,以TabPage_Close方法为实参,从而实现了委托中的关闭页面的操作
            //使用委托,通过构造函数,将主窗体的TabPage_Close方法传递给子窗体 RawDataFrm
            RawDataFrm rawDataFrm = new RawDataFrm(TabPage_Close);//实现关闭页面的委托

            rawDataFrm.TopLevel = false;
            XtraTabPage tabPage = new XtraTabPage();

            rawDataFrm.Width  = workAreaTabPageController.Width - 5;
            rawDataFrm.Height = workAreaTabPageController.Height;
            rawDataFrm.rawDataGridView.Height = rawDataFrm.Height - 80;
            rawDataFrm.btnImport.Location     = new System.Drawing.Point(rawDataFrm.Width - 260, rawDataFrm.Height - 70);
            rawDataFrm.btnCancle.Location     = new System.Drawing.Point(rawDataFrm.Width - 160, rawDataFrm.Height - 70);
            flag = LoadList(rawDataFrm, iRdb, filePath, objList, out areaName);
            if (flag != 0)
            {
                tabPage.Text = areaName + "数据导入预览";
                workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text);
                workAreaTabPageController.SelectedTabPage.Controls.Add(rawDataFrm);
                workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage);
                rawDataFrm.Show();
            }
        }
Exemple #2
0
        /// <summary>
        /// 加载RawDataFrm窗体
        /// </summary>
        /// <param name="rawDataFrm"></param>
        /// <param name="ird"></param>
        /// <param name="filePath"></param>
        public int LoadList(RawDataFrm rawDataFrm, ImportingRawDataBLL ird, string filePath, object objList, out string name)
        {
            List <SortedTargetsParas> listSbp          = new List <SortedTargetsParas>();
            List <RawData>            rawDataList      = new List <RawData>();
            List <TargetEntity>       targetEntityList = new List <TargetEntity>();
            DataGridViewColumnEditor  dgvCE            = new DataGridViewColumnEditor();

            name = "";
            int flag = 0;

            if (objList as List <TargetEntity> != null)
            {
                rawDataFrm.rawDataGridView.AutoGenerateColumns = true;
                targetEntityList = ird.ReadTgtfromExcel(filePath);
                if (targetEntityList != null)
                //if(targetEntityList.Count !=0)
                {
                    rawDataFrm.rawDataGridView.Name       = "dgvTarget";
                    rawDataFrm.rawDataGridView.DataSource = targetEntityList;
                    dgvCE.ColumHeaderEdit(rawDataFrm.rawDataGridView, rawDataFrm.rawDataGridView.Name);
                    name = "目标区_";
                    flag = 1;
                }
                else
                {
                    flag = 0;
                }
            }
            return(flag);
        }
Exemple #3
0
        /// <summary>
        /// 重载LoadList方法
        /// </summary>
        /// <param name="rawDataFrm"></param>
        private void LoadList(RawDataFrm rawDataFrm)
        {
            RawDataBLL rawDataBLL = new RawDataBLL();

            rawDataFrm.rawDataGridView.AutoGenerateColumns = true;
            DataGridViewColumnEditor dgvCE = new DataGridViewColumnEditor();

            rawDataFrm.rawDataGridView.Name = "dgvTarget";

            rawDataFrm.rawDataGridView.DataSource = rawDataBLL.GetList();
            dgvCE.ColumHeaderEdit(rawDataFrm.rawDataGridView, rawDataFrm.rawDataGridView.Name);
        }
Exemple #4
0
        private void toolStripBtn_Save_Click(object sender, EventArgs e)
        {
            DataGridViewOutputToExcel dgvoe = new DataGridViewOutputToExcel();

            //ddqf为null时,表示其在内存中并没有被分配空间,所以,其是否等于null要用 == 来判断,而equals(null)是比较的内存地址,所以
            //会报错。即ddqf.equals(null)肯定会报错。
            if (ddqf != null)
            {
                //dgvoe.OutputAsExcelFile(ddqf.dgv_DbQuery);
                dgvoe.Dgv2Excel(ddqf.dgv_DbQuery);
                ddqf = null;
            }
            else if (rdf != null)
            {
                //dgvoe.OutputAsExcelFile(rdf.rawDataGridView);
                dgvoe.Dgv2Excel(rdf.rawDataGridView);
                rdf = null;
            }
            else if (gf != null)
            {
                if (gf.tabControlGrading.SelectedTab.Equals(gf.tabPageBasin))
                {
                    //dgvoe.OutputAsExcelFile(gf.dgvView_Basin);
                    dgvoe.Dgv2Excel(gf.dgvView_Basin);
                }
                if (gf.tabControlGrading.SelectedTab.Equals(gf.tabPageBlock))
                {
                    //dgvoe.OutputAsExcelFile(gf.dgvView_Block);
                    dgvoe.Dgv2Excel(gf.dgvView_Block);
                }
                if (gf.tabControlGrading.SelectedTab.Equals(gf.tabPageTarget))
                {
                    //dgvoe.OutputAsExcelFile(gf.dgvView_Target);
                    dgvoe.Dgv2Excel(gf.dgvView_Target);
                }
                gf = null;
            }
            else if (dqf != null)
            {
                dgvoe.Dgv2Excel(dqf.dgv_DbQuery);
                dqf = null;
            }
            else
            {
                MessageBox.Show("没有可用来存储的数据对象。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #5
0
        /// <summary>
        /// 重载TabPageCreate方法,实现对RawDataFrm窗体创建Page的功能
        /// </summary>
        /// <param name="pageText"></param>
        /// <param name="rawdataFrm"></param>
        //重载TabPageCreate方法
        public void TabPageCreate(string pageText, RawDataFrm rawdataFrm)
        {
            workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(pageText);
            workAreaTabPageController.SelectedTabPage.Controls.Add(rawdataFrm);
            workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage);

            //设置窗体的宽度和新建Page的宽度相等
            rawdataFrm.Width = workAreaTabPageController.Width;

            //设置窗体的高度和新建Page的高度相等
            rawdataFrm.Height = workAreaTabPageController.Height;

            //将窗体上的两个按钮禁止显示
            rawdataFrm.btnCancle.Visible = false;
            rawdataFrm.btnImport.Visible = false;

            //设置rawDataGridView的dock属性,使其填充窗体
            rawdataFrm.rawDataGridView.Dock = DockStyle.Fill;
        }
Exemple #6
0
        private void sideBar_BtnBrowse_Click(object sender, EventArgs e)
        {
            RawDataFrm rawDataFrm = new RawDataFrm(TabPage_Close);

            rdf = rawDataFrm;
            rawDataFrm.TopLevel = false;
            XtraTabPage tabPage = new XtraTabPage();

            rawDataFrm.Width  = workAreaTabPageController.Width - 5;
            rawDataFrm.Height = workAreaTabPageController.Height;
            rawDataFrm.rawDataGridView.Height = rawDataFrm.Height - 80;
            rawDataFrm.btnImport.Visible      = false;
            rawDataFrm.btnCancle.Location     = new System.Drawing.Point(rawDataFrm.Width - 160, rawDataFrm.Height - 70);
            LoadList(rawDataFrm);
            tabPage.Text = "目标区_数据浏览";
            workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text);
            workAreaTabPageController.SelectedTabPage.Controls.Add(rawDataFrm);
            workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage);
            //workAreaTabPageController.TabPages.Remove (x=>x)
            rawDataFrm.Show();
        }