/// <summary>
    /// 删除
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDel_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        BCheckBillBB checkBillBB = new BCheckBillBB();
        SCommBB comBB = new SCommBB();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    retChecked = true;
                    int id = int.Parse(chkId.ValidationGroup);
                    BCheckBillData model = checkBillBB.GetModel(id);

                    if (model.instantState == "01")//判断检测单是否已经提交,已经提交不允许删除
                    {
                        //删除主数据
                        checkBillBB.DeleteRecord(id);

                        //删除明细
                        string strsql = "delete  from BCheckDetail where checkBillId='" + id.ToString() + "'";
                        comBB.Query(strsql);
                    }
                    else
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前检测单已经提交,不允许删除!\");", true);
                        return;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            checkBillBB.Dispose();
            comBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }