示例#1
0
        /// <summary>
        /// 查询数据窗口,数据从数据库获得
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sideBar_BtnQuery_Click(object sender, EventArgs e)
        {
            DbDataQueryFrm dbDataQueryFrm = new DbDataQueryFrm(TabPage_Close);

            ddqf = dbDataQueryFrm;
            dbDataQueryFrm.TopLevel = false;
            dbDataQueryFrm.tlStripBtn_MultiDel.Visible    = false;
            dbDataQueryFrm.tlStripBtn_SingleDel.Visible   = false;
            dbDataQueryFrm.tlStripBtn_BlankRowAdd.Visible = false;
            dbDataQueryFrm.tlStripBtn_BlankRowDel.Visible = false;
            dbDataQueryFrm.tlStripBtn_DbUpdate.Visible    = false;
            dbDataQueryFrm.tlStripBtn_DataModify.Visible  = false;
            dbDataQueryFrm.tlStrip_ChkBox.Visible         = false;
            dbDataQueryFrm.toolStripSeparator1.Visible    = false;
            dbDataQueryFrm.toolStripSeparator3.Visible    = false;
            dbDataQueryFrm.toolStripSeparator4.Visible    = false;
            dbDataQueryFrm.toolStripSeparator5.Visible    = false;
            XtraTabPage tabPage = new XtraTabPage();

            dbDataQueryFrm.Width              = workAreaTabPageController.Width - 5;
            dbDataQueryFrm.Height             = workAreaTabPageController.Height;
            dbDataQueryFrm.dgv_DbQuery.Height = dbDataQueryFrm.Height - 62;
            tabPage.Text = "目标区_数据查询";
            workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text);
            workAreaTabPageController.SelectedTabPage.Controls.Add(dbDataQueryFrm);
            workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage);
            dbDataQueryFrm.Show();
        }
示例#2
0
        private void sideBar_BtnAddData_Click(object sender, EventArgs e)
        {
            DbDataQueryFrm dbDataQueryFrm = new DbDataQueryFrm(TabPage_Close);

            //lbl_Status.Text = "选中行数:"+ (dbDataQueryFrm.rowCounter).ToString();
            dbDataQueryFrm.tlStrip_ChkBox.Enabled         = false;
            dbDataQueryFrm.tlStrip_ChkBox.Visible         = false;
            dbDataQueryFrm.tlStrip_DbQueryAll.Enabled     = false;
            dbDataQueryFrm.tlStrip_DbQueryAll.Visible     = false;
            dbDataQueryFrm.toolStripSeparator5.Visible    = false;
            dbDataQueryFrm.toolStripSeparator2.Visible    = false;
            dbDataQueryFrm.tlStrip_DbQueryBy.Enabled      = false;
            dbDataQueryFrm.tlStrip_DbQueryBy.Visible      = false;
            dbDataQueryFrm.tlStripBtn_DbUpdate.Visible    = false;
            dbDataQueryFrm.tlStripBtn_MultiDel.Enabled    = true;
            dbDataQueryFrm.tlStripBtn_SingleDel.Enabled   = true;
            dbDataQueryFrm.tlStripBtn_BlankRowAdd.Enabled = true;
            dbDataQueryFrm.tlStripBtn_BlankRowDel.Visible = false;

            //dbDataQueryFrm.tlStrip_DbQueryAll.Margin = new Padding(3, 3, 1, 3);
            dbDataQueryFrm.TopLevel = false;
            XtraTabPage tabPage = new XtraTabPage();

            dbDataQueryFrm.Width  = workAreaTabPageController.Width - 5;
            dbDataQueryFrm.Height = workAreaTabPageController.Height;
            //dbDataQueryFrm.dgv_DbQuery.Height = dbDataQueryFrm.Height;
            dbDataQueryFrm.dgv_DbQuery.Height = dbDataQueryFrm.Height - 62;
            tabPage.Text = "目标区_数据录入";
            workAreaTabPageController.SelectedTabPage = workAreaTabPageController.TabPages.Add(tabPage.Text);
            workAreaTabPageController.SelectedTabPage.Controls.Add(dbDataQueryFrm);
            workAreaTabPageController.TabPages.Add(workAreaTabPageController.SelectedTabPage);
            dbDataQueryFrm.Show();
        }
示例#3
0
        /// <summary>
        /// 重载LoadList方法
        /// </summary>
        /// <param name="rawDataFrm"></param>
        /// <param name="sql"></param>
        private void LoadList(DbDataQueryFrm dbDataQueryFrm)
        {
            RawDataBLL rawDataBLL = new RawDataBLL();

            dbDataQueryFrm.dgv_DbQuery.AutoGenerateColumns = true;
            DataGridViewColumnEditor dgvCE = new DataGridViewColumnEditor();

            dbDataQueryFrm.dgv_DbQuery.Name       = "dgvTarget";
            dbDataQueryFrm.dgv_DbQuery.DataSource = rawDataBLL.GetList();
            dgvCE.ColumHeaderEdit(dbDataQueryFrm.dgv_DbQuery, dbDataQueryFrm.dgv_DbQuery.Name);
        }
示例#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);
            }
        }