Example #1
0
        private void GetData()
        {
            string where = this.GetWhere();

            if (string.IsNullOrEmpty(where))
            {
                MessageBox.Show("请选择查询条件!", "查询条件", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                this.btnQuery.Enabled = false;

                // 取得清单总笔数
                this.totalCount = archive_baseinfo.GetHealthCount(reqGerneralCol + reqLifeCol + reqPhysicalCol +
                                                                  reqCheckCol + reqFunctionCol + reqHealthCol + reqAssessCol, where + reqWhere);

                this.totalPages = (this.totalCount <= this.pageCount) ? 1 : ((this.totalCount / this.pageCount) +
                                                                             (((this.totalCount % this.pageCount) > 0) ? 1 : 0));
                this.lbTotalCount.Text = string.Format("共计{0}条", this.totalCount.ToString());

                if (this.currentPage > totalPages - 1)
                {
                    this.currentPage--;
                }

                // 清单资料
                DataTable dt = archive_baseinfo.GetHealthData(reqGerneralCol + reqLifeCol + reqPhysicalCol +
                                                              reqCheckCol + reqFunctionCol + reqHealthCol + reqAssessCol + reqGerneralTipCol + reqLifeTipCol +
                                                              reqPhysicalTipCol + reqCheckTipCol + reqFunctionTipCol + reqHealthTipCol + reqAssessTipCol,
                                                              where + reqWhere, "", this.currentPage * this.pageCount, this.pageCount
                                                              );

                this.TransDs(dt);

                this.lbPages.Text = string.Format("{0}/{1}页", this.currentPage + 1, this.totalPages);

                this.bds.DataSource     = dt;
                this.dgvData.DataSource = this.bds;

                if (dt != null && dt.Rows.Count > 0)
                {
                    toolTipX  = this.dgvData.GetCellDisplayRectangle(3, 0, false).X;
                    toolTipX2 = this.dgvData.GetCellDisplayRectangle(4, 0, false).X;
                    toolTipX3 = this.dgvData.GetCellDisplayRectangle(5, 0, false).X;
                    toolTipX4 = this.dgvData.GetCellDisplayRectangle(6, 0, false).X;
                    toolTipX5 = this.dgvData.GetCellDisplayRectangle(7, 0, false).X;
                    toolTipX6 = this.dgvData.GetCellDisplayRectangle(8, 0, false).X;
                    toolTipX7 = this.dgvData.GetCellDisplayRectangle(9, 0, false).X;
                }

                this.groupBox1.Enabled = false;
                this.btnQuery.Enabled  = true;
                this.btnQuery.Text     = "重置条件";
            }
        }