/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        TSBarrivebillBB arriveBillBB = new TSBarrivebillBB();

        try
        {
            string strWhere = this.StrWhere;
            DataSet ds = new DataSet();

            //到货通知单编号
            if (txtBillNo.Text.Trim() != "")
            {
                strWhere += " and  arrivebillNo like '%" + txtBillNo.Text.Replace("'", "''") + "%'";
            }

            //是否收货完成
            if (this.ddlIsFinishReceive.SelectedValue != "")
            {
                if (this.ddlIsFinishReceive.SelectedValue == "1")//收货完成
                {
                    strWhere += " and not exists(select 1 from dbo.BArriveDetail  as t where t.arriveBillNo=dbo.TSBArriveBill.arriveBillNo and t.isFinishReceive=0)";
                }
                else//未收货完成
                {
                    strWhere += " and exists(select 1 from dbo.BArriveDetail as t where t.arriveBillNo=dbo.TSBArriveBill.arriveBillNo and t.isFinishReceive=0)";
                }
            }

            ds = arriveBillBB.GetList(strWhere);
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            arriveBillBB.Dispose();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.StrWhere = "1=1";
            string id= Request.QueryString["id"];

            BArriveDetailBB arriveDetailBB = new BArriveDetailBB();
            TSBarrivebillBB arriveBillBB = new TSBarrivebillBB();
            DataSet ds = new DataSet();

            try
            {
                TSBarrivebillData data = arriveBillBB.GetModel(Convert.ToInt32(id));
                this.IdValue =  data.arriveBillNo;
                this.StrWhere = " arriveBillNo='" + data.arriveBillNo + "'";
                txtBillNo.Text = data.arriveBillNo;
                this.DtDetail = arriveDetailBB.GetTSVList(this.StrWhere).Tables[0];
            }
            finally
            {
                arriveDetailBB.Dispose();
            }

            this.BindGrid();
        }

        InitPageData();
    }
 private void ShowArriveBillNo()
 {
     TSBarrivebillBB bb = new TSBarrivebillBB();
     lbCheckBillNo.Text = bb.GetCurrentArriveBillNo();
 }