示例#1
0
        private void DgBind()
        {
            string strBillNo = txtBillNo.Text.Trim();
            string strDate   = dtpDate.Value.ToString("yyyy-MM-dd");

            err = null;
            DataTable dt = new DataTable();

            if (this.checkBox1.Checked)
            {
                dt = ca.GetBillOfValidateHis(strBillNo, strDate, out err);
            }
            else
            {
                dt = ca.GetBillOfValidate(strBillNo, strDate, out err);
            }
            if (err != null)
            {
                MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err);
                return;
            }
            if (dt != null)
            {
                this.dataGrid1.SetDataBinding(null, "");
                this.dataGrid1.SetDataBinding(dt, "");
                this.EnToCh("收油核对单号,出库单号,供油单位,收油单位,发油日期,收油日期,油料名称,型号,单位,运输车号,承运人,原发数,验收数,运输公里数,运输损耗定额,实际损耗,定额内运输损耗,超定额运输损耗,发油地点,入库方式,操作员,操作时间", "60,60,60,100,80,100,80,90,90", dt, this.dataGrid1);
            }
            else
            {
                MessageBox.Show("查询错误,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }