Пример #1
0
        /// <summary>
        /// 检核栏位输入及查询清单
        /// </summary>
        private void ChackData()
        {
            string where = this.GetWhere();

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

                // 取得清单总笔数
                this.totalCount = archive_baseinfo.GetDataCount(reqBaseCol + reqDetailedCol + reqHealthCol,
                                                                where + reqBaseWhere);

                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.GetData(reqBaseCol + reqDetailedCol + reqHealthCol + reqBaseTipCol +
                                                        reqDetailedTipCol + reqHealthTipCol, where + reqBaseWhere, "", 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(6, 0, false).X;
                    toolTipX2 = this.dgvData.GetCellDisplayRectangle(7, 0, false).X;
                    toolTipX3 = this.dgvData.GetCellDisplayRectangle(8, 0, false).X;
                }

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